Share via


KeepTokenFilter Class

public final class KeepTokenFilter
extends TokenFilter

A token filter that only keeps tokens with text contained in a specified list of words. This token filter is implemented using Apache Lucene.

Constructor Summary

Constructor Description
KeepTokenFilter(String name, List<String> keepWords)

Creates an instance of KeepTokenFilter class.

Method Summary

Modifier and Type Method and Description
Boolean areLowerCaseKeepWords()

Get the lowerCaseKeepWords property: A value indicating whether to lower case all words first.

static KeepTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of KeepTokenFilter from the JsonReader.

List<String> getKeepWords()

Get the keepWords property: The list of words to keep.

String getOdataType()

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

KeepTokenFilter setLowerCaseKeepWords(Boolean lowerCaseKeepWords)

Set the lowerCaseKeepWords property: A value indicating whether to lower case all words first.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from TokenFilter

Methods inherited from java.lang.Object

Constructor Details

KeepTokenFilter

public KeepTokenFilter(String name, List<String> keepWords)

Creates an instance of KeepTokenFilter class.

Parameters:

name - the name value to set.
keepWords - the keepWords value to set.

Method Details

areLowerCaseKeepWords

public Boolean areLowerCaseKeepWords()

Get the lowerCaseKeepWords property: A value indicating whether to lower case all words first. Default is false.

Returns:

the lowerCaseKeepWords value.

fromJson

public static KeepTokenFilter fromJson(JsonReader jsonReader)

Reads an instance of KeepTokenFilter from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of KeepTokenFilter 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.

getKeepWords

public List<String> getKeepWords()

Get the keepWords property: The list of words to keep.

Returns:

the keepWords value.

getOdataType

public String getOdataType()

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

Overrides:

KeepTokenFilter.getOdataType()

Returns:

the odataType value.

setLowerCaseKeepWords

public KeepTokenFilter setLowerCaseKeepWords(Boolean lowerCaseKeepWords)

Set the lowerCaseKeepWords property: A value indicating whether to lower case all words first. Default is false.

Parameters:

lowerCaseKeepWords - the lowerCaseKeepWords value to set.

Returns:

the KeepTokenFilter object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

KeepTokenFilter.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to