Class FieldDefinition.FieldDefinitionBuilder

java.lang.Object
com.broadleafcommerce.search.api.domain.FieldDefinition.FieldDefinitionBuilder
Enclosing class:
FieldDefinition

public static class FieldDefinition.FieldDefinitionBuilder extends Object
  • Method Details

    • id

      The context ID of the field.
      Parameters:
      id - the context ID of the field
      Returns:
      this.
    • label

      The label of the field, suitable for display.
      Parameters:
      label - label for the field, suitable for display
      Returns:
      this.
    • indexableType

      public FieldDefinition.FieldDefinitionBuilder indexableType(String indexableType)
      The type to which this field belongs. Populated by IndexableType type.
      Parameters:
      indexableType - type to which this field belongs
      Returns:
      this.
    • multiValued

      public FieldDefinition.FieldDefinitionBuilder multiValued(boolean multiValued)
      Whether or not this field should contain a list of values.
      Parameters:
      multiValued - whether this field should contain a list of values
      Returns:
      this.
    • propertyPath

      public FieldDefinition.FieldDefinitionBuilder propertyPath(String propertyPath)
      The JSON path of this field excluding the root prefix, "$.". This is the path to the actual value that will be stored in the index, e.g. 'price', 'description', 'customer.name', etc.

      For more advanced mapping options, see the JSONPath documentation

      Parameters:
      propertyPath - path to find field's value on indexable object
      Returns:
      this.
    • combined

      public FieldDefinition.FieldDefinitionBuilder combined(boolean combined)
      Whether or not this field should be a combination of multiple path values. If true, then instead of propertyPath, the multi-valued propertyPaths will be used and joined with the delimiter.
      Parameters:
      combined - whether this field should be a combination of multiple path values
      Returns:
      this.
    • multiValuedCombinedPropertyRootPath

      public FieldDefinition.FieldDefinitionBuilder multiValuedCombinedPropertyRootPath(String multiValuedCombinedPropertyRootPath)
      For fields which are both multiValued AND combined, this will be path to the list containing the objects representing each value. For example, to combine property paths for each category in a list of all categories in the object being indexed, this would be categories[*].
      Parameters:
      propertyPath - path to find multi-valued combined field's property path root list
      Returns:
      this.
    • propertyPaths

      public FieldDefinition.FieldDefinitionBuilder propertyPaths(List<String> propertyPaths)
      If this is a combined field, these are the JSON paths to the fields to be combined into the final value, excluding the root prefix, "$.".

      For combined fields, all property paths should point to a single-valued object, the String value of which will be used.

      For fields which are both multiValued AND combined, the root for this path will be an individual object in the list defined by the multiValuedCombinedPropertyRootPath. For example, if the indexable domain was: { "categories": [ { "id": "exampleId", "name": "exampleName" } ] } , and the multiValuedCombinedPropertyRootPath was categories[*], then the propertyPaths might be id or name.

      Parameters:
      propertyPaths - paths to find field's values on indexable object
      Returns:
      this.
    • delimiter

      public FieldDefinition.FieldDefinitionBuilder delimiter(String delimiter)
      If this is a combined field, this is the delimiter string which should separate the values found from the propertyPaths.
      Parameters:
      delimiter - separator for values combined form propertyPaths
      Returns:
      this.
    • abbreviation

      public FieldDefinition.FieldDefinitionBuilder abbreviation(String abbreviation)
      Short field name which will be used for request parameters for example in sorting and filtering, as well as response field names.
      Parameters:
      abbreviation - short name for request and response field name
      Returns:
      this.
    • translatable

      public FieldDefinition.FieldDefinitionBuilder translatable(boolean translatable)
      Indicates if this field is translatable.
      Parameters:
      translatable - whether this field is translatable
      Returns:
      this.
    • variants

      The specific typed variants for this field.
      Parameters:
      variants - specific typed variants for this field
      Returns:
      this.
    • faceted

      public FieldDefinition.FieldDefinitionBuilder faceted(boolean faceted)
      Indicates if this field has a facet. Note that this is only used when Search Settings are not in use. Otherwise, Facets are managed as their own entity rather than embedded in fields.
      Parameters:
      faceted - whether this field has a facet
      Returns:
      this.
    • facet

      The facet which is driven by this field.
      Parameters:
      facet - facet driven by this field
      Returns:
      this.
    • facetVariantType

      public FieldDefinition.FieldDefinitionBuilder facetVariantType(String facetVariantType)
      The field variant type which should be faceted on.

      If not provided, the first variant type will be used.

      Parameters:
      facetVariantType - the variant type which should be faceted on
      Returns:
      this.
    • sortable

      public FieldDefinition.FieldDefinitionBuilder sortable(boolean sortable)
      Indicates if this field is sortable.
      Parameters:
      sortable - whether this field is sortable
      Returns:
      this.
    • sortOption

      public FieldDefinition.FieldDefinitionBuilder sortOption(SortOption sortOption)
      The sort option which is driven by this field.
      Parameters:
      sort - sort driven by this field
      Returns:
      this.
    • sortVariantType

      public FieldDefinition.FieldDefinitionBuilder sortVariantType(String sortVariantType)
      The field variant type which should be sorted on.

      If not provided, the first variant type will be used.

      Parameters:
      sortVariantType - the variant type which should be sorted on
      Returns:
      this.
    • searchable

      public FieldDefinition.FieldDefinitionBuilder searchable(boolean searchable)
      Whether or not the search query should be applied to this field on search.
      Parameters:
      searchable - should search query be applied on this field
      Returns:
      this.
    • fieldQueries

      public FieldDefinition.FieldDefinitionBuilder fieldQueries(List<FieldQuery> fieldQueries)
      Defines how this field should be queried by variants on particular query types.
      Parameters:
      fieldQueries - the variant level field queries
      Returns:
      this.
    • fieldVariantMap

      public FieldDefinition.FieldDefinitionBuilder fieldVariantMap(Map<String,FieldVariant> fieldVariantMap)
      A map of each field variant type to the corresponding FieldVariant. Populated by FieldDefinition.getVariantMap().
      Parameters:
      fieldVariantMap - map of each field variant type to the corresponding field variant
      Returns:
      this.
    • attributes

      public FieldDefinition.FieldDefinitionBuilder attributes(Map<String,Object> attributes)
      Miscellaneous attributes for this field.
      Parameters:
      attributes - Miscellaneous attributes for this field.
      Returns:
      this.
    • build

      public FieldDefinition build()
    • toString

      public String toString()
      Overrides:
      toString in class Object