Class SearchFuzzyValueBuilder

java.lang.Object
com.commercetools.api.models.search.SearchFuzzyValueBuilder
All Implemented Interfaces:
Builder<SearchFuzzyValue>

public class SearchFuzzyValueBuilder extends Object implements Builder<SearchFuzzyValue>
SearchFuzzyValueBuilder
Example to create an instance using the builder pattern

     SearchFuzzyValue searchFuzzyValue = SearchFuzzyValue.builder()
             .field("{field}")
             .level(0.3)
             .build()
 
  • Constructor Details

    • SearchFuzzyValueBuilder

      public SearchFuzzyValueBuilder()
  • Method Details

    • field

      public SearchFuzzyValueBuilder field(String field)
      set the value to the field
      Parameters:
      field - value to be set
      Returns:
      Builder
    • boost

      public SearchFuzzyValueBuilder boost(@Nullable Double boost)
      set the value to the boost
      Parameters:
      boost - value to be set
      Returns:
      Builder
    • fieldType

      public SearchFuzzyValueBuilder fieldType(@Nullable SearchFieldType fieldType)

      Possible values for the fieldType property on simple expressions indicating the data type of the field.

      Parameters:
      fieldType - value to be set
      Returns:
      Builder
    • value

      public SearchFuzzyValueBuilder value(Object value)

      The search term to find fuzzy matches for. If multiple terms are provided (separated by whitespace), the fuzziness level is applied to each term individually.

      Parameters:
      value - value to be set
      Returns:
      Builder
    • level

      public SearchFuzzyValueBuilder level(Integer level)

      The maximum fuzziness level desired for the search term. Allowed values are 0, 1, and 2. The API automatically adjusts the effective fuzziness level based on the length of the search term if it exceeds the maximum allowed for the given string length according to the following rules:

      • Terms with 1-2 characters: 0 (exact match)
      • Terms with 3-5 characters: 1 (up to one difference is allowed)
      • Terms with more than 5 characters: 2 (up to two differences are allowed)
      Parameters:
      level - value to be set
      Returns:
      Builder
    • language

      public SearchFuzzyValueBuilder language(@Nullable String language)

      Language of the localized value. Must be provided when the field is of type localizedTextField. The provided Locale must be one of the Project's languages.

      Parameters:
      language - value to be set
      Returns:
      Builder
    • mustMatch

      public SearchFuzzyValueBuilder mustMatch(@Nullable SearchMatchType mustMatch)

      Controls whether all of the provided terms must match (all, default) or any of those (any).

      Parameters:
      mustMatch - value to be set
      Returns:
      Builder
    • getField

      public String getField()
      value of field}
      Returns:
      field
    • getBoost

      @Nullable public Double getBoost()
      value of boost}
      Returns:
      boost
    • getFieldType

      @Nullable public SearchFieldType getFieldType()

      Possible values for the fieldType property on simple expressions indicating the data type of the field.

      Returns:
      fieldType
    • getValue

      public Object getValue()

      The search term to find fuzzy matches for. If multiple terms are provided (separated by whitespace), the fuzziness level is applied to each term individually.

      Returns:
      value
    • getLevel

      public Integer getLevel()

      The maximum fuzziness level desired for the search term. Allowed values are 0, 1, and 2. The API automatically adjusts the effective fuzziness level based on the length of the search term if it exceeds the maximum allowed for the given string length according to the following rules:

      • Terms with 1-2 characters: 0 (exact match)
      • Terms with 3-5 characters: 1 (up to one difference is allowed)
      • Terms with more than 5 characters: 2 (up to two differences are allowed)
      Returns:
      level
    • getLanguage

      @Nullable public String getLanguage()

      Language of the localized value. Must be provided when the field is of type localizedTextField. The provided Locale must be one of the Project's languages.

      Returns:
      language
    • getMustMatch

      @Nullable public SearchMatchType getMustMatch()

      Controls whether all of the provided terms must match (all, default) or any of those (any).

      Returns:
      mustMatch
    • build

      public SearchFuzzyValue build()
      builds SearchFuzzyValue with checking for non-null required values
      Specified by:
      build in interface Builder<SearchFuzzyValue>
      Returns:
      SearchFuzzyValue
    • buildUnchecked

      public SearchFuzzyValue buildUnchecked()
      builds SearchFuzzyValue without checking for non-null required values
      Returns:
      SearchFuzzyValue
    • of

      public static SearchFuzzyValueBuilder of()
      factory method for an instance of SearchFuzzyValueBuilder
      Returns:
      builder
    • of

      public static SearchFuzzyValueBuilder of(SearchFuzzyValue template)
      create builder for SearchFuzzyValue instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder