LexicalTokenizer.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.

  3. package com.azure.search.documents.indexes.models;

  4. import com.azure.core.annotation.Fluent;
  5. import com.fasterxml.jackson.annotation.JsonCreator;
  6. import com.fasterxml.jackson.annotation.JsonProperty;
  7. import com.fasterxml.jackson.annotation.JsonSubTypes;
  8. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  9. import com.fasterxml.jackson.annotation.JsonTypeName;

  10. /**
  11.  * Base type for tokenizers.
  12.  */
  13. @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@odata.type",
  14.     defaultImpl = LexicalTokenizer.class)
  15. @JsonTypeName("LexicalTokenizer")
  16. @JsonSubTypes({
  17.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.ClassicTokenizer", value = ClassicTokenizer.class),
  18.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.EdgeNGramTokenizer", value = EdgeNGramTokenizer.class),
  19.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.KeywordTokenizer", value = KeywordTokenizer.class),
  20.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.KeywordTokenizerV2", value = KeywordTokenizer.class),
  21.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.MicrosoftLanguageTokenizer",
  22.         value = MicrosoftLanguageTokenizer.class),
  23.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer",
  24.         value = MicrosoftLanguageStemmingTokenizer.class),
  25.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.NGramTokenizer", value = NGramTokenizer.class),
  26.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.PathHierarchyTokenizerV2",
  27.         value = PathHierarchyTokenizer.class),
  28.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.PatternTokenizer", value = PatternTokenizer.class),
  29.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.StandardTokenizer", value = LuceneStandardTokenizer.class),
  30.     @JsonSubTypes.Type(name = "#Microsoft.Azure.Search.UaxUrlEmailTokenizer", value = UaxUrlEmailTokenizer.class)
  31. })
  32. @Fluent
  33. public abstract class LexicalTokenizer {
  34.     /*
  35.      * The name of the tokenizer. It must only contain letters, digits, spaces,
  36.      * dashes or underscores, can only start and end with alphanumeric
  37.      * characters, and is limited to 128 characters.
  38.      */
  39.     @JsonProperty(value = "name", required = true)
  40.     private String name;

  41.     /**
  42.      * Constructor of {@link LexicalTokenizer}.
  43.      *
  44.      * @param name The name of the token filter. It must only contain letters, digits,
  45.      * spaces, dashes or underscores, can only start and end with alphanumeric
  46.      * characters, and is limited to 128 characters.
  47.      */
  48.     @JsonCreator
  49.     public LexicalTokenizer(@JsonProperty(value = "name") String name) {
  50.         this.name = name;
  51.     }

  52.     /**
  53.      * Get the name property: The name of the tokenizer. It must only contain
  54.      * letters, digits, spaces, dashes or underscores, can only start and end
  55.      * with alphanumeric characters, and is limited to 128 characters.
  56.      *
  57.      * @return the name value.
  58.      */
  59.     public String getName() {
  60.         return this.name;
  61.     }

  62. }