public class NodeAutomatonQuery extends MultiNodeTermQuery
MultiNodeTermQuery
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
org.apache.lucene.util.automaton
API. Alternatively, it can be
created from a regular expression with RegexpQuery
or from
the standard Lucene wildcard syntax with NodeWildcardQuery
.
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.
MultiNodeTermQuery.RewriteMethod
Modifier and Type | Field and Description |
---|---|
protected org.apache.lucene.util.automaton.Automaton |
automaton
the automaton to match index terms against
|
protected org.apache.lucene.util.automaton.CompiledAutomaton |
compiled |
protected org.apache.lucene.index.Term |
term
term containing the field, and possibly some pattern structure
|
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE
datatype
ancestor, levelConstraint, lowerBound, upperBound
Constructor and Description |
---|
NodeAutomatonQuery(org.apache.lucene.index.Term term,
org.apache.lucene.util.automaton.Automaton automaton)
Create a new AutomatonQuery from an
Automaton . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
protected org.apache.lucene.index.TermsEnum |
getTermsEnum(org.apache.lucene.index.Terms terms,
org.apache.lucene.util.AttributeSource atts)
Construct the enumeration to be used, expanding the
pattern term.
|
int |
hashCode() |
String |
toString(String field) |
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod
setDatatype, wrapToStringWithDatatype
getDocsNodesAndPositionsEnum, getLevelConstraint, getNodeConstraint, setAncestorPointer, setLevelConstraint, setNodeConstraint, setNodeConstraint
protected final org.apache.lucene.util.automaton.Automaton automaton
protected final org.apache.lucene.util.automaton.CompiledAutomaton compiled
protected final org.apache.lucene.index.Term term
public NodeAutomatonQuery(org.apache.lucene.index.Term term, org.apache.lucene.util.automaton.Automaton automaton)
Automaton
.term
- Term containing field and possibly some pattern structure. The
term text is ignored.automaton
- Automaton to run, terms that are accepted are considered a
match.protected org.apache.lucene.index.TermsEnum getTermsEnum(org.apache.lucene.index.Terms terms, org.apache.lucene.util.AttributeSource atts) throws IOException
MultiNodeTermQuery
TermsEnum.EMPTY
if no
terms match). The TermsEnum must already be
positioned to the first matching term.
The given AttributeSource
is passed by the MultiNodeTermQuery.RewriteMethod
to
provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts.
This is currently only used by TopNodeTermsRewrite
getTermsEnum
in class MultiNodeTermQuery
IOException
public int hashCode()
hashCode
in class MultiNodeTermQuery
public boolean equals(Object obj)
equals
in class MultiNodeTermQuery
Copyright © 2014. All rights reserved.