UaxUrlEmailTokenizer.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.JsonProperty;
  6. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  7. import com.fasterxml.jackson.annotation.JsonTypeName;

  8. /**
  9.  * Tokenizes urls and emails as one token. This tokenizer is implemented using
  10.  * Apache Lucene.
  11.  */
  12. @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@odata.type")
  13. @JsonTypeName("#Microsoft.Azure.Search.UaxUrlEmailTokenizer")
  14. @Fluent
  15. public final class UaxUrlEmailTokenizer extends LexicalTokenizer {
  16.     /*
  17.      * The maximum token length. Default is 255. Tokens longer than the maximum
  18.      * length are split. The maximum token length that can be used is 300
  19.      * characters.
  20.      */
  21.     @JsonProperty(value = "maxTokenLength")
  22.     private Integer maxTokenLength;

  23.     /**
  24.      * Constructor of {@link UaxUrlEmailTokenizer}.
  25.      *
  26.      * @param name The name of the tokenizer. It must only contain letters, digits, spaces,
  27.      * dashes or underscores, can only start and end with alphanumeric
  28.      * characters, and is limited to 128 characters.
  29.      */
  30.     public UaxUrlEmailTokenizer(String name) {
  31.         super(name);
  32.     }

  33.     /**
  34.      * Get the maxTokenLength property: The maximum token length. Default is
  35.      * 255. Tokens longer than the maximum length are split. The maximum token
  36.      * length that can be used is 300 characters.
  37.      *
  38.      * @return the maxTokenLength value.
  39.      */
  40.     public Integer getMaxTokenLength() {
  41.         return this.maxTokenLength;
  42.     }

  43.     /**
  44.      * Set the maxTokenLength property: The maximum token length. Default is
  45.      * 255. Tokens longer than the maximum length are split. The maximum token
  46.      * length that can be used is 300 characters.
  47.      *
  48.      * @param maxTokenLength the maxTokenLength value to set.
  49.      * @return the UaxUrlEmailTokenizer object itself.
  50.      */
  51.     public UaxUrlEmailTokenizer setMaxTokenLength(Integer maxTokenLength) {
  52.         this.maxTokenLength = maxTokenLength;
  53.         return this;
  54.     }
  55. }