You are here

public function SearchApiAutocompleteSearch::getQuery in Search API Autocomplete 7

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

Parameters

$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 this search.

Throws

SearchApiException If the query couldn't be created.

File

./search_api_autocomplete.entity.php, line 280
Contains SearchApiAutocompleteSearch.

Class

SearchApiAutocompleteSearch
Describes the autocomplete settings for a certain search.

Code

public function getQuery($complete, $incomplete) {
  $info = search_api_autocomplete_get_types($this->type);
  if (empty($info['create query'])) {
    return NULL;
  }
  $query = $info['create query']($this, $complete, $incomplete);
  if ($complete && !$query
    ->getKeys()) {
    $query
      ->keys($complete);
  }
  return $query;
}