|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.index.Term
public final class Term
A Term represents a word from text. This is the unit of search. It is composed of two elements, the text of the word, as a string, and the name of the field that the text occurred in. Note that terms may represent more than words from text fields, but also things like dates, email addresses, urls, etc.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 nameMethod Detail |
---|
public final String field()
public final String text()
public static final String toString(BytesRef termText)
public final BytesRef bytes()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public final int compareTo(Term other)
compareTo
in interface Comparable<Term>
public final String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |