public class TermsQuery extends Query implements Accountable
ConstantScoreQuery over a BooleanQuery containing only
BooleanClause.Occur.SHOULD clauses.
This query creates a bit set and sets bits that matches any of the wrapped
terms. While this might help performance when there are many terms, it would
be slower than a BooleanQuery when there are few terms to match.| Constructor and Description |
|---|
TermsQuery(List<Term> terms)
Creates a new
TermsQuery from the given list. |
TermsQuery(String field,
BytesRef... terms)
Creates a new
TermsQuery from the given BytesRef array for
a single field. |
TermsQuery(String field,
List<BytesRef> terms)
Creates a new
TermsQuery from the given BytesRef list for
a single field. |
TermsQuery(Term... terms)
Creates a new
TermsQuery from the given array. |
| Modifier and Type | Method and Description |
|---|---|
Weight |
createWeight(IndexSearcher searcher,
boolean needsScores) |
boolean |
equals(Object obj) |
Collection<Accountable> |
getChildResources() |
int |
hashCode() |
long |
ramBytesUsed() |
String |
toString(String defaultField) |
public TermsQuery(List<Term> terms)
TermsQuery from the given list. The list
can contain duplicate terms and multiple fields.public TermsQuery(String field, List<BytesRef> terms)
TermsQuery from the given BytesRef list for
a single field.public TermsQuery(String field, BytesRef... terms)
TermsQuery from the given BytesRef array for
a single field.public TermsQuery(Term... terms)
TermsQuery from the given array. The array can
contain duplicate terms and multiple fields.public long ramBytesUsed()
ramBytesUsed in interface Accountablepublic Collection<Accountable> getChildResources()
getChildResources in interface Accountablepublic Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException
createWeight in class QueryIOExceptionCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.