You are here

function facetapi_apachesolr_facetapi_query_term_prepare in Facet API 6

Implementation of hook_facetapi_query_QUERY_TYPE_prepare().

File

contrib/facetapi_apachesolr/facetapi_apachesolr.module, line 90
The Apache Solr Search Integration module's implementation of the the Facet API.

Code

function facetapi_apachesolr_facetapi_query_term_prepare(FacetapiAdapter $adapter, array $facet, &$params, $query) {
  $searcher = $adapter
    ->getSearcher();

  // Adds the operator parameter.
  $operator = facetapi_setting_get('operator', $searcher, '', $facet['name']);
  $ex = FACETAPI_OPERATOR_OR != $operator ? '' : "{!ex={$facet['field']}}";
  $params['facet.field'][] = $ex . $facet['field'];

  // Adds "hard limit" parameter to prevent too many return values.
  $limit = facetapi_setting_get('hard_limit', $searcher, '', $facet['name']);
  $params['f.' . $facet['field'] . '.facet.limit'] = $limit !== NULL ? (int) $limit : 20;
}