You are here

function search_api_live_results_pages_query in Search API live results 7

Create the query that would be issued for the given search for the complete keys.

Parameters

SearchApiLiveResultsSearch $search: The search for which to create the query.

$complete: A string containing the complete search keys.

$incomplete: A string containing the incomplete last search key.

Return value

SearchApiQueryInterface The query that would normally be executed when only $complete was entered as the search keys for the given search.

1 string reference to 'search_api_live_results_pages_query'
search_api_live_results_search_api_live_results_types in ./search_api_live_results.module
Implements hook_search_api_live_results_types().

File

./search_api_live_results.search_api_page.inc, line 63
Contains code for integrating with the "Search pages" module.

Code

function search_api_live_results_pages_query(SearchApiLiveResultsSearch $search, $keys) {
  $page = search_api_page_load($search->options['custom']['page_id']);
  $conjunction = isset($search->options['conjunction']) ? $search->options['conjunction'] : 'AND';
  $query = search_api_query($page->index_id, array())
    ->keys(array(
    '#conjunction' => $conjunction,
  ) + $keys);
  if (!empty($page->options['fields'])) {
    $query
      ->fields($page->options['fields']);
  }
  return $query;
}