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

Matches "prefer-recent:" and then an optional floating point number <= 1 but >= 0 (decay portion) and then an optional comma followed by another floating point number >0 0 (half life). More...

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

Public Member Functions

 __construct (Config $config)
 
 allowEmptyValue ()
 
 parseValue ( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector)
 
 getCrossSearchStrategy (KeywordFeatureNode $node)
 
 getBoostFunctionBuilder (KeywordFeatureNode $node, QueryBuildingContext $context)
 
- Public Member Functions inherited from CirrusSearch\Query\SimpleKeywordFeature
 getKeywordPrefixes ()
 
 hasValue ()
 Whether this keyword can have a value.
 
 greedy ()
 Whether this keyword is greedy consuming the rest of the string.
 
 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)
 

Protected Member Functions

 getKeywords ()
 
 doApply (SearchContext $context, $key, $value, $quotedValue, $negated)
 Applies the detected keyword from the search term.
 

Detailed Description

Matches "prefer-recent:" and then an optional floating point number <= 1 but >= 0 (decay portion) and then an optional comma followed by another floating point number >0 0 (half life).

Examples: prefer-recent: prefer-recent:.6 prefer-recent:0.5,.0001

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Query\PreferRecentFeature::__construct ( Config $config)
Parameters
Config$config

Member Function Documentation

◆ allowEmptyValue()

CirrusSearch\Query\PreferRecentFeature::allowEmptyValue ( )
Returns
bool

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ doApply()

CirrusSearch\Query\PreferRecentFeature::doApply ( SearchContext $context,
$key,
$value,
$quotedValue,
$negated )
protected

Applies the detected keyword from the search term.

May apply changes either to $context directly, or return a filter to be added.

Parameters
SearchContext$context
string$keyThe keyword
string$valueThe value attached to the keyword with quotes stripped and escaped quotes un-escaped.
string$quotedValueThe original value in the search string, including quotes if used
bool$negatedIs the search negated? Not used to generate the returned AbstractQuery, that will be negated as necessary. Used for any other building/context necessary.
Returns
array Two element array, first an AbstractQuery or null to apply to the query. Second a boolean indicating if the quotedValue should be kept in the search string.

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getBoostFunctionBuilder()

CirrusSearch\Query\PreferRecentFeature::getBoostFunctionBuilder ( KeywordFeatureNode $node,
QueryBuildingContext $context )
Parameters
KeywordFeatureNode$node
QueryBuildingContext$context
Returns
BoostFunctionBuilder|null

Implements CirrusSearch\Query\BoostFunctionFeature.

◆ getCrossSearchStrategy()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getKeywords()

CirrusSearch\Query\PreferRecentFeature::getKeywords ( )
protected
Returns
string[] The list of keywords this feature is supposed to match

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ parseValue()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.


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