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

Source regex filter for trigram accelerated regex matching. More...

+ Inheritance diagram for CirrusSearch\Extra\Query\SourceRegex:
+ Collaboration diagram for CirrusSearch\Extra\Query\SourceRegex:

Public Member Functions

 __construct ( $regex=null, $field=null, $ngramField=null)
 
 setRegex ( $regex)
 
 setField ( $field)
 
 setNGramField ( $ngramField)
 
 setGramSize ( $gramSize)
 
 setMaxExpand ( $maxExpand)
 
 setMaxStatesTraced ( $maxStatesTraced)
 
 setMaxInspect ( $maxInspect)
 
 setMaxDeterminizedStates ( $maxDeterminizedStates)
 
 setCaseSensitive ( $caseSensitive)
 
 setLocale ( $locale)
 
 setMaxNgramsExtracted ( $maxNgrams)
 
 setMaxNgramClauses ( $maxNgramClauses)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Extra\Query\SourceRegex::__construct ( $regex = null,
$field = null,
$ngramField = null )
Parameters
null | string$regexoptional regex to match against field
null | string$fieldoptional field who's source to check with the regex
null | string$ngramFieldoptional field that is indexed with ngrams to accelerate regex matching

Member Function Documentation

◆ setCaseSensitive()

CirrusSearch\Extra\Query\SourceRegex::setCaseSensitive ( $caseSensitive)
Parameters
bool$caseSensitiveis the regex case insensitive? Defaults to case insensitive if not set.
Returns
self

◆ setField()

CirrusSearch\Extra\Query\SourceRegex::setField ( $field)
Parameters
string$fieldfield who's source to check with the regex
Returns
self

◆ setGramSize()

CirrusSearch\Extra\Query\SourceRegex::setGramSize ( $gramSize)
Parameters
int$gramSizesize of the ngrams extracted for accelerating the regex. Defaults to 3 if not set. That gram size must have been produced by analyzing the ngramField.
Returns
self

◆ setLocale()

CirrusSearch\Extra\Query\SourceRegex::setLocale ( $locale)
Parameters
string$localelocale used for case conversions. Its important that this matches the locale used for lowercasing in the ngram index.
Returns
self

◆ setMaxDeterminizedStates()

CirrusSearch\Extra\Query\SourceRegex::setMaxDeterminizedStates ( $maxDeterminizedStates)
Parameters
int$maxDeterminizedStatesmaximum number of automaton states that Lucene's regex compilation can expand to (even temporarily)
Returns
self

◆ setMaxExpand()

CirrusSearch\Extra\Query\SourceRegex::setMaxExpand ( $maxExpand)
Parameters
int$maxExpandmaximum range before outgoing automaton arcs are ignored. Roughly corresponds to the maximum number of characters in a character class ([abcd]) before it is treated as . for purposes of acceleration. Defaults to 4.
Returns
self

◆ setMaxInspect()

CirrusSearch\Extra\Query\SourceRegex::setMaxInspect ( $maxInspect)
Parameters
int$maxInspectmaximum number of source field to run the regex against before giving up and just declaring all remaining fields not matching by fiat. Defaults to MAX_INT. Set this to 10000 or something nice and low to prevent regular expressions that cannot be sped up from taking up too many resources.
Returns
self

◆ setMaxNgramClauses()

CirrusSearch\Extra\Query\SourceRegex::setMaxNgramClauses ( $maxNgramClauses)
Parameters
int$maxNgramClausesThe maximum number of boolean clauses generated from extracted ngrams.
Returns
self

◆ setMaxNgramsExtracted()

CirrusSearch\Extra\Query\SourceRegex::setMaxNgramsExtracted ( $maxNgrams)
Parameters
int$maxNgramsThe maximum number of ngrams to extracted from the regex. If more could be extracted from the regex tey are ignored.
Returns
self

◆ setMaxStatesTraced()

CirrusSearch\Extra\Query\SourceRegex::setMaxStatesTraced ( $maxStatesTraced)
Parameters
int$maxStatesTracedmaximum number of automaton states that can be traced before the algorithm gives up and assumes the regex is too complex and throws an error back to the user. Defaults to 10000 which handily covers all regexes I cared to test.
Returns
self

◆ setNGramField()

CirrusSearch\Extra\Query\SourceRegex::setNGramField ( $ngramField)
Parameters
string$ngramFieldfield that is indexed with ngrams to accelerate regex matching
Returns
self

◆ setRegex()

CirrusSearch\Extra\Query\SourceRegex::setRegex ( $regex)
Parameters
string$regexregex to match against field
Returns
self

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