Class SynonymTokenFilter

java.lang.Object
com.azure.search.documents.indexes.models.TokenFilter
com.azure.search.documents.indexes.models.SynonymTokenFilter
All Implemented Interfaces:
com.azure.json.JsonSerializable<TokenFilter>

public final class SynonymTokenFilter extends TokenFilter
Matches single or multi-word synonyms in a token stream. This token filter is implemented using Apache Lucene.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of SynonymTokenFilter class.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of SynonymTokenFilter from the JsonReader.
    Get the expand property: A value indicating whether all words in the list of synonyms (if => notation is not used) will map to one another.
    Get the odataType property: A URI fragment specifying the type of token filter.
    Get the synonyms property: A list of synonyms in following one of two formats: 1. incredible, unbelievable, fabulous => amazing - all terms on the left side of => symbol will be replaced with all terms on its right side; 2. incredible, unbelievable, fabulous, amazing - comma separated list of equivalent words.
    Get the caseIgnored property: A value indicating whether to case-fold input for matching.
    setCaseIgnored(Boolean caseIgnored)
    Set the caseIgnored property: A value indicating whether to case-fold input for matching.
    Set the expand property: A value indicating whether all words in the list of synonyms (if => notation is not used) will map to one another.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class TokenFilter

    getName

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • SynonymTokenFilter

      public SynonymTokenFilter(String name, List<String> synonyms)
      Creates an instance of SynonymTokenFilter class.
      Parameters:
      name - the name value to set.
      synonyms - the synonyms value to set.
  • Method Details

    • getOdataType

      public String getOdataType()
      Get the odataType property: A URI fragment specifying the type of token filter.
      Overrides:
      getOdataType in class TokenFilter
      Returns:
      the odataType value.
    • getSynonyms

      public List<String> getSynonyms()
      Get the synonyms property: A list of synonyms in following one of two formats: 1. incredible, unbelievable, fabulous => amazing - all terms on the left side of => symbol will be replaced with all terms on its right side; 2. incredible, unbelievable, fabulous, amazing - comma separated list of equivalent words. Set the expand option to change how this list is interpreted.
      Returns:
      the synonyms value.
    • isCaseIgnored

      public Boolean isCaseIgnored()
      Get the caseIgnored property: A value indicating whether to case-fold input for matching. Default is false.
      Returns:
      the caseIgnored value.
    • setCaseIgnored

      public SynonymTokenFilter setCaseIgnored(Boolean caseIgnored)
      Set the caseIgnored property: A value indicating whether to case-fold input for matching. Default is false.
      Parameters:
      caseIgnored - the caseIgnored value to set.
      Returns:
      the SynonymTokenFilter object itself.
    • getExpand

      public Boolean getExpand()
      Get the expand property: A value indicating whether all words in the list of synonyms (if => notation is not used) will map to one another. If true, all words in the list of synonyms (if => notation is not used) will map to one another. The following list: incredible, unbelievable, fabulous, amazing is equivalent to: incredible, unbelievable, fabulous, amazing => incredible, unbelievable, fabulous, amazing. If false, the following list: incredible, unbelievable, fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing => incredible. Default is true.
      Returns:
      the expand value.
    • setExpand

      public SynonymTokenFilter setExpand(Boolean expand)
      Set the expand property: A value indicating whether all words in the list of synonyms (if => notation is not used) will map to one another. If true, all words in the list of synonyms (if => notation is not used) will map to one another. The following list: incredible, unbelievable, fabulous, amazing is equivalent to: incredible, unbelievable, fabulous, amazing => incredible, unbelievable, fabulous, amazing. If false, the following list: incredible, unbelievable, fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing => incredible. Default is true.
      Parameters:
      expand - the expand value to set.
      Returns:
      the SynonymTokenFilter object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<TokenFilter>
      Overrides:
      toJson in class TokenFilter
      Throws:
      IOException
    • fromJson

      public static SynonymTokenFilter fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of SynonymTokenFilter from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of SynonymTokenFilter if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the SynonymTokenFilter.