CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Query\PrefixFeature Class Reference

Handles the prefix: keyword for matching titles. More...

+ Inheritance diagram for CirrusSearch\Query\PrefixFeature:
+ Collaboration diagram for CirrusSearch\Query\PrefixFeature:

Public Member Functions

 __construct (NamespacePrefixParser $namespacePrefixParser=null)
 
 greedy ()
 
 getCrossSearchStrategy (KeywordFeatureNode $node)
 
 parseValue ( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector)
 
 getFilterQuery (KeywordFeatureNode $node, QueryBuildingContext $context)
 
- Public Member Functions inherited from CirrusSearch\Query\SimpleKeywordFeature
 getKeywordPrefixes ()
 
 allowEmptyValue ()
 Whether this keyword allows empty value.
 
 hasValue ()
 Whether this keyword can have a value.
 
 queryHeader ()
 Whether this keyword can appear only at the beginning of the query (excluding spaces)
 
 getFeatureName ( $key, $valueDelimiter)
 Determine the name of the feature being set in SearchContext::addSyntaxUsed Defaults to $key.
 
 getValueDelimiters ()
 List of value delimiters supported (must be an array of single byte char)
 
 expand (KeywordFeatureNode $node, SearchConfig $config, WarningCollector $warningCollector)
 
 doApplyExtended (SearchContext $context, $key, $value, $quotedValue, $negated, $delimiter, $suffix)
 Fully featured apply method which delegates to doApply by default.
 
 apply (SearchContext $context, $term)
 

Static Public Member Functions

static prepareSearchContext (SearchContext $context, $prefix, NamespacePrefixParser $namespacePrefixParser=null)
 Adds a prefix filter to the search context.
 

Public Attributes

const PARSED_NAMESPACES = 'parsed_namespaces'
 key value to set in the array returned by KeywordFeature::parsedValue() to instruct the parser that additional namespaces are needed for the query to function properly.
 

Protected Member Functions

 getKeywords ()
 
 doApply (SearchContext $context, $key, $value, $quotedValue, $negated)
 

Detailed Description

Handles the prefix: keyword for matching titles.

Can be used to specify a namespace, a prefix of the title, or both. Note that unlike other keyword features this greedily uses everything after the prefix: keyword, so must be used at the end of the query. Also note that this will override namespace filters previously applied to the SearchContext.

Examples: prefix:Calif prefix:Talk: prefix:Talk:Calif prefix:California Cou prefix:"California Cou"

Member Function Documentation

◆ doApply()

CirrusSearch\Query\PrefixFeature::doApply ( SearchContext $context,
$key,
$value,
$quotedValue,
$negated )
protected
Parameters
SearchContext$context
string$key
string$value
string$quotedValue
bool$negated
Returns
array

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getCrossSearchStrategy()

CirrusSearch\Query\PrefixFeature::getCrossSearchStrategy ( KeywordFeatureNode $node)
Parameters
KeywordFeatureNode$node
Returns
CrossSearchStrategy

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getFilterQuery()

CirrusSearch\Query\PrefixFeature::getFilterQuery ( KeywordFeatureNode $node,
QueryBuildingContext $context )
Parameters
KeywordFeatureNode$node
QueryBuildingContext$context
Returns
AbstractQuery|null

Implements CirrusSearch\Query\FilterQueryFeature.

◆ getKeywords()

CirrusSearch\Query\PrefixFeature::getKeywords ( )
protected
Returns
string[]

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ greedy()

CirrusSearch\Query\PrefixFeature::greedy ( )
Returns
bool

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ parseValue()

CirrusSearch\Query\PrefixFeature::parseValue ( $key,
$value,
$quotedValue,
$valueDelimiter,
$suffix,
WarningCollector $warningCollector )
Parameters
string$key
string$value
string$quotedValue
string$valueDelimiter
string$suffix
WarningCollector$warningCollector
Returns
array|false|null

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ prepareSearchContext()

static CirrusSearch\Query\PrefixFeature::prepareSearchContext ( SearchContext $context,
$prefix,
NamespacePrefixParser $namespacePrefixParser = null )
static

Adds a prefix filter to the search context.

Parameters
SearchContext$context
string$prefix
NamespacePrefixParser | null$namespacePrefixParser

Member Data Documentation

◆ PARSED_NAMESPACES

const CirrusSearch\Query\PrefixFeature::PARSED_NAMESPACES = 'parsed_namespaces'

key value to set in the array returned by KeywordFeature::parsedValue() to instruct the parser that additional namespaces are needed for the query to function properly.

NOTE: a value of 'all' means that all namespaces are required are required.

See also
KeywordFeature::parsedValue()

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