CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Parser\AST\ParsedQuery Class Reference

Parsed query. More...

Public Member Functions

 __construct (ParsedNode $root, $query, $rawQuery, $queryCleanups, ?NamespaceHeaderNode $namespaceHeader, $requiredNamespaces, array $parseWarnings, ParsedQueryClassifiersRepository $repository)
 
 getRoot ()
 
 getQuery ()
 The query being parsed Some cleanups may have been made to the raw query NOTE: the query may include the namespace header.
 
 getQueryWithoutNsHeader ()
 The query string without the namespace header.
 
 getRawQuery ()
 The raw query as received by the search engine.
 
 hasCleanup ( $cleanup)
 Check if the query was cleanup with this type.
 
 getParseWarnings ()
 List of warnings detected at parse time.
 
 getNamespaceHeader ()
 Get the node of the namespace header identified in the prefix of the query if specified.
 
 getRequiredNamespaces ()
 
 getActualNamespaces (?array $namespaces=null, ?array $additionalRequiredNamespaces=null)
 Determine the actual namespaces required for this query to run assuming that $namespaces is the list of namespaces initially requested usually set \SearchEngine::setNamespaces().
 
 getCrossSearchStrategy ()
 Get the cross search strategy supported by this query.
 
 isQueryOfClass ( $class)
 
 preloadQueryClasses ()
 Preload all known query classes and classify this query.
 
 getFeaturesUsed ()
 Get the list of keyword features used by this query.
 
 toArray ()
 

Public Attributes

const CLEANUP_GERSHAYIM_QUIRKS = 'gershayim_quirks'
 markup to indicate that the query was cleaned up detecting a double quote used as a gershayim see T66350
 
const CLEANUP_QMARK_STRIPPING = 'stripped_qmark'
 markup to indicate that the had some question marks stripped
 
const TILDE_HEADER = 'tilde_header'
 markup to indicate that we removed a '~' at the beginning of the query
 

Detailed Description

Parsed query.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Parser\AST\ParsedQuery::__construct ( ParsedNode $root,
$query,
$rawQuery,
$queryCleanups,
?NamespaceHeaderNode $namespaceHeader,
$requiredNamespaces,
array $parseWarnings,
ParsedQueryClassifiersRepository $repository )
Parameters
ParsedNode$root
string$querycleaned up query string
string$rawQueryoriginal query as received by the search engine
bool[]$queryCleanupsindexed by cleanup type (non-empty when $query !== $rawQuery)
?NamespaceHeaderNode$namespaceHeadernamespace found as a "header" of the query is a int when a namespace id is provided, string with 'all' or null if none specified
array | string$requiredNamespaces
ParseWarning[]$parseWarningslist of warnings detected during parsing
ParsedQueryClassifiersRepository$repository

Member Function Documentation

◆ getActualNamespaces()

CirrusSearch\Parser\AST\ParsedQuery::getActualNamespaces ( ?array $namespaces = null,
?array $additionalRequiredNamespaces = null )

Determine the actual namespaces required for this query to run assuming that $namespaces is the list of namespaces initially requested usually set \SearchEngine::setNamespaces().

Parameters
int[] | null$namespacesinitial namespaces
int[] | null$additionalRequiredNamespacesadditional namespaces required (by ContextualFilters)
Returns
int[] the list of namespaces that have to be queried, empty array means all namespaces
See also
\SearchEngine::setNamespaces()
self::getRequiredNamespaces()
self::getNamespaceHeader()
\CirrusSearch\Query\Builder\ContextualFilter::requiredNamespaces()

◆ getCrossSearchStrategy()

CirrusSearch\Parser\AST\ParsedQuery::getCrossSearchStrategy ( )

Get the cross search strategy supported by this query.

Returns
CrossSearchStrategy
Parameters
KeywordFeatureNode$node

◆ getFeaturesUsed()

CirrusSearch\Parser\AST\ParsedQuery::getFeaturesUsed ( )

Get the list of keyword features used by this query.

See also
\CirrusSearch\Query\KeywordFeature::getFeatureName()
Returns
string[]
Parameters
KeywordFeatureNode$node

◆ getNamespaceHeader()

CirrusSearch\Parser\AST\ParsedQuery::getNamespaceHeader ( )

Get the node of the namespace header identified in the prefix of the query if specified.

It can be null in all other cases

Returns
NamespaceHeaderNode|null

◆ getParseWarnings()

CirrusSearch\Parser\AST\ParsedQuery::getParseWarnings ( )

List of warnings detected at parse time.

Returns
ParseWarning[]

◆ getQuery()

CirrusSearch\Parser\AST\ParsedQuery::getQuery ( )

The query being parsed Some cleanups may have been made to the raw query NOTE: the query may include the namespace header.

Returns
string

◆ getQueryWithoutNsHeader()

CirrusSearch\Parser\AST\ParsedQuery::getQueryWithoutNsHeader ( )

The query string without the namespace header.

Returns
string

◆ getRawQuery()

CirrusSearch\Parser\AST\ParsedQuery::getRawQuery ( )

The raw query as received by the search engine.

Returns
string

◆ getRequiredNamespaces()

CirrusSearch\Parser\AST\ParsedQuery::getRequiredNamespaces ( )
Returns
array|string array of additional namespaces or 'all' if all namespaces required

◆ getRoot()

CirrusSearch\Parser\AST\ParsedQuery::getRoot ( )
Returns
ParsedNode

◆ hasCleanup()

CirrusSearch\Parser\AST\ParsedQuery::hasCleanup ( $cleanup)

Check if the query was cleanup with this type.

See also
ParsedQuery::CLEANUP_QMARK_STRIPPING
ParsedQuery::CLEANUP_GERSHAYIM_QUIRKS
Parameters
string$cleanup
Returns
bool

◆ isQueryOfClass()

CirrusSearch\Parser\AST\ParsedQuery::isQueryOfClass ( $class)
Parameters
string$class
Returns
bool
Exceptions

CirrusSearch\Parser\ParsedQueryClassifierException if the class is unknown

◆ preloadQueryClasses()

CirrusSearch\Parser\AST\ParsedQuery::preloadQueryClasses ( )

Preload all known query classes and classify this query.

Exceptions

CirrusSearch\Parser\ParsedQueryClassifierException

◆ toArray()

CirrusSearch\Parser\AST\ParsedQuery::toArray ( )
Returns
array

Member Data Documentation

◆ CLEANUP_QMARK_STRIPPING

const CirrusSearch\Parser\AST\ParsedQuery::CLEANUP_QMARK_STRIPPING = 'stripped_qmark'

markup to indicate that the had some question marks stripped

See also
\CirrusSearch\Util::stripQuestionMarks

The documentation for this class was generated from the following file: