Class FieldDefinition

    • Method Detail

      • getJsonPath

        @Nullable
        public String getJsonPath()
        Retrieve the JSON path to the property holding this field on an indexable object, if present.
        Returns:
        propertyPath if present, prepended with "$."
      • getJsonPaths

        public List<String> getJsonPaths()
        If this field is combined, retrieve the JSON path to the property holding the fields on an indexable object to be combined, if present.
        Returns:
        propertyPaths if present, prepended with "$."
      • getFilterVariant

        @Nullable
        public FieldVariant getFilterVariant()
        Retrieve the FieldVariant to be used for filtering. Use Facet Variant if present, otherwise fall back to the first variant.
        Returns:
        variant to be used for filtering, or null
      • getFacetVariant

        @Nullable
        public FieldVariant getFacetVariant()
        Retrieve the FieldVariant to be used for faceting.
        Returns:
        variant to be used for faceting, or null
      • getSortVariant

        @Nullable
        public FieldVariant getSortVariant()
        Retrieve the FieldVariant to be used for sorting.
        Returns:
        variant to be used for sorting, or null
      • getVariantMap

        public Map<String,​FieldVariant> getVariantMap()
        Returns a lazily initialized map of each field variant type to the corresponding FieldVariant. The map is constructed with the value FieldVariant.getType() as the key and the FieldVariant as the value.
        Returns:
        a map of each field variant type to the corresponding field variant
      • getId

        public String getId()
        The context ID of the field.
        Returns:
        the context ID of the field
      • getLabel

        public String getLabel()
        The label of the field, suitable for display.
        Returns:
        label for the field, suitable for display
      • getIndexableType

        public String getIndexableType()
        The type to which this field belongs. Populated by IndexableType type.
        Returns:
        type to which this field belongs
      • isMultiValued

        public boolean isMultiValued()
        Whether or not this field should contain a list of values.
        Returns:
        whether this field should contain a list of values
      • getPropertyPath

        public String getPropertyPath()
        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

        Returns:
        path to find field's value on indexable object
      • isCombined

        public boolean isCombined()
        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.
        Returns:
        whether this field should be a combination of multiple path values
      • getMultiValuedCombinedPropertyRootPath

        public String getMultiValuedCombinedPropertyRootPath()
        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[*].
        Returns:
        path to find multi-valued combined field's property path root list
      • getPropertyPaths

        public List<String> getPropertyPaths()
        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.

        Returns:
        path to find field's values on indexable object
      • getDelimiter

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

        public String getAbbreviation()
        Short field name which will be used for request parameters for example in sorting and filtering, as well as response field names.
        Returns:
        short name for request and response field name
      • isTranslatable

        public boolean isTranslatable()
        Indicates if this field is translatable.
        Returns:
        whether this field is translatable
      • getVariants

        public List<FieldVariant> getVariants()
        The specific typed variants for this field.
        Returns:
        specific typed variants for this field
      • isFaceted

        public boolean isFaceted()
        Indicates if this field has a facet.
        Returns:
        whether this field has a facet
      • getFacet

        public Facet getFacet()
        The facet which is driven by this field.
        Returns:
        facet driven by this field
      • getFacetVariantType

        public String getFacetVariantType()
        The field variant type which should be faceted on.

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

        Returns:
        the variant type which should be faceted on
      • isSortable

        public boolean isSortable()
        Indicates if this field is sortable.
        Returns:
        whether this field is sortable
      • getSortOption

        public SortOption getSortOption()
        The sort option which is driven by this field.
        Returns:
        sort driven by this field
      • getSortVariantType

        public String getSortVariantType()
        The field variant type which should be sorted on.

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

        Returns:
        the variant type which should be sorted on
      • isSearchable

        public boolean isSearchable()
        Whether or not the search query should be applied to this field on search.
        Returns:
        should search query be applied on this field
      • getFieldQueries

        public List<FieldQuery> getFieldQueries()
        Defines how this field should be queried by variants on particular query types.
        Returns:
        the variant level field queries
      • getFieldVariantMap

        public Map<String,​FieldVariant> getFieldVariantMap()
        A map of each field variant type to the corresponding FieldVariant. Populated by getVariantMap().
        Returns:
        map of each field variant type to the corresponding field variant
      • setId

        public void setId​(String id)
        The context ID of the field.
        Parameters:
        id - the context ID of the field
      • setLabel

        public void setLabel​(String label)
        The label of the field, suitable for display.
        Parameters:
        label - label for the field, suitable for display
      • setIndexableType

        public void setIndexableType​(String indexableType)
        The type to which this field belongs. Populated by IndexableType type.
        Parameters:
        indexableType - type to which this field belongs
      • setMultiValued

        public void setMultiValued​(boolean multiValued)
        Whether or not this field should contain a list of values.
        Parameters:
        multiValued - whether this field should contain a list of values
      • setPropertyPath

        public void setPropertyPath​(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
      • setCombined

        public void setCombined​(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
      • setMultiValuedCombinedPropertyRootPath

        public void setMultiValuedCombinedPropertyRootPath​(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
      • setPropertyPaths

        public void setPropertyPaths​(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
      • setDelimiter

        public void setDelimiter​(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
      • setAbbreviation

        public void setAbbreviation​(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
      • setTranslatable

        public void setTranslatable​(boolean translatable)
        Indicates if this field is translatable.
        Parameters:
        translatable - whether this field is translatable
      • setVariants

        public void setVariants​(List<FieldVariant> variants)
        The specific typed variants for this field.
        Parameters:
        variants - specific typed variants for this field
      • setFaceted

        public void setFaceted​(boolean faceted)
        Indicates if this field has a facet.
        Parameters:
        faceted - whether this field has a facet
      • setFacet

        public void setFacet​(Facet facet)
        The facet which is driven by this field.
        Parameters:
        facet - facet driven by this field
      • setFacetVariantType

        public void setFacetVariantType​(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
      • setSortable

        public void setSortable​(boolean sortable)
        Indicates if this field is sortable.
        Parameters:
        sortable - whether this field is sortable
      • setSortOption

        public void setSortOption​(SortOption sortOption)
        The sort option which is driven by this field.
        Parameters:
        sort - sort driven by this field
      • setSortVariantType

        public void setSortVariantType​(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
      • setSearchable

        public void setSearchable​(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
      • setFieldQueries

        public void setFieldQueries​(List<FieldQuery> fieldQueries)
        Defines how this field should be queried by variants on particular query types.
        Parameters:
        fieldQueries - the variant level field queries
      • setFieldVariantMap

        public void setFieldVariantMap​(Map<String,​FieldVariant> fieldVariantMap)
        A map of each field variant type to the corresponding FieldVariant. Populated by getVariantMap().
        Parameters:
        fieldVariantMap - map of each field variant type to the corresponding field variant
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object