Field

constructor(name: String, reader: Reader, type: IndexableFieldType)

Create field with Reader value.

Parameters

name

field name

reader

reader value

type

field type

Throws

if either the name or type is null, or if the field's type is stored(), or if tokenized() is false.


constructor(name: String, tokenStream: TokenStream, type: IndexableFieldType)

Create field with TokenStream value.

Parameters

name

field name

tokenStream

TokenStream value

type

field type

Throws

if either the name or type is null, or if the field's type is stored(), or if tokenized() is false, or if indexed() is false.


constructor(name: String, value: ByteArray, type: IndexableFieldType)

Create field with binary value.

NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field.

Parameters

name

field name

value

byte array pointing to binary content (not copied)

type

field type

Throws

if the field name, value or type is null, or the field's type is indexed().


constructor(name: String, value: ByteArray, offset: Int, length: Int, type: IndexableFieldType)

Create field with binary value.

NOTE: the provided byte[] is not copied so be sure not to change it until you're done with this field.

Parameters

name

field name

value

byte array pointing to binary content (not copied)

offset

starting position of the byte array

length

valid length of the byte array

type

field type

Throws

if the field name, value or type is null, or the field's type is indexed().


constructor(name: String, bytes: BytesRef, type: IndexableFieldType)

Create field with binary value.

NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.

Parameters

name

field name

bytes

BytesRef pointing to binary content (not copied)

type

field type

Throws

if the field name, bytes or type is null, or the field's type is indexed().


constructor(name: String, value: CharSequence, type: IndexableFieldType)

Create field with String value.

Parameters

name

field name

value

string value

type

field type

Throws

if either the name, value or type is null, or if the field's type is neither indexed() nor stored(), or if indexed() is false but storeTermVectors() is true.