CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Parser\AST\Visitor\QueryFixer Class Reference

Inspect a query and determine what parts of it can be sent to a typo correction mechanism and provide a method to fix the query once the corrected substring is known. More...

+ Inheritance diagram for CirrusSearch\Parser\AST\Visitor\QueryFixer:
+ Collaboration diagram for CirrusSearch\Parser\AST\Visitor\QueryFixer:

Public Member Functions

 __construct (ParsedQuery $query)
 
 getFixablePart ()
 Get the longest phrase that is subject to typo correction.
 
 fix ( $replacement)
 Replace the fixable part of the visited query with the provided replacement.
 
 visitWordsQueryNode (WordsQueryNode $node)
 
 visitPhraseQueryNode (PhraseQueryNode $node)
 
 visitPhrasePrefixNode (PhrasePrefixNode $node)
 
 visitFuzzyNode (FuzzyNode $node)
 
 visitPrefixNode (PrefixNode $node)
 
 visitWildcardNode (WildcardNode $node)
 
 visitEmptyQueryNode (EmptyQueryNode $node)
 
 visitKeywordFeatureNode (KeywordFeatureNode $node)
 
 visitParsedBooleanNode (ParsedBooleanNode $node)
 
 visitBooleanClause (BooleanClause $clause)
 
 visitNegatedNode (NegatedNode $node)
 
 visitNamespaceHeader (NamespaceHeaderNode $node)
 

Static Public Member Functions

static build (ParsedQuery $query)
 

Detailed Description

Inspect a query and determine what parts of it can be sent to a typo correction mechanism and provide a method to fix the query once the corrected substring is known.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Parser\AST\Visitor\QueryFixer::__construct ( ParsedQuery $query)
Parameters
ParsedQuery$query

Member Function Documentation

◆ build()

static CirrusSearch\Parser\AST\Visitor\QueryFixer::build ( ParsedQuery $query)
static
Parameters
ParsedQuery$query
Returns
QueryFixer

◆ fix()

CirrusSearch\Parser\AST\Visitor\QueryFixer::fix ( $replacement)

Replace the fixable part of the visited query with the provided replacement.

Parameters
HtmlArmor | string$replacementIf HtmlArmor is provided all modifications will be html safe and HtmlArmor will be returned. If a string is provided no escaping will occur.
Returns
HtmlArmor|string|null

◆ getFixablePart()

CirrusSearch\Parser\AST\Visitor\QueryFixer::getFixablePart ( )

Get the longest phrase that is subject to typo correction.

It's generally a set of consecutive words.

Returns
string|null

@phan-suppress-next-line PhanImpossibleCondition I agree, this is impossible.

◆ visitBooleanClause()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitBooleanClause ( BooleanClause $clause)
Parameters
BooleanClause$clause

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitEmptyQueryNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitEmptyQueryNode ( EmptyQueryNode $node)
Parameters
EmptyQueryNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitFuzzyNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitFuzzyNode ( FuzzyNode $node)
Parameters
FuzzyNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitKeywordFeatureNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitKeywordFeatureNode ( KeywordFeatureNode $node)
Parameters
KeywordFeatureNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitNamespaceHeader()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitNamespaceHeader ( NamespaceHeaderNode $node)
final
Parameters
NamespaceHeaderNode$node

@phan-suppress-next-line PhanImpossibleCondition I agree, this is impossible.

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitNegatedNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitNegatedNode ( NegatedNode $node)
final
Parameters
NegatedNode$node

@phan-suppress-next-line PhanImpossibleCondition I agree, this is impossible.

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitParsedBooleanNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitParsedBooleanNode ( ParsedBooleanNode $node)
Parameters
ParsedBooleanNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitPhrasePrefixNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitPhrasePrefixNode ( PhrasePrefixNode $node)
Parameters
PhrasePrefixNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitPhraseQueryNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitPhraseQueryNode ( PhraseQueryNode $node)
Parameters
PhraseQueryNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitPrefixNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitPrefixNode ( PrefixNode $node)
Parameters
PrefixNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitWildcardNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitWildcardNode ( WildcardNode $node)
Parameters
WildcardNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.

◆ visitWordsQueryNode()

CirrusSearch\Parser\AST\Visitor\QueryFixer::visitWordsQueryNode ( WordsQueryNode $node)
Parameters
WordsQueryNode$node

Implements CirrusSearch\Parser\AST\Visitor\Visitor.


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