public function SearchQuery::setOption

public SearchQuery::setOption($option, $column)

Applies a search option and removes it from the search query string.

These options are in the form option:value,value2,value3.

Parameters

$option: Name of the option.

$column: Name of the database column to which the value should be applied.

Return value

TRUE if a value for that option was found, FALSE if not.

File

modules/search/search.extender.inc, line 179
Search query extender and helper functions.

Class

SearchQuery
Do a query on the full-text search index for a word or words.

Code

public function setOption($option, $column) {
  if ($values = search_expression_extract($this->searchExpression, $option)) {
    $or = db_or();
    foreach (explode(',', $values) as $value) {
      $or->condition($column, $value);
    }
    $this->condition($or);
    $this->searchExpression = search_expression_insert($this->searchExpression, $option);
    return TRUE;
  }
  return FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!search!search.extender.inc/function/SearchQuery::setOption/7.x