This class is the lowest unit of searching. It is similar to Field in indexing process.
Following is the declaration for org.apache.lucene.index.Term class −
public final class Term extends Object implements Comparable<Term>, Serializable
The following table shows a list of class constructors −
|S.No.||Constructor & Description|
Constructs a Term with the given field and empty text.
Term(String fld, String txt)
Constructs a Term with the given field and text.
The following table shows the different class methods −
|S.No.||Method & Description|
void addDocument(Document doc)
Adds a document to this index.
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.
Term createTerm(String text)
Optimized construction of new Terms by reusing same field as this Term - avoids field.intern() overhead.
boolean equals(Object obj)
Returns the field of this term, an interned string.
Returns the text of this term.
This class inherits methods from the following classes −