You are here

function apachesolr_autocomplete_basic_params in Apache Solr Autocomplete 7

Same name and namespace in other branches
  1. 6 apachesolr_autocomplete.module \apachesolr_autocomplete_basic_params()

Return the basic set of parameters for the Solr query.

Parameters

$suggestions_to_return: Number of facets to return.

array $search_page: Search page.

Return value

array Solr query parameters array.

2 calls to apachesolr_autocomplete_basic_params()
apachesolr_autocomplete_suggest_additional_term in ./apachesolr_autocomplete.module
Helper function that suggests additional terms to search for.
apachesolr_autocomplete_suggest_word_completion in ./apachesolr_autocomplete.module
Helper function that suggests ways to complete partial words.

File

./apachesolr_autocomplete.module, line 294
Alters search forms to suggest terms using Apache Solr using AJAX. Thanks to: robertDouglass who contributed some of the code. sch4lly for contributing to D7 version

Code

function apachesolr_autocomplete_basic_params($suggestions_to_return, $search_page = NULL) {

  // Include any settings provided by apachesolr_search, if defined.
  if (!empty($search_page) && function_exists("apachesolr_search_conditions_default")) {
    $params = apachesolr_search_conditions_default($search_page);
  }
  else {
    $params = array();
  }
  return array_merge($params, array(
    'facet' => 'true',
    'facet.field' => array(
      'spell',
    ),
    // We ask for $suggestions_to_return * 5 facets, because we want
    // not-too-frequent terms (will be filtered below). 5 is just my best guess.
    'facet.limit' => $suggestions_to_return * 5,
    'facet.mincount' => 1,
    'start' => 0,
    'rows' => 0,
  ));
}