Lucene - Term


Advertisements


Introduction

This class is the lowest unit of searching. It is similar to Field in indexing process.

Class declaration

Following is the declaration for org.apache.lucene.index.Term class:

public final class Term
   extends Object
      implements Comparable, Serializable

Class constructors

S.N.Constructor & Description
1

Term(String fld)

Constructs a Term with the given field and empty text.

2

Term(String fld, String txt)

Constructs a Term with the given field and text.

Class methods

S.N.Method & Description
1

void addDocument(Document doc)

Adds a document to this index.

2

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.

3

Term createTerm(String text)

Optimized construction of new Terms by reusing same field as this Term - avoids field.intern() overhead.

4

boolean equals(Object obj)

5

String field()

Returns the field of this term, an interned string.

6

int hashCode()

7

String text()

Returns the text of this term.

8

String toString()

Methods inherited

This class inherits methods from the following classes:

  • java.lang.Object


lucene_searching_classes.htm

Advertisements