You are here

function search_api_ranges_minmax_execute in Search API ranges 7

Executes the min/max search query.

Return value

array An associative array containing the search results. The following keys are standardized:

  • 'result count': The overall number of results for this query, without range restrictions. Might be approximated, for large numbers.
  • results: An array of results, ordered as specified. The array keys are the items' IDs, values are arrays containing the following keys:

    • id: The item's ID.
    • score: A float measuring how well the item fits the search.
    • entity (optional): If set, the fully loaded entity. This field should always be used by modules using search results, to avoid duplicate entity loads.
    • excerpt (optional): If set, an HTML text containing highlighted portions of the fulltext that match the query.
  • warnings: A numeric array of translated warning messages that may be displayed to the user.
  • ignored: A numeric array of search keys that were ignored for this search (e.g., because of being too short or stop words).
  • performance: An associative array with the time taken (as floats, in seconds) for specific parts of the search execution:

    • complete: The complete runtime of the query.
    • hooks: Hook invocations and other server-independent processing.
    • preprocessing: Preprocessing of the service class.
    • execution: The actual query to the search server, in whatever form.
    • postprocessing: Preparing the results for returning.

Additional metadata may be returned in other keys. Only 'result count' and 'results' always have to be set, all other entries are optional.

1 call to search_api_ranges_minmax_execute()
search_api_ranges_minmax in ./search_api_ranges.module
Find the lowest/highest valuse for the active facets

File

./search_api_ranges.module, line 289
Performs min/max queries through Search API and provides UI Slider display widget for Facet API

Code

function search_api_ranges_minmax_execute(SearchApiQuery $query) {
  $start = microtime(TRUE);

  // Prepare the query for execution by the server.
  $query
    ->preExecute();
  $pre_search = microtime(TRUE);

  // Execute query.
  $response = $query
    ->getIndex()
    ->server()
    ->search($query);
  $post_search = microtime(TRUE);

  // Postprocess the search results.
  $query
    ->postExecute($response);
  $end = microtime(TRUE);
  $response['performance']['complete'] = $end - $start;
  $response['performance']['hooks'] = $response['performance']['complete'] - ($post_search - $pre_search);
  return $response;
}