You are here

public function SearchApiViewsHandlerArgumentFulltext::query in Search API 7

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides SearchApiViewsHandlerArgument::query

File

contrib/search_api_views/includes/handler_argument_fulltext.inc, line 67
Contains SearchApiViewsHandlerArgumentFulltext.

Class

SearchApiViewsHandlerArgumentFulltext
Views argument handler class for handling fulltext fields.

Code

public function query($group_by = FALSE) {
  if ($this->options['fields']) {
    try {
      $this->query
        ->fields($this->options['fields']);
    } catch (SearchApiException $e) {
      $this->query
        ->abort($e
        ->getMessage());
      return;
    }
  }
  if ($this->options['conjunction'] != 'AND') {
    $this->query
      ->setOption('conjunction', $this->options['conjunction']);
  }
  $old = $this->query
    ->getOriginalKeys();
  $this->query
    ->keys($this->argument);
  if ($old) {
    $keys =& $this->query
      ->getKeys();
    if (is_array($keys)) {
      $keys[] = $old;
    }
    elseif (is_array($old)) {

      // We don't support such nonsense.
    }
    else {
      $keys = "({$old}) ({$keys})";
    }
  }
}