CustomAnalyzer.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.
  7. package com.azure.search.documents.indexes.models;

  8. import com.azure.core.annotation.Fluent;
  9. import com.fasterxml.jackson.annotation.JsonCreator;
  10. import com.fasterxml.jackson.annotation.JsonProperty;
  11. import com.fasterxml.jackson.annotation.JsonSetter;
  12. import com.fasterxml.jackson.annotation.JsonTypeId;
  13. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  14. import com.fasterxml.jackson.annotation.JsonTypeName;
  15. import java.util.List;

  16. /**
  17.  * Allows you to take control over the process of converting text into indexable/searchable tokens. It's a user-defined
  18.  * configuration consisting of a single predefined tokenizer and one or more filters. The tokenizer is responsible for
  19.  * breaking text into tokens, and the filters for modifying tokens emitted by the tokenizer.
  20.  */
  21. @JsonTypeInfo(
  22.         use = JsonTypeInfo.Id.NAME,
  23.         include = JsonTypeInfo.As.EXISTING_PROPERTY,
  24.         property = "@odata.type",
  25.         visible = true)
  26. @JsonTypeName("#Microsoft.Azure.Search.CustomAnalyzer")
  27. @Fluent
  28. public final class CustomAnalyzer extends LexicalAnalyzer {

  29.     /*
  30.      * Identifies the concrete type of the analyzer.
  31.      */
  32.     @JsonTypeId
  33.     @JsonProperty(value = "@odata.type", required = true)
  34.     private String odataType = "#Microsoft.Azure.Search.CustomAnalyzer";

  35.     /*
  36.      * The name of the tokenizer to use to divide continuous text into a
  37.      * sequence of tokens, such as breaking a sentence into words.
  38.      */
  39.     @JsonProperty(value = "tokenizer", required = true)
  40.     private LexicalTokenizerName tokenizer;

  41.     /*
  42.      * A list of token filters used to filter out or modify the tokens
  43.      * generated by a tokenizer. For example, you can specify a lowercase
  44.      * filter that converts all characters to lowercase. The filters are run in
  45.      * the order in which they are listed.
  46.      */
  47.     @JsonProperty(value = "tokenFilters")
  48.     private List<TokenFilterName> tokenFilters;

  49.     /*
  50.      * A list of character filters used to prepare input text before it is
  51.      * processed by the tokenizer. For instance, they can replace certain
  52.      * characters or symbols. The filters are run in the order in which they
  53.      * are listed.
  54.      */
  55.     @JsonProperty(value = "charFilters")
  56.     private List<CharFilterName> charFilters;

  57.     /**
  58.      * Creates an instance of CustomAnalyzer class.
  59.      *
  60.      * @param name the name value to set.
  61.      * @param tokenizer the tokenizer value to set.
  62.      */
  63.     @JsonCreator
  64.     public CustomAnalyzer(
  65.             @JsonProperty(value = "name", required = true) String name,
  66.             @JsonProperty(value = "tokenizer", required = true) LexicalTokenizerName tokenizer) {
  67.         super(name);
  68.         this.tokenizer = tokenizer;
  69.     }

  70.     /**
  71.      * Get the tokenizer property: The name of the tokenizer to use to divide continuous text into a sequence of tokens,
  72.      * such as breaking a sentence into words.
  73.      *
  74.      * @return the tokenizer value.
  75.      */
  76.     public LexicalTokenizerName getTokenizer() {
  77.         return this.tokenizer;
  78.     }

  79.     /**
  80.      * Get the tokenFilters property: A list of token filters used to filter out or modify the tokens generated by a
  81.      * tokenizer. For example, you can specify a lowercase filter that converts all characters to lowercase. The filters
  82.      * are run in the order in which they are listed.
  83.      *
  84.      * @return the tokenFilters value.
  85.      */
  86.     public List<TokenFilterName> getTokenFilters() {
  87.         return this.tokenFilters;
  88.     }

  89.     /**
  90.      * Set the tokenFilters property: A list of token filters used to filter out or modify the tokens generated by a
  91.      * tokenizer. For example, you can specify a lowercase filter that converts all characters to lowercase. The filters
  92.      * are run in the order in which they are listed.
  93.      *
  94.      * @param tokenFilters the tokenFilters value to set.
  95.      * @return the CustomAnalyzer object itself.
  96.      */
  97.     @JsonSetter
  98.     public CustomAnalyzer setTokenFilters(List<TokenFilterName> tokenFilters) {
  99.         this.tokenFilters = tokenFilters;
  100.         return this;
  101.     }

  102.     /**
  103.      * Get the charFilters property: A list of character filters used to prepare input text before it is processed by
  104.      * the tokenizer. For instance, they can replace certain characters or symbols. The filters are run in the order in
  105.      * which they are listed.
  106.      *
  107.      * @return the charFilters value.
  108.      */
  109.     public List<CharFilterName> getCharFilters() {
  110.         return this.charFilters;
  111.     }

  112.     /**
  113.      * Set the charFilters property: A list of character filters used to prepare input text before it is processed by
  114.      * the tokenizer. For instance, they can replace certain characters or symbols. The filters are run in the order in
  115.      * which they are listed.
  116.      *
  117.      * @param charFilters the charFilters value to set.
  118.      * @return the CustomAnalyzer object itself.
  119.      */
  120.     @JsonSetter
  121.     public CustomAnalyzer setCharFilters(List<CharFilterName> charFilters) {
  122.         this.charFilters = charFilters;
  123.         return this;
  124.     }

  125.     /**
  126.      * Set the tokenFilters property: A list of token filters used to filter out or modify the tokens generated by a
  127.      * tokenizer. For example, you can specify a lowercase filter that converts all characters to lowercase. The filters
  128.      * are run in the order in which they are listed.
  129.      *
  130.      * @param tokenFilters the tokenFilters value to set.
  131.      * @return the CustomAnalyzer object itself.
  132.      */
  133.     public CustomAnalyzer setTokenFilters(TokenFilterName... tokenFilters) {
  134.         this.tokenFilters = (tokenFilters == null) ? null : java.util.Arrays.asList(tokenFilters);
  135.         return this;
  136.     }

  137.     /**
  138.      * Set the charFilters property: A list of character filters used to prepare input text before it is processed by
  139.      * the tokenizer. For instance, they can replace certain characters or symbols. The filters are run in the order in
  140.      * which they are listed.
  141.      *
  142.      * @param charFilters the charFilters value to set.
  143.      * @return the CustomAnalyzer object itself.
  144.      */
  145.     public CustomAnalyzer setCharFilters(CharFilterName... charFilters) {
  146.         this.charFilters = (charFilters == null) ? null : java.util.Arrays.asList(charFilters);
  147.         return this;
  148.     }
  149. }