You are here

function apachesolr_nodeaccess_apachesolr_modify_query in Apache Solr Search 6

Same name and namespace in other branches
  1. 5.2 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()
  2. 5 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()
  3. 6.2 contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module \apachesolr_nodeaccess_apachesolr_modify_query()

Implementation of hook_apachesolr_modify_query().

File

contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module, line 65

Code

function apachesolr_nodeaccess_apachesolr_modify_query(&$query, &$params, $caller) {
  global $user;
  try {
    $subquery = _apachesolr_nodeaccess_build_subquery($user);
  } catch (Exception $e) {
    $query = NULL;
    watchdog("apachesolr_nodeaccess", 'User %name (UID:!uid) cannot search: @message', array(
      '%name' => $user->name,
      '!uid' => $user->uid,
      '@message' => $e
        ->getMessage(),
    ));
    return;
  }
  if (!empty($subquery)) {
    $query
      ->add_subquery($subquery, 'OR');
  }
}