class ViewsSearchQuery
Same name and namespace in other branches
- 11.x core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\ViewsSearchQuery
- 10 core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\ViewsSearchQuery
- 9 core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses\ViewsSearchQuery
Extends the core SearchQuery to be able to gets its protected values.
Hierarchy
- class \Drupal\Core\Database\Query\SelectExtender implements \Drupal\Core\Database\Query\SelectInterface
- class \Drupal\search\SearchQuery extends \Drupal\Core\Database\Query\SelectExtender
- class \Drupal\search\ViewsSearchQuery extends \Drupal\search\SearchQuery
- class \Drupal\search\SearchQuery extends \Drupal\Core\Database\Query\SelectExtender
Expanded class hierarchy of ViewsSearchQuery
2 files declare their use of ViewsSearchQuery
- Search.php in core/
modules/ search/ src/ Plugin/ views/ filter/ Search.php - Search.php in core/
modules/ search/ src/ Plugin/ views/ argument/ Search.php
File
-
core/
modules/ search/ src/ ViewsSearchQuery.php, line 10
Namespace
Drupal\searchView source
class ViewsSearchQuery extends SearchQuery {
/**
* Returns the conditions property.
*
* @return array
* The query conditions.
*/
public function &conditions() {
return $this->conditions;
}
/**
* Returns the words property.
*
* @return array
* The positive search keywords.
*/
public function words() {
return $this->words;
}
/**
* Returns the simple property.
*
* @return bool
* TRUE if it is a simple query, and FALSE if it is complicated (phrases
* or LIKE).
*/
public function simple() {
return $this->simple;
}
/**
* Returns the matches property.
*
* @return int
* The number of matches needed.
*/
public function matches() {
return $this->matches;
}
/**
* Executes and returns the protected parseSearchExpression method.
*/
public function publicParseSearchExpression() {
return $this->parseSearchExpression();
}
/**
* Replaces the original condition with a custom one from views recursively.
*
* @param string $search
* The searched value.
* @param string $replace
* The value which replaces the search value.
* @param array $condition
* The query conditions array in which the string is replaced. This is an
* item from a \Drupal\Core\Database\Query\Condition::conditions array,
* which must have a 'field' element.
*/
public function conditionReplaceString($search, $replace, &$condition) {
if ($condition['field'] instanceof Condition) {
$conditions =& $condition['field']->conditions();
foreach ($conditions as $key => &$subcondition) {
if (is_numeric($key)) {
// As conditions can be nested, the function has to be called
// recursively.
$this->conditionReplaceString($search, $replace, $subcondition);
}
}
}
else {
$condition['field'] = str_replace($search, $replace, $condition['field']);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
SearchQuery::$conditions | protected | property | Conditions that are used for exact searches. | |
SearchQuery::$executedPrepare | protected | property | Indicates whether the preparation step has been executed. | |
SearchQuery::$keys | protected | property | Parsed-out positive and negative search keys. | |
SearchQuery::$matches | protected | property | Indicates how many matches for a search query are necessary. | |
SearchQuery::$multiply | protected | property | Multipliers for score expressions. | |
SearchQuery::$normalize | protected | property | Multiplier to normalize the keyword score. | |
SearchQuery::$relevance_count | protected | property | The number of 'i.relevance' occurrences in score expressions. | |
SearchQuery::$scores | protected | property | The word score expressions. | |
SearchQuery::$scoresArguments | protected | property | Arguments for the score expressions. | |
SearchQuery::$searchExpression | protected | property | The keywords and advanced search options that are entered by the user. | |
SearchQuery::$simple | protected | property | Indicates whether the query conditions are simple or complex (LIKE). | |
SearchQuery::$status | protected | property | A bitmap of status conditions, described in getStatus(). | |
SearchQuery::$type | protected | property | The type of search (search type). | |
SearchQuery::$words | protected | property | Array of positive search words. | |
SearchQuery::addScore | public | function | Adds a custom score expression to the search query. | |
SearchQuery::countQuery | public | function | Builds the default count query for SearchQuery. | |
SearchQuery::execute | public | function | Executes the search. | |
SearchQuery::EXPRESSIONS_IGNORED | constant | Indicates that part of the search expression was ignored. | ||
SearchQuery::getStatus | public | function | Returns the query status bitmap. | |
SearchQuery::LOWER_CASE_OR | constant | Indicates that lower-case "or" was in the search expression. | ||
SearchQuery::NO_KEYWORD_MATCHES | constant | Indicates that no positive keyword matches were found. | ||
SearchQuery::NO_POSITIVE_KEYWORDS | constant | Indicates no positive keywords were in the search expression. | ||
SearchQuery::parseSearchExpression | protected | function | Parses the search query into SQL conditions. | |
SearchQuery::parseWord | protected | function | Parses a word or phrase for parseQuery(). | |
SearchQuery::preExecute | public | function | ||
SearchQuery::prepareAndNormalize | public | function | Prepares the query and calculates the normalization factor. | |
SearchQuery::searchExpression | public | function | Sets the search query expression. | |
SelectExtender::$connection | protected | property | The connection object on which to run this query. | |
SelectExtender::$placeholder | protected | property | The placeholder counter. | |
SelectExtender::$query | protected | property | The Select query object we are extending/decorating. | |
SelectExtender::$uniqueIdentifier | protected | property | A unique identifier for this query object. | |
SelectExtender::addExpression | public | function | ||
SelectExtender::addField | public | function | ||
SelectExtender::addJoin | public | function | ||
SelectExtender::addMetaData | public | function | ||
SelectExtender::addTag | public | function | ||
SelectExtender::alwaysFalse | public | function | ||
SelectExtender::andConditionGroup | public | function | ||
SelectExtender::arguments | public | function | ||
SelectExtender::compile | public | function | ||
SelectExtender::compiled | public | function | ||
SelectExtender::condition | public | function | ||
SelectExtender::conditionGroupFactory | public | function | ||
SelectExtender::distinct | public | function | ||
SelectExtender::escapeField | public | function | ||
SelectExtender::escapeLike | public | function | ||
SelectExtender::exists | public | function | ||
SelectExtender::extend | public | function | ||
SelectExtender::fields | public | function | ||
SelectExtender::forUpdate | public | function | ||
SelectExtender::getArguments | public | function | ||
SelectExtender::getExpressions | public | function | ||
SelectExtender::getFields | public | function | ||
SelectExtender::getGroupBy | public | function | ||
SelectExtender::getMetaData | public | function | ||
SelectExtender::getOrderBy | public | function | ||
SelectExtender::getTables | public | function | ||
SelectExtender::getUnion | public | function | ||
SelectExtender::groupBy | public | function | ||
SelectExtender::hasAllTags | public | function | ||
SelectExtender::hasAnyTag | public | function | ||
SelectExtender::hasTag | public | function | ||
SelectExtender::having | public | function | ||
SelectExtender::havingArguments | public | function | ||
SelectExtender::havingCompile | public | function | ||
SelectExtender::havingCondition | public | function | ||
SelectExtender::havingConditions | public | function | ||
SelectExtender::havingExists | public | function | ||
SelectExtender::havingIsNotNull | public | function | ||
SelectExtender::havingIsNull | public | function | ||
SelectExtender::havingNotExists | public | function | ||
SelectExtender::innerJoin | public | function | ||
SelectExtender::isNotNull | public | function | ||
SelectExtender::isNull | public | function | ||
SelectExtender::isPrepared | public | function | ||
SelectExtender::join | public | function | ||
SelectExtender::leftJoin | public | function | ||
SelectExtender::nextPlaceholder | public | function | ||
SelectExtender::notExists | public | function | ||
SelectExtender::orConditionGroup | public | function | ||
SelectExtender::orderBy | public | function | ||
SelectExtender::orderRandom | public | function | ||
SelectExtender::range | public | function | ||
SelectExtender::rightJoin | public | function | ||
SelectExtender::union | public | function | ||
SelectExtender::uniqueIdentifier | public | function | ||
SelectExtender::where | public | function | ||
SelectExtender::__call | public | function | Magic override for undefined methods. | |
SelectExtender::__clone | public | function | ||
SelectExtender::__construct | public | function | ||
SelectExtender::__toString | public | function | ||
ViewsSearchQuery::conditionReplaceString | public | function | Replaces the original condition with a custom one from views recursively. | |
ViewsSearchQuery::conditions | public | function | Returns the conditions property. | Overrides SelectExtender::conditions |
ViewsSearchQuery::matches | public | function | Returns the matches property. | |
ViewsSearchQuery::publicParseSearchExpression | public | function | Executes and returns the protected parseSearchExpression method. | |
ViewsSearchQuery::simple | public | function | Returns the simple property. | |
ViewsSearchQuery::words | public | function | Returns the words property. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.