Share via


LimitTokenFilter Class

public final class LimitTokenFilter
extends TokenFilter

Limits the number of tokens while indexing. This token filter is implemented using Apache Lucene.

Constructor Summary

Constructor Description
LimitTokenFilter(String name)

Creates an instance of LimitTokenFilter class.

Method Summary

Modifier and Type Method and Description
Boolean areAllTokensConsumed()

Get the allTokensConsumed property: A value indicating whether all tokens from the input must be consumed even if maxTokenCount is reached.

static LimitTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of LimitTokenFilter from the JsonReader.

Integer getMaxTokenCount()

Get the maxTokenCount property: The maximum number of tokens to produce.

String getOdataType()

Get the odataType property: A URI fragment specifying the type of token filter.

LimitTokenFilter setAllTokensConsumed(Boolean allTokensConsumed)

Set the allTokensConsumed property: A value indicating whether all tokens from the input must be consumed even if maxTokenCount is reached.

LimitTokenFilter setMaxTokenCount(Integer maxTokenCount)

Set the maxTokenCount property: The maximum number of tokens to produce.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from TokenFilter

Methods inherited from java.lang.Object

Constructor Details

LimitTokenFilter

public LimitTokenFilter(String name)

Creates an instance of LimitTokenFilter class.

Parameters:

name - the name value to set.

Method Details

areAllTokensConsumed

public Boolean areAllTokensConsumed()

Get the allTokensConsumed property: A value indicating whether all tokens from the input must be consumed even if maxTokenCount is reached. Default is false.

Returns:

the allTokensConsumed value.

fromJson

public static LimitTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of LimitTokenFilter from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of LimitTokenFilter if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getMaxTokenCount

public Integer getMaxTokenCount()

Get the maxTokenCount property: The maximum number of tokens to produce. Default is 1.

Returns:

the maxTokenCount value.

getOdataType

public String getOdataType()

Get the odataType property: A URI fragment specifying the type of token filter.

Overrides:

LimitTokenFilter.getOdataType()

Returns:

the odataType value.

setAllTokensConsumed

public LimitTokenFilter setAllTokensConsumed(Boolean allTokensConsumed)

Set the allTokensConsumed property: A value indicating whether all tokens from the input must be consumed even if maxTokenCount is reached. Default is false.

Parameters:

allTokensConsumed - the allTokensConsumed value to set.

Returns:

the LimitTokenFilter object itself.

setMaxTokenCount

public LimitTokenFilter setMaxTokenCount(Integer maxTokenCount)

Set the maxTokenCount property: The maximum number of tokens to produce. Default is 1.

Parameters:

maxTokenCount - the maxTokenCount value to set.

Returns:

the LimitTokenFilter object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

LimitTokenFilter.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to