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

File

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

Members

Contains filters are case sensitive
Name Modifiers Type Descriptionsort descending
SelectQueryExtender::__construct public function
SelectQueryExtender::havingConditions public function
SelectQueryExtender::havingArguments public function
SelectQueryExtender::having public function
SelectQueryExtender::havingCompile public function
SelectQueryExtender::__toString public function
SelectQueryExtender::$uniqueIdentifier protected property A unique identifier for this query object.
SelectQueryExtender::union public function Add another Select query to UNION to this one. Overrides SelectQueryInterface::union
SelectQueryExtender::forUpdate public function Add FOR UPDATE to the query. Overrides SelectQueryInterface::forUpdate
SelectQueryExtender::fields public function Add multiple fields from the same table to be selected. Overrides SelectQueryInterface::fields
SearchQuery::addScore public function Adds a custom score expression to the search query.
SelectQueryExtender::addField public function Adds a field to the list to be SELECTed. Overrides SelectQueryInterface::addField
SelectQueryExtender::addTag public function Adds a tag to a query. Overrides QueryAlterableInterface::addTag
SelectQueryExtender::addMetaData public function Adds additional metadata to the query. Overrides QueryAlterableInterface::addMetaData
SelectQueryExtender::where public function Adds an arbitrary WHERE clause to the query. Overrides QueryConditionInterface::where
SelectQueryExtender::addExpression public function Adds an expression to the list of "fields" to be selected. Overrides SelectQueryInterface::addExpression
SearchQuery::setOption public function Applies a search option and removes it from the search query string.
SearchQuery::$words protected property Array of search words.
SearchQuery::countQuery public function Builds the default count query for SearchQuery. Overrides SelectQueryExtender::countQuery
SelectQueryExtender::compiled public function Check whether a condition has been previously compiled. Overrides QueryConditionInterface::compiled
SelectQueryExtender::__clone public function Clone magic method. Overrides SelectQueryInterface::__clone
SelectQueryExtender::getArguments public function Compiles and returns an associative array of the arguments for this prepared statement. Overrides SelectQueryInterface::getArguments
SelectQueryExtender::compile public function Compiles the saved conditions for later retrieval. Overrides QueryConditionInterface::compile
SearchQuery::$conditions protected property Conditions that are used for exact searches.
SelectQueryExtender::join public function Default Join against another table in the database. Overrides SelectQueryInterface::join
SelectQueryExtender::hasTag public function Determines if a given query has a given tag. Overrides QueryAlterableInterface::hasTag
SelectQueryExtender::hasAllTags public function Determines if a given query has all specified tags. Overrides QueryAlterableInterface::hasAllTags
SelectQueryExtender::hasAnyTag public function Determines if a given query has any specified tag. Overrides QueryAlterableInterface::hasAnyTag
SelectQueryExtender::extend public function Enhance this object by wrapping it in an extender object. Overrides QueryExtendableInterface::extend
SearchQuery::executeFirstPass public function Executes the first pass query.
SearchQuery::execute public function Executes the search. Overrides SelectQueryExtender::execute
SelectQueryExtender::preExecute public function Generic preparation and validation for a SELECT query. Overrides SelectQueryInterface::preExecute
SelectQueryExtender::conditions public function Gets a complete list of all conditions in this conditional clause. Overrides QueryConditionInterface::conditions
SelectQueryExtender::arguments public function Gets a complete list of all values to insert into the prepared statement. Overrides QueryConditionInterface::arguments
SelectQueryExtender::groupBy public function Groups the result set by the specified field. Overrides SelectQueryInterface::groupBy
SearchQuery::parseWord protected function Helper function for parseQuery().
SelectQueryExtender::havingCondition public function Helper function to build most common HAVING conditional clauses. Overrides SelectQueryInterface::havingCondition
SelectQueryExtender::condition public function Helper function: builds the most common conditional clauses. Overrides QueryConditionInterface::condition
SelectQueryExtender::nextPlaceholder public function Implements QueryPlaceholderInterface::nextPlaceholder(). Overrides QueryPlaceholderInterface::nextPlaceholder
SelectQueryExtender::uniqueIdentifier public function Implements QueryPlaceholderInterface::uniqueIdentifier(). Overrides QueryPlaceholderInterface::uniqueIdentifier
SearchQuery::$matches protected property Indicates how many matches for a search query are necessary.
SelectQueryExtender::isPrepared public function Indicates if preExecute() has already been called on that object. Overrides SelectQueryInterface::isPrepared
SearchQuery::$executedFirstPass protected property Indicates whether the first pass query has been executed.
SearchQuery::$simple protected property Indicates whether the first pass query requires complex conditions (LIKE).
SelectQueryExtender::innerJoin public function Inner Join against another table in the database. Overrides SelectQueryInterface::innerJoin
SelectQueryExtender::addJoin public function Join against another table in the database. Overrides SelectQueryInterface::addJoin
SelectQueryExtender::leftJoin public function Left Outer Join against another table in the database. Overrides SelectQueryInterface::leftJoin
SelectQueryExtender::__call public function Magic override for undefined methods.
SearchQuery::$normalize protected property Multiplier for the normalized search score.
SelectQueryExtender::orderBy public function Orders the result set by a given field. Overrides SelectQueryInterface::orderBy
SelectQueryExtender::orderRandom public function Orders the result set by a random value. Overrides SelectQueryInterface::orderRandom
SearchQuery::parseSearchExpression protected function Parses the search query into SQL conditions.
SearchQuery::$keys protected property Positive and negative search keys.
SelectQueryExtender::range public function Restricts a query to a given range in the result set. Overrides SelectQueryInterface::range
SelectQueryExtender::getMetaData public function Retrieves a given piece of metadata. Overrides QueryAlterableInterface::getMetaData
SelectQueryExtender::getExpressions public function Returns a reference to the expressions array for this query. Overrides SelectQueryInterface::getExpressions
SelectQueryExtender::getFields public function Returns a reference to the fields array for this query. Overrides SelectQueryInterface::getFields
SelectQueryExtender::getGroupBy public function Returns a reference to the group-by array for this query. Overrides SelectQueryInterface::getGroupBy
SelectQueryExtender::getOrderBy public function Returns a reference to the order by array for this query. Overrides SelectQueryInterface::getOrderBy
SelectQueryExtender::getTables public function Returns a reference to the tables array for this query. Overrides SelectQueryInterface::getTables
SelectQueryExtender::getUnion public function Returns a reference to the union queries for this query. This include queries for UNION, UNION ALL, and UNION DISTINCT. Overrides SelectQueryInterface::getUnion
SelectQueryExtender::rightJoin public function Right Outer Join against another table in the database. Overrides SelectQueryInterface::rightJoin
SelectQueryExtender::isNotNull function Sets a condition that the specified field be NOT NULL. Overrides QueryConditionInterface::isNotNull
SelectQueryExtender::isNull function Sets a condition that the specified field be NULL. Overrides QueryConditionInterface::isNull
SelectQueryExtender::notExists public function Sets a condition that the specified subquery returns no values. Overrides QueryConditionInterface::notExists
SelectQueryExtender::exists public function Sets a condition that the specified subquery returns values. Overrides QueryConditionInterface::exists
SelectQueryExtender::distinct public function Sets this query to be DISTINCT. Overrides SelectQueryInterface::distinct
SearchQuery::searchExpression public function Sets up the search query expression.
SearchQuery::$scoresArguments protected property Stores arguments for score expressions.
SearchQuery::$multiply protected property Stores multipliers for score expressions.
SearchQuery::$scores protected property Stores score expressions.
SelectQueryExtender::$connection protected property The connection object on which to run this query.
SelectQueryExtender::$placeholder protected property The placeholder counter.
SearchQuery::$searchExpression protected property The search query that is used for searching.
SelectQueryExtender::$query protected property The SelectQuery object we are extending/decorating.
SearchQuery::$type protected property Type of search (search module).
SearchQuery::$expressionsIgnored protected property Whether or not search expressions were ignored.