CirrusSearch
Elasticsearch-powered search for MediaWiki
|
Implements abstract handling of keyword features that are composed of a keyword followed by a colon then an optionally quoted value. More...
Public Member Functions | |
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) | |
parseValue ( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector) | |
Parse the value of the keyword. | |
getCrossSearchStrategy (KeywordFeatureNode $node) | |
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 () | |
NOTE: will be removed once all implementations implement getKeywordStrings (transitional state to change the visibility of getKeywords()) | |
doApply (SearchContext $context, $key, $value, $quotedValue, $negated) | |
Applies the detected keyword from the search term. | |
Implements abstract handling of keyword features that are composed of a keyword followed by a colon then an optionally quoted value.
For consistency most query features should be implemented this way using the default getValueRegex() where possible.
CirrusSearch\Query\SimpleKeywordFeature::allowEmptyValue | ( | ) |
Whether this keyword allows empty value.
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\PreferRecentFeature.
CirrusSearch\Query\SimpleKeywordFeature::apply | ( | SearchContext | $context, |
$term ) |
SearchContext | $context | |
string | $term | Search query |
Implements CirrusSearch\Query\KeywordFeature.
|
abstractprotected |
Applies the detected keyword from the search term.
May apply changes either to $context directly, or return a filter to be added.
SearchContext | $context | |
string | $key | The keyword |
string | $value | The value attached to the keyword with quotes stripped and escaped quotes un-escaped. |
string | $quotedValue | The original value in the search string, including quotes if used |
bool | $negated | Is the search negated? Not used to generate the returned AbstractQuery, that will be negated as necessary. Used for any other building/context necessary. |
Reimplemented in CirrusSearch\Query\ArticleTopicFeature, CirrusSearch\Query\BoostTemplatesFeature, CirrusSearch\Query\ContentModelFeature, CirrusSearch\Query\DeepcatFeature, CirrusSearch\Query\FileNumericFeature, CirrusSearch\Query\FileTypeFeature, CirrusSearch\Query\HasRecommendationFeature, CirrusSearch\Query\HasTemplateFeature, CirrusSearch\Query\InCategoryFeature, CirrusSearch\Query\InSourceFeature, CirrusSearch\Query\InTitleFeature, CirrusSearch\Query\LanguageFeature, CirrusSearch\Query\LinksToFeature, CirrusSearch\Query\LocalFeature, CirrusSearch\Query\MoreLikeFeature, CirrusSearch\Query\MoreLikeThisFeature, CirrusSearch\Query\PageIdFeature, CirrusSearch\Query\PreferRecentFeature, CirrusSearch\Query\PrefixFeature, CirrusSearch\Query\SubPageOfFeature, and CirrusSearch\Query\TextFieldFilterFeature.
CirrusSearch\Query\SimpleKeywordFeature::doApplyExtended | ( | SearchContext | $context, |
$key, | |||
$value, | |||
$quotedValue, | |||
$negated, | |||
$delimiter, | |||
$suffix ) |
Fully featured apply method which delegates to doApply by default.
SearchContext | $context | |
string | $key | The keyword |
string | $value | The value attached to the keyword with quotes stripped and escaped quotes un-escaped. |
string | $quotedValue | The original value in the search string, including quotes if used |
bool | $negated | Is the search negated? Not used to generate the returned AbstractQuery, that will be negated as necessary. Used for any other building/context necessary. |
string | $delimiter | the delimiter char used to wrap the keyword value ('"' in intitle:"test") |
string | $suffix | the optional suffix used after the value ('i' in insource:/regex/i) |
Reimplemented in CirrusSearch\Query\BaseRegexFeature, and CirrusSearch\Query\HasTemplateFeature.
CirrusSearch\Query\SimpleKeywordFeature::expand | ( | KeywordFeatureNode | $node, |
SearchConfig | $config, | ||
WarningCollector | $warningCollector ) |
KeywordFeatureNode | $node | |
SearchConfig | $config | |
WarningCollector | $warningCollector |
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\DeepcatFeature, CirrusSearch\Query\InCategoryFeature, and CirrusSearch\Query\MoreLikeFeature.
CirrusSearch\Query\SimpleKeywordFeature::getCrossSearchStrategy | ( | KeywordFeatureNode | $node | ) |
KeywordFeatureNode | $node |
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\BaseRegexFeature, CirrusSearch\Query\BoostTemplatesFeature, CirrusSearch\Query\ContentModelFeature, CirrusSearch\Query\DeepcatFeature, CirrusSearch\Query\FileNumericFeature, CirrusSearch\Query\FileTypeFeature, CirrusSearch\Query\HasTemplateFeature, CirrusSearch\Query\InCategoryFeature, CirrusSearch\Query\LanguageFeature, CirrusSearch\Query\LinksToFeature, CirrusSearch\Query\LocalFeature, CirrusSearch\Query\MoreLikeFeature, CirrusSearch\Query\PreferRecentFeature, CirrusSearch\Query\PrefixFeature, CirrusSearch\Query\SubPageOfFeature, and CirrusSearch\Query\TextFieldFilterFeature.
CirrusSearch\Query\SimpleKeywordFeature::getFeatureName | ( | $key, | |
$valueDelimiter ) |
Determine the name of the feature being set in SearchContext::addSyntaxUsed Defaults to $key.
string | $key | |
string | $valueDelimiter | the delimiter used to wrap the value |
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\BaseRegexFeature, CirrusSearch\Query\DeepcatFeature, CirrusSearch\Query\MoreLikeFeature, and CirrusSearch\Query\MoreLikeThisFeature.
CirrusSearch\Query\SimpleKeywordFeature::getKeywordPrefixes | ( | ) |
Implements CirrusSearch\Query\KeywordFeature.
|
abstractprotected |
NOTE: will be removed once all implementations implement getKeywordStrings (transitional state to change the visibility of getKeywords())
Reimplemented in CirrusSearch\Query\ArticleTopicFeature, CirrusSearch\Query\BoostTemplatesFeature, CirrusSearch\Query\ContentModelFeature, CirrusSearch\Query\DeepcatFeature, CirrusSearch\Query\FileNumericFeature, CirrusSearch\Query\FileTypeFeature, CirrusSearch\Query\HasRecommendationFeature, CirrusSearch\Query\HasTemplateFeature, CirrusSearch\Query\InCategoryFeature, CirrusSearch\Query\InSourceFeature, CirrusSearch\Query\InTitleFeature, CirrusSearch\Query\LanguageFeature, CirrusSearch\Query\LinksToFeature, CirrusSearch\Query\LocalFeature, CirrusSearch\Query\MoreLikeFeature, CirrusSearch\Query\MoreLikeThisFeature, CirrusSearch\Query\PageIdFeature, CirrusSearch\Query\PreferRecentFeature, CirrusSearch\Query\PrefixFeature, CirrusSearch\Query\SubPageOfFeature, and CirrusSearch\Query\TextFieldFilterFeature.
CirrusSearch\Query\SimpleKeywordFeature::getValueDelimiters | ( | ) |
List of value delimiters supported (must be an array of single byte char)
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\BaseRegexFeature.
CirrusSearch\Query\SimpleKeywordFeature::greedy | ( | ) |
Whether this keyword is greedy consuming the rest of the string.
NOTE: do not override, greedy keywords will eventually be removed in the future
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\MoreLikeFeature, and CirrusSearch\Query\PrefixFeature.
CirrusSearch\Query\SimpleKeywordFeature::hasValue | ( | ) |
Whether this keyword can have a value.
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\LocalFeature.
CirrusSearch\Query\SimpleKeywordFeature::parseValue | ( | $key, | |
$value, | |||
$quotedValue, | |||
$valueDelimiter, | |||
$suffix, | |||
WarningCollector | $warningCollector ) |
Parse the value of the keyword.
string | $key | |
string | $value | |
string | $quotedValue | |
string | $valueDelimiter | |
string | $suffix | |
WarningCollector | $warningCollector |
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\ArticleTopicFeature, CirrusSearch\Query\BaseRegexFeature, CirrusSearch\Query\BoostTemplatesFeature, CirrusSearch\Query\FileNumericFeature, CirrusSearch\Query\FileTypeFeature, CirrusSearch\Query\HasRecommendationFeature, CirrusSearch\Query\HasTemplateFeature, CirrusSearch\Query\InCategoryFeature, CirrusSearch\Query\LanguageFeature, CirrusSearch\Query\PageIdFeature, CirrusSearch\Query\PreferRecentFeature, CirrusSearch\Query\PrefixFeature, and CirrusSearch\Query\SubPageOfFeature.
CirrusSearch\Query\SimpleKeywordFeature::queryHeader | ( | ) |
Whether this keyword can appear only at the beginning of the query (excluding spaces)
Implements CirrusSearch\Query\KeywordFeature.
Reimplemented in CirrusSearch\Query\LocalFeature, and CirrusSearch\Query\MoreLikeFeature.