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

Builds an Elastica query backed by an elasticsearch QueryString query Has many warts and edge cases that are hardly desirable. More...

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

Public Member Functions

 __construct (SearchConfig $config, array $features, array $settings=[])
 
 build (SearchContext $searchContext, $term)
 Search articles with provided term.
 
 buildDegraded (SearchContext $searchContext)
 Attempt to build a degraded query from the query already built into $context.
 

Protected Member Functions

 buildSearchTextQuery (SearchContext $searchContext, array $fields, AbstractQuery $nearMatchQuery, $queryString)
 Build the primary query used for full text search.
 
 getMultiTermRewriteMethod ()
 the rewrite method to use for multi term queries
 
 buildHighlightQuery (SearchContext $context, array $fields, $queryText, $slop)
 Builds the highlight query.
 
 buildPhraseRescoreQuery (SearchContext $context, array $fields, $queryText, $slop)
 Builds the phrase rescore query.
 
 isPhraseRescoreNeeded (SearchContext $searchContext)
 Determines if a phrase rescore is needed.
 
 maybeWrapWithTokenCountRouter ( $queryText, \Elastica\Query\AbstractQuery $query)
 

Protected Attributes

 $config
 

Detailed Description

Builds an Elastica query backed by an elasticsearch QueryString query Has many warts and edge cases that are hardly desirable.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::__construct ( SearchConfig $config,
array $features,
array $settings = [] )
Parameters
SearchConfig$config
KeywordFeature[]$features
array[]$settingscurrently ignored

Reimplemented in CirrusSearch\Query\FullTextSimpleMatchQueryBuilder.

Member Function Documentation

◆ build()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::build ( SearchContext $searchContext,
$term )

Search articles with provided term.

Parameters
SearchContext$searchContext
string$termterm to search searches that might be better?

Implements CirrusSearch\Query\FullTextQueryBuilder.

◆ buildDegraded()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::buildDegraded ( SearchContext $searchContext)

Attempt to build a degraded query from the query already built into $context.

Must be called after self::build().

Parameters
SearchContext$searchContext
Returns
bool True if a degraded query was built

Implements CirrusSearch\Query\FullTextQueryBuilder.

◆ buildHighlightQuery()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::buildHighlightQuery ( SearchContext $context,
array $fields,
$queryText,
$slop )
protected

Builds the highlight query.

Parameters
SearchContext$context
string[]$fields
string$queryText
int$slop
Returns
\Elastica\Query\AbstractQuery

Reimplemented in CirrusSearch\Query\FullTextSimpleMatchQueryBuilder.

◆ buildPhraseRescoreQuery()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::buildPhraseRescoreQuery ( SearchContext $context,
array $fields,
$queryText,
$slop )
protected

Builds the phrase rescore query.

Parameters
SearchContext$context
string[]$fields
string$queryText
int$slop
Returns
\Elastica\Query\AbstractQuery

Reimplemented in CirrusSearch\Query\FullTextSimpleMatchQueryBuilder.

◆ buildSearchTextQuery()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::buildSearchTextQuery ( SearchContext $searchContext,
array $fields,
AbstractQuery $nearMatchQuery,
$queryString )
protected

Build the primary query used for full text search.

This will be a QueryString query, and optionally a MultiMatch if a $nearMatchQuery is provided.

Parameters
SearchContext$searchContext
string[]$fields
AbstractQuery$nearMatchQuery
string$queryString
Returns
\Elastica\Query\AbstractQuery

Reimplemented in CirrusSearch\Query\FullTextSimpleMatchQueryBuilder.

◆ getMultiTermRewriteMethod()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::getMultiTermRewriteMethod ( )
protected

the rewrite method to use for multi term queries

Returns
string

Reimplemented in CirrusSearch\Query\FullTextSimpleMatchQueryBuilder.

◆ isPhraseRescoreNeeded()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::isPhraseRescoreNeeded ( SearchContext $searchContext)
protected

Determines if a phrase rescore is needed.

Parameters
SearchContext$searchContext
Returns
bool true if we can a phrase rescore

◆ maybeWrapWithTokenCountRouter()

CirrusSearch\Query\FullTextQueryStringQueryBuilder::maybeWrapWithTokenCountRouter ( $queryText,
\Elastica\Query\AbstractQuery $query )
protected
Parameters
string$queryText
AbstractQuery$query
Returns
AbstractQuery

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