public final class Term extends Object implements Comparable<Term>
Constructor and Description |
---|
Term(String fld)
Constructs a Term with the given field and empty text.
|
Term(String fld,
BytesRef bytes)
Constructs a Term with the given field and bytes.
|
Term(String fld,
String text)
Constructs a Term with the given field and text.
|
Modifier and Type | Method and Description |
---|---|
BytesRef |
bytes()
Returns the bytes of this term.
|
int |
compareTo(Term other)
Compares two terms, returning a negative integer if this
term belongs before the argument, zero if this term is equal to the
argument, and a positive integer if this term belongs after the argument.
|
boolean |
equals(Object obj) |
String |
field()
Returns the field of this term.
|
int |
hashCode() |
String |
text()
Returns the text of this term.
|
String |
toString() |
static String |
toString(BytesRef termText)
Returns human-readable form of the term text.
|
public Term(String fld, BytesRef bytes)
Note that a null field or null bytes value results in undefined behavior for most Lucene APIs that accept a Term parameter.
WARNING: the provided BytesRef is not copied, but used directly.
Therefore the bytes should not be modified after construction, for
example, you should clone a copy by BytesRef.deepCopyOf(org.apache.lucene.util.BytesRef)
rather than pass reused bytes from a TermsEnum.
public Term(String fld, String text)
Note that a null field or null text value results in undefined behavior for most Lucene APIs that accept a Term parameter.
public Term(String fld)
fld
- field's namepublic final String field()
public final String text()
public static final String toString(BytesRef termText)
public final BytesRef bytes()
public final int compareTo(Term other)
compareTo
in interface Comparable<Term>
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.