You are here

function facetapi_luceneapi_match_query in Facet API 6

Executes a match query, returns array keyed by document IDs. This method skips sorting, so it more efficient than calling luceneapi_find.

Parameters

$index: A Zend_Search_Lucene_Interface object.

$query: A Zend_Search_Lucene_Search_Query object.

Return value

An array keyed by document IDs.

1 call to facetapi_luceneapi_match_query()
FacetapiLuceneapiAdapter::getFacetData in contrib/facetapi_luceneapi/facetapi_luceneapi.adapter.inc
Returns a normalized array with facet counts included.

File

contrib/facetapi_luceneapi/facetapi_luceneapi.cache.inc, line 19
Term frequency cache functions.

Code

function facetapi_luceneapi_match_query(Zend_Search_Lucene_Interface $index, Zend_Search_Lucene_Search_Query $query) {
  $docs = array();
  try {
    $query = $query
      ->rewrite($index)
      ->optimize($index);
    $query
      ->execute($index);
    $docs = $query
      ->matchedDocs();
  } catch (Exception $e) {
    luceneapi_throw_error($e, WATCHDOG_ERROR, 'facetapi_luceneapi');
  }
  return $docs;
}