Class AutomatonQuery
A Query that will match terms against a finite-state machine.
This query will match documents that contain terms accepted by a given finite-state machine. The automaton can be constructed with the Lucene.Net.Util.Automaton API. Alternatively, it can be created from a regular expression with RegexpQuery or from the standard Lucene wildcard syntax with WildcardQuery.
When the query is executed, it will create an equivalent DFA of the
finite-state machine, and will enumerate the term dictionary in an
intelligent way to reduce the number of comparisons. For example: the regular
expression of [dl]og?
will make approximately four comparisons:
do, dog, lo, and log.
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class AutomatonQuery : MultiTermQuery
Constructors
AutomatonQuery(Term, Automaton)
Create a new AutomatonQuery from an Automaton.
Declaration
public AutomatonQuery(Term term, Automaton automaton)
Parameters
Type | Name | Description |
---|---|---|
Term | term | Term containing field and possibly some pattern structure. The term text is ignored. |
Automaton | automaton | Automaton to run, terms that are accepted are considered a match. |
Fields
m_automaton
The automaton to match index terms against
Declaration
protected readonly Automaton m_automaton
Field Value
Type | Description |
---|---|
Automaton |
m_compiled
A Query that will match terms against a finite-state machine.
This query will match documents that contain terms accepted by a given finite-state machine. The automaton can be constructed with the Lucene.Net.Util.Automaton API. Alternatively, it can be created from a regular expression with RegexpQuery or from the standard Lucene wildcard syntax with WildcardQuery.
When the query is executed, it will create an equivalent DFA of the
finite-state machine, and will enumerate the term dictionary in an
intelligent way to reduce the number of comparisons. For example: the regular
expression of [dl]og?
will make approximately four comparisons:
do, dog, lo, and log.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
protected readonly CompiledAutomaton m_compiled
Field Value
Type | Description |
---|---|
CompiledAutomaton |
m_term
Term containing the field, and possibly some pattern structure
Declaration
protected readonly Term m_term
Field Value
Type | Description |
---|---|
Term |
Properties
Automaton
Returns the automaton used to create this query
Declaration
public virtual Automaton Automaton { get; }
Property Value
Type | Description |
---|---|
Automaton |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetTermsEnum(Terms, AttributeSource)
Construct the enumeration to be used, expanding the pattern term. this method should only be called if the field exists (ie, implementations can assume the field does exist). this method should not return null (should instead return EMPTY if no terms match). The TermsEnum must already be positioned to the first matching term. The given AttributeSource is passed by the MultiTermQuery.RewriteMethod to provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts. this is currently only used by TopTermsRewrite<Q>.
Declaration
protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
Type | Name | Description |
---|---|---|
Terms | terms | |
AttributeSource | atts |
Returns
Type | Description |
---|---|
TermsEnum |
Overrides
ToString(string)
Prints a query to a string, with field
assumed to be the
default field and omitted.
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
string | field |
Returns
Type | Description |
---|---|
string |