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

Filters by category or its subcategories. More...

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

Public Member Functions

 __construct (Config $config, SparqlClient $client=null)
 
 getCrossSearchStrategy (KeywordFeatureNode $node)
 
 getFeatureName ( $key, $valueDelimiter)
 
 expand (KeywordFeatureNode $node, SearchConfig $config, 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.
 
 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)
 
 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.
 
 doApplyExtended (SearchContext $context, $key, $value, $quotedValue, $negated, $delimiter, $suffix)
 Fully featured apply method which delegates to doApply by default.
 
 apply (SearchContext $context, $term)
 

Public Attributes

const USER_AGENT = 'CirrusSearch deepcat feature'
 User agent to use for SPARQL queries.
 
const TIMEOUT = 3
 Timeout (in seconds) for SPARQL query.
 

Protected Member Functions

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

Detailed Description

Filters by category or its subcategories.

E.g. if category Vehicles includes Cars and Boats, then search for Vehicles would match pages in Vehicles, Cars and Boats.

Syntax: deepcat:Vehicles

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Query\DeepcatFeature::__construct ( Config $config,
SparqlClient $client = null )
Parameters
Config$config
SparqlClient | null$client

Member Function Documentation

◆ doApply()

CirrusSearch\Query\DeepcatFeature::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.

◆ doGetFilterQuery()

CirrusSearch\Query\DeepcatFeature::doGetFilterQuery ( array $categories)
protected
Parameters
array$categories
Returns
\Elastica\Query\BoolQuery|null

◆ expand()

CirrusSearch\Query\DeepcatFeature::expand ( KeywordFeatureNode $node,
SearchConfig $config,
WarningCollector $warningCollector )
Parameters
KeywordFeatureNode$node
SearchConfig$config
WarningCollector$warningCollector
Returns
array

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getCrossSearchStrategy()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getFeatureName()

CirrusSearch\Query\DeepcatFeature::getFeatureName ( $key,
$valueDelimiter )
Parameters
string$key
string$valueDelimiter
Returns
string

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

◆ getFilterQuery()

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

Implements CirrusSearch\Query\FilterQueryFeature.

◆ getKeywords()

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

Reimplemented from CirrusSearch\Query\SimpleKeywordFeature.

Member Data Documentation

◆ TIMEOUT

const CirrusSearch\Query\DeepcatFeature::TIMEOUT = 3

Timeout (in seconds) for SPARQL query.

TODO: make configurable?


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