You are here

function apachesolr_drupal_query in Apache Solr Search 6

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_drupal_query()
  2. 5.2 apachesolr.module \apachesolr_drupal_query()
  3. 5 apachesolr.module \apachesolr_drupal_query()
  4. 6.3 apachesolr.module \apachesolr_drupal_query()
  5. 6.2 apachesolr.module \apachesolr_drupal_query()
  6. 7 apachesolr.module \apachesolr_drupal_query()

Factory function for query objects.

Parameters

$keys: The string that a user would type into the search box. Suitable input may come from search_get_keys().

$filters: Key and value pairs that are applied as a filter query.

$solrsort: Visible string telling solr how to sort.

$base_path: The search base path (without the keywords) for this query.

3 calls to apachesolr_drupal_query()
apachesolr_mlt_suggestions in ./apachesolr.module
Performs a moreLikeThis query using the settings and retrieves documents.
apachesolr_search_execute in ./apachesolr_search.module
Execute a search results based on keyword, filter, and sort strings.
_apachesolr_nodeaccess_build_subquery in contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module
Creates a Solr query for a given user

File

./apachesolr.module, line 1445
Integration with the Apache Solr search application.

Code

function apachesolr_drupal_query($keys = '', $filters = '', $solrsort = '', $base_path = '') {
  list($module, $class) = variable_get('apachesolr_query_class', array(
    'apachesolr',
    'Solr_Base_Query',
  ));
  module_load_include('php', $module, $class);
  try {
    $query = new $class(apachesolr_get_solr(), $keys, $filters, $solrsort, $base_path);
  } catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);
    $query = NULL;
  }
  return $query;
}