Share via


PatternAnalyzer Class

public final class PatternAnalyzer
extends LexicalAnalyzer

Flexibly separates text into terms via a regular expression pattern. This analyzer is implemented using Apache Lucene.

Constructor Summary

Constructor Description
PatternAnalyzer(String name)

Creates an instance of PatternAnalyzer class.

Method Summary

Modifier and Type Method and Description
Boolean areLowerCaseTerms()

Get the lowerCaseTerms property: A value indicating whether terms should be lower-cased.

static PatternAnalyzer fromJson(JsonReader jsonReader)

Reads an instance of PatternAnalyzer from the JsonReader.

List<RegexFlags> getFlags()

Get the flags property: Regular expression flags.

String getOdataType()

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

String getPattern()

Get the pattern property: A regular expression pattern to match token separators.

List<String> getStopwords()

Get the stopwords property: A list of stopwords.

PatternAnalyzer setFlags(List<RegexFlags> flags)

Set the flags property: Regular expression flags.

PatternAnalyzer setFlags(RegexFlags[] flags)

Set the flags property: Regular expression flags.

PatternAnalyzer setLowerCaseTerms(Boolean lowerCaseTerms)

Set the lowerCaseTerms property: A value indicating whether terms should be lower-cased.

PatternAnalyzer setPattern(String pattern)

Set the pattern property: A regular expression pattern to match token separators.

PatternAnalyzer setStopwords(List<String> stopwords)

Set the stopwords property: A list of stopwords.

PatternAnalyzer setStopwords(String[] stopwords)

Set the stopwords property: A list of stopwords.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from LexicalAnalyzer

Methods inherited from java.lang.Object

Constructor Details

PatternAnalyzer

public PatternAnalyzer(String name)

Creates an instance of PatternAnalyzer class.

Parameters:

name - the name value to set.

Method Details

areLowerCaseTerms

public Boolean areLowerCaseTerms()

Get the lowerCaseTerms property: A value indicating whether terms should be lower-cased. Default is true.

Returns:

the lowerCaseTerms value.

fromJson

public static PatternAnalyzer fromJson(JsonReader jsonReader)

Reads an instance of PatternAnalyzer from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

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

getFlags

public List<RegexFlags> getFlags()

Get the flags property: Regular expression flags.

Returns:

the flags value.

getOdataType

public String getOdataType()

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

Overrides:

PatternAnalyzer.getOdataType()

Returns:

the odataType value.

getPattern

public String getPattern()

Get the pattern property: A regular expression pattern to match token separators. Default is an expression that matches one or more non-word characters.

Returns:

the pattern value.

getStopwords

public List<String> getStopwords()

Get the stopwords property: A list of stopwords.

Returns:

the stopwords value.

setFlags

public PatternAnalyzer setFlags(List<RegexFlags> flags)

Set the flags property: Regular expression flags.

Parameters:

flags - the flags value to set.

Returns:

the PatternAnalyzer object itself.

setFlags

public PatternAnalyzer setFlags(RegexFlags[] flags)

Set the flags property: Regular expression flags.

Parameters:

flags - the flags value to set.

Returns:

the PatternAnalyzer object itself.

setLowerCaseTerms

public PatternAnalyzer setLowerCaseTerms(Boolean lowerCaseTerms)

Set the lowerCaseTerms property: A value indicating whether terms should be lower-cased. Default is true.

Parameters:

lowerCaseTerms - the lowerCaseTerms value to set.

Returns:

the PatternAnalyzer object itself.

setPattern

public PatternAnalyzer setPattern(String pattern)

Set the pattern property: A regular expression pattern to match token separators. Default is an expression that matches one or more non-word characters.

Parameters:

pattern - the pattern value to set.

Returns:

the PatternAnalyzer object itself.

setStopwords

public PatternAnalyzer setStopwords(List<String> stopwords)

Set the stopwords property: A list of stopwords.

Parameters:

stopwords - the stopwords value to set.

Returns:

the PatternAnalyzer object itself.

setStopwords

public PatternAnalyzer setStopwords(String[] stopwords)

Set the stopwords property: A list of stopwords.

Parameters:

stopwords - the stopwords value to set.

Returns:

the PatternAnalyzer object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

PatternAnalyzer.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to