class SearchQuery

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

This function is normally only called by each module that supports the indexed search (and thus, implements hook_update_index()).

Results are retrieved in two logical passes. However, the two passes are joined together into a single query. And in the case of most simple queries the second pass is not even used.

The first pass selects a set of all possible matches, which has the benefit of also providing the exact result set for simple "AND" or "OR" searches.

The second portion of the query further refines this set by verifying advanced text conditions (such as negative or phrase matches).

The used query object has the tag 'search_$module' and can be further extended with hook_query_alter().

Hierarchy

Expanded class hierarchy of SearchQuery

1 file declares its use of SearchQuery

File

drupal/core/modules/search/lib/Drupal/search/SearchQuery.php, line 37
Definition of Drupal\search\SearchQuery.

Namespace

Drupal\search
View source

Members

Namesort descending Modifiers Type Description Overrides
SearchQuery::$conditions protected property Conditions that are used for exact searches.
SearchQuery::$executedFirstPass protected property Indicates whether the first pass query has been executed.
SearchQuery::$expressionsIgnored protected property Whether or not search expressions were ignored.
SearchQuery::$keys protected property Positive and negative search keys.
SearchQuery::$matches protected property Indicates how many matches for a search query are necessary.
SearchQuery::$multiply protected property Total value of all the multipliers.
SearchQuery::$normalize protected property Multiplier for the normalized search score.
SearchQuery::$scores protected property Stores score expressions.
SearchQuery::$scoresArguments protected property Stores arguments for score expressions.
SearchQuery::$searchExpression protected property The search query that is used for searching.
SearchQuery::$simple protected property Indicates whether the first pass query requires complex conditions (LIKE).
SearchQuery::$type protected property Type of search (search module).
SearchQuery::$words protected property Array of 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::executeFirstPass public function Executes the first pass query.
SearchQuery::parseSearchExpression protected function Parses the search query into SQL conditions.
SearchQuery::parseWord protected function Helper function for parseQuery().
SearchQuery::searchExpression public function Sets up the search query expression.
SearchQuery::setOption public function Applies a search option and removes it from the search query string.
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::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::conditions public function Gets a complete list of all conditions in this conditional clause. Overrides ConditionInterface::conditions 1
SelectExtender::distinct public function Sets this query to be DISTINCT. Overrides SelectInterface::distinct
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. This include queries for UNION, UNION ALL, and UNION DISTINCT. 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
SelectExtender::havingArguments public function
SelectExtender::havingCompile public function
SelectExtender::havingCondition public function Helper function to build most common HAVING conditional clauses. Overrides SelectInterface::havingCondition
SelectExtender::havingConditions public function
SelectExtender::innerJoin public function Inner Join against another table in the database. Overrides SelectInterface::innerJoin
SelectExtender::isNotNull function Sets a condition that the specified field be NOT NULL. Overrides ConditionInterface::isNotNull
SelectExtender::isNull 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 Implements Drupal\Core\Database\Query\PlaceholderInterface::nextPlaceholder(). Overrides PlaceholderInterface::nextPlaceholder
SelectExtender::notExists public function Sets a condition that the specified subquery returns no values. Overrides ConditionInterface::notExists
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::preExecute public function Generic preparation and validation for a SELECT query. Overrides SelectInterface::preExecute
SelectExtender::range public function Restricts a query to a given range in the result set. Overrides SelectInterface::range
SelectExtender::rightJoin public function Right Outer Join against another table in the database. Overrides SelectInterface::rightJoin
SelectExtender::union public function Add another Select query to UNION to this one. Overrides SelectInterface::union
SelectExtender::uniqueIdentifier public function Implements Drupal\Core\Database\Query\PlaceholderInterface::uniqueIdentifier(). 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