Class SearchSortingBuilder

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

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

     SearchSorting searchSorting = SearchSorting.builder()
             .field("{field}")
             .order(SearchSortOrder.ASC)
             .build()
 
  • Constructor Details

    • SearchSortingBuilder

      public SearchSortingBuilder()
  • Method Details

    • field

      public SearchSortingBuilder field(String field)

      Use any searchable field of the resource as sort criterion, or "score" to sort by relevance score calculated by the API.

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

      public SearchSortingBuilder language(@Nullable String language)

      String value specifying linguistic and regional preferences using the IETF language tag format, as described in BCP 47. The format combines language, script, and region using hyphen-separated subtags. For example: en, en-US, zh-Hans-SG.

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

      public SearchSortingBuilder order(SearchSortOrder order)

      Specify the order in which the search results should be sorted. Can be asc for ascending, or desc for descending order.

      Parameters:
      order - value to be set
      Returns:
      Builder
    • mode

      Specify the sort mode to be applied for a set-type field.

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

      public SearchSortingBuilder fieldType(@Nullable SearchFieldType fieldType)

      Provide the data type of the given field.

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

      Allows you to apply a sort filter.

      Parameters:
      builder - function to build the filter value
      Returns:
      Builder
    • withFilter

      Allows you to apply a sort filter.

      Parameters:
      builder - function to build the filter value
      Returns:
      Builder
    • filter

      Allows you to apply a sort filter.

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

      public String getField()

      Use any searchable field of the resource as sort criterion, or "score" to sort by relevance score calculated by the API.

      Returns:
      field
    • getLanguage

      @Nullable public String getLanguage()

      String value specifying linguistic and regional preferences using the IETF language tag format, as described in BCP 47. The format combines language, script, and region using hyphen-separated subtags. For example: en, en-US, zh-Hans-SG.

      Returns:
      language
    • getOrder

      public SearchSortOrder getOrder()

      Specify the order in which the search results should be sorted. Can be asc for ascending, or desc for descending order.

      Returns:
      order
    • getMode

      @Nullable public SearchSortMode getMode()

      Specify the sort mode to be applied for a set-type field.

      Returns:
      mode
    • getFieldType

      @Nullable public SearchFieldType getFieldType()

      Provide the data type of the given field.

      Returns:
      fieldType
    • getFilter

      @Nullable public SearchQueryExpression getFilter()

      Allows you to apply a sort filter.

      Returns:
      filter
    • build

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

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

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

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