class ViewsSearchQuery
Same name in this branch
- 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses\ViewsSearchQuery
Same name in other branches
- 8.9.x core/modules/search/src/ViewsSearchQuery.php \Drupal\search\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
- 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
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
3 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 - ViewsSearchQuery.php in core/
tests/ fixtures/ database_drivers/ module/ corefake/ src/ Driver/ Database/ corefakeWithAllCustomClasses/ ViewsSearchQuery.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 ConditionInterface) {
$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 | Overrides |
---|---|---|---|---|---|
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. | Overrides SelectExtender::countQuery | |
SearchQuery::execute | public | function | Executes the search. | Overrides SelectExtender::execute | |
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 | Generic preparation and validation for a SELECT query. | Overrides SelectExtender::preExecute | |
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 | Adds an expression to the list of "fields" to be SELECTed. | Overrides SelectInterface::addExpression | |
SelectExtender::addField | public | function | Adds a field to the list to be SELECTed. | Overrides SelectInterface::addField | |
SelectExtender::addJoin | public | function | Join against another table in the database. | Overrides SelectInterface::addJoin | |
SelectExtender::addMetaData | public | function | Adds additional metadata to the query. | Overrides AlterableInterface::addMetaData | |
SelectExtender::addTag | public | function | Adds a tag to a query. | Overrides AlterableInterface::addTag | |
SelectExtender::alwaysFalse | public | function | Sets a condition that is always false. | Overrides ConditionInterface::alwaysFalse | |
SelectExtender::andConditionGroup | public | function | Creates a new group of conditions ANDed together. | Overrides ConditionInterface::andConditionGroup | |
SelectExtender::arguments | public | function | Gets a complete list of all values to insert into the prepared statement. | Overrides ConditionInterface::arguments | |
SelectExtender::compile | public | function | Compiles the saved conditions for later retrieval. | Overrides ConditionInterface::compile | |
SelectExtender::compiled | public | function | Check whether a condition has been previously compiled. | Overrides ConditionInterface::compiled | |
SelectExtender::condition | public | function | Helper function: builds the most common conditional clauses. | Overrides ConditionInterface::condition | |
SelectExtender::conditionGroupFactory | public | function | Creates an object holding a group of conditions. | Overrides ConditionInterface::conditionGroupFactory | |
SelectExtender::distinct | public | function | Sets this query to be DISTINCT. | Overrides SelectInterface::distinct | |
SelectExtender::escapeField | public | function | Escapes a field name string. | Overrides SelectInterface::escapeField | |
SelectExtender::escapeLike | public | function | Escapes characters that work as wildcard characters in a LIKE pattern. | Overrides SelectInterface::escapeLike | |
SelectExtender::exists | public | function | Sets a condition that the specified subquery returns values. | Overrides ConditionInterface::exists | |
SelectExtender::extend | public | function | Enhance this object by wrapping it in an extender object. | Overrides ExtendableInterface::extend | |
SelectExtender::fields | public | function | Add multiple fields from the same table to be SELECTed. | Overrides SelectInterface::fields | |
SelectExtender::forUpdate | public | function | Add FOR UPDATE to the query. | Overrides SelectInterface::forUpdate | |
SelectExtender::getArguments | public | function | Compiles and returns an associative array of the arguments for this prepared statement. | Overrides SelectInterface::getArguments | |
SelectExtender::getExpressions | public | function | Returns a reference to the expressions array for this query. | Overrides SelectInterface::getExpressions | |
SelectExtender::getFields | public | function | Returns a reference to the fields array for this query. | Overrides SelectInterface::getFields | |
SelectExtender::getGroupBy | public | function | Returns a reference to the group-by array for this query. | Overrides SelectInterface::getGroupBy | |
SelectExtender::getMetaData | public | function | Retrieves a given piece of metadata. | Overrides AlterableInterface::getMetaData | |
SelectExtender::getOrderBy | public | function | Returns a reference to the order by array for this query. | Overrides SelectInterface::getOrderBy | |
SelectExtender::getTables | public | function | Returns a reference to the tables array for this query. | Overrides SelectInterface::getTables | |
SelectExtender::getUnion | public | function | Returns a reference to the union queries for this query. | Overrides SelectInterface::getUnion | |
SelectExtender::groupBy | public | function | Groups the result set by the specified field. | Overrides SelectInterface::groupBy | |
SelectExtender::hasAllTags | public | function | Determines if a given query has all specified tags. | Overrides AlterableInterface::hasAllTags | |
SelectExtender::hasAnyTag | public | function | Determines if a given query has any specified tag. | Overrides AlterableInterface::hasAnyTag | |
SelectExtender::hasTag | public | function | Determines if a given query has a given tag. | Overrides AlterableInterface::hasTag | |
SelectExtender::having | public | function | Adds an arbitrary HAVING clause to the query. | Overrides SelectInterface::having | |
SelectExtender::havingArguments | public | function | Gets a list of all values to insert into the HAVING clause. | Overrides SelectInterface::havingArguments | |
SelectExtender::havingCompile | public | function | Compiles the HAVING clause for later retrieval. | Overrides SelectInterface::havingCompile | |
SelectExtender::havingCondition | public | function | Helper function to build most common HAVING conditional clauses. | Overrides SelectInterface::havingCondition | |
SelectExtender::havingConditions | public | function | Gets a list of all conditions in the HAVING clause. | Overrides SelectInterface::havingConditions | |
SelectExtender::havingExists | public | function | Sets a HAVING condition that the specified subquery returns values. | Overrides SelectInterface::havingExists | |
SelectExtender::havingIsNotNull | public | function | Sets a condition in the HAVING clause that the specified field be NOT NULL. | Overrides SelectInterface::havingIsNotNull | |
SelectExtender::havingIsNull | public | function | Sets a condition in the HAVING clause that the specified field be NULL. | Overrides SelectInterface::havingIsNull | |
SelectExtender::havingNotExists | public | function | Sets a HAVING condition that the specified subquery returns no values. | Overrides SelectInterface::havingNotExists | |
SelectExtender::innerJoin | public | function | Inner Join against another table in the database. | Overrides SelectInterface::innerJoin | |
SelectExtender::isNotNull | public | function | Sets a condition that the specified field be NOT NULL. | Overrides ConditionInterface::isNotNull | |
SelectExtender::isNull | public | function | Sets a condition that the specified field be NULL. | Overrides ConditionInterface::isNull | |
SelectExtender::isPrepared | public | function | Indicates if preExecute() has already been called on that object. | Overrides SelectInterface::isPrepared | |
SelectExtender::join | public | function | Default Join against another table in the database. | Overrides SelectInterface::join | |
SelectExtender::leftJoin | public | function | Left Outer Join against another table in the database. | Overrides SelectInterface::leftJoin | |
SelectExtender::nextPlaceholder | public | function | Returns the next placeholder ID for the query. | Overrides PlaceholderInterface::nextPlaceholder | |
SelectExtender::notExists | public | function | Sets a condition that the specified subquery returns no values. | Overrides ConditionInterface::notExists | |
SelectExtender::orConditionGroup | public | function | Creates a new group of conditions ORed together. | Overrides ConditionInterface::orConditionGroup | |
SelectExtender::orderBy | public | function | Orders the result set by a given field. | Overrides SelectInterface::orderBy | |
SelectExtender::orderRandom | public | function | Orders the result set by a random value. | Overrides SelectInterface::orderRandom | |
SelectExtender::range | public | function | Restricts a query to a given range in the result set. | Overrides SelectInterface::range | |
SelectExtender::union | public | function | Add another Select query to UNION to this one. | Overrides SelectInterface::union | |
SelectExtender::uniqueIdentifier | public | function | Returns a unique identifier for this object. | Overrides PlaceholderInterface::uniqueIdentifier | |
SelectExtender::where | public | function | Adds an arbitrary WHERE clause to the query. | Overrides ConditionInterface::where | |
SelectExtender::__call | public | function | Magic override for undefined methods. | ||
SelectExtender::__clone | public | function | Clone magic method. | Overrides SelectInterface::__clone | |
SelectExtender::__construct | public | function | 2 | ||
SelectExtender::__toString | public | function | Returns a string representation of how the query will be executed in SQL. | Overrides SelectInterface::__toString | |
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.