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.

Constructors

Link copied to clipboard
constructor(fld: String, bytes: BytesRef = BytesRef())

Constructs a Term with the given field and empty text. This serves two purposes: 1) reuse of a Term with the same field. 2) pattern for a query.

constructor(fld: String, bytesBuilder: BytesRefBuilder)

Constructs a Term with the given field and the bytes from a builder.

constructor(fld: String, text: String)

Constructs a Term with the given field and text.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard

Functions

Link copied to clipboard

Returns the bytes of this term, these should not be modified.

Link copied to clipboard
open operator override fun compareTo(other: Term): Int

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.

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean
Link copied to clipboard
fun field(): String

Returns the field of this term. The field indicates the part of a document which this term came from.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
fun set(fld: String, bytes: BytesRef)

Resets the field and text of a Term.

Link copied to clipboard
fun text(): String

Returns the text of this term. In the case of words, this is simply the text of the word. In the case of dates and other types, this is an encoding of the object as a string.

Link copied to clipboard
open override fun toString(): String