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

Handles the boost-templates keyword in full text search. More...

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

Public Member Functions

 getCrossSearchStrategy (KeywordFeatureNode $node)
 
 parseValue ( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector)
 
 getBoostFunctionBuilder (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.
 
 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)
 

Static Public Member Functions

static parseBoostTemplates ( $text)
 Parse boosted templates.
 

Protected Member Functions

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

Detailed Description

Handles the boost-templates keyword in full text search.

Allows user to specify a percentage to increase or decrease a search result by based on the templates included in the page. Templates can be specified with spaces or underscores. Multiple templates can be specified. Any value including a space must be quoted.

Examples: boost-templates:Main_article|250% boost-templates:"Featured sound|150%" boost-templates:"Main_article|250% List_of_lists|10%"

Member Function Documentation

◆ doApply()

CirrusSearch\Query\BoostTemplatesFeature::doApply ( SearchContext $context,
$key,
$value,
$quotedValue,
$negated )
protected
Parameters
SearchContext$context
string$keyThe keyword
string$valueThe value attached to the keyword with quotes stripped
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\BoostTemplatesFeature::getBoostFunctionBuilder ( KeywordFeatureNode $node,
QueryBuildingContext $context )
Parameters
KeywordFeatureNode$node
QueryBuildingContext$context
Returns
\CirrusSearch\Search\Rescore\BoostFunctionBuilder|null

Implements CirrusSearch\Query\BoostFunctionFeature.

◆ getCrossSearchStrategy()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getKeywords()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ parseBoostTemplates()

static CirrusSearch\Query\BoostTemplatesFeature::parseBoostTemplates ( $text)
static

Parse boosted templates.

Parse failures silently return no boosted templates. Matches a template name followed by a | then a positive integer followed by a %. Multiple templates can be specified separated by a space.

Examples: Featured_article|150% List of lists|10% Featured_sound|200%

Parameters
string$texttext representation of boosted templates
Returns
float[] map of boosted templates (key is the template, value is a float).

◆ parseValue()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.


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