Class FieldDefinition
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFieldDefinition(String id, String label, String indexableType, boolean multiValued, String propertyPath, boolean combined, String multiValuedCombinedPropertyRootPath, List<String> propertyPaths, String delimiter, String abbreviation, boolean translatable, List<FieldVariant> variants, boolean faceted, Facet facet, String facetVariantType, boolean sortable, SortOption sortOption, String sortVariantType, boolean searchable, List<FieldQuery> fieldQueries, Map<String, FieldVariant> fieldVariantMap, Map<String, Object> attributes) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()protected booleanbooleanShort field name which will be used for request parameters for example in sorting and filtering, as well as response field names.Miscellaneous attributes for this field.If this is a combined field, this is the delimiter string which should separate the values found from the propertyPaths.getFacet()The facet which is driven by this field.Retrieve theFieldVariantto be used for faceting.The field variant type which should be faceted on.Defines how this field should be queried by variants on particular query types.A map of each field variant type to the correspondingFieldVariant.Retrieve theFieldVariantto be used for filtering.getId()The context ID of the field.The type to which this field belongs.Retrieve the JSON path to the property holding this field on an indexable object, if present.If this field is combined, retrieve the JSON path to the property holding the fields on an indexable object to be combined, if present.getLabel()The label of the field, suitable for display.For fields which are bothmultiValuedANDcombined, this will be path to the list containing the objects representing each value.The JSON path of this field excluding the root prefix, "$.".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, "$.".The sort option which is driven by this field.Retrieve theFieldVariantto be used for sorting.The field variant type which should be sorted on.Returns a lazily initialized map of each field variant type to the correspondingFieldVariant.The specific typed variants for this field.inthashCode()booleanWhether or not this field should be a combination of multiple path values.booleanIndicates if this field has a facet.booleanWhether or not this field should contain a list of values.booleanWhether or not the search query should be applied to this field on search.booleanIndicates if this field is sortable.booleanIndicates if this field is translatable.voidsetAbbreviation(String abbreviation) Short field name which will be used for request parameters for example in sorting and filtering, as well as response field names.voidsetAttributes(Map<String, Object> attributes) Miscellaneous attributes for this field.voidsetCombined(boolean combined) Whether or not this field should be a combination of multiple path values.voidsetDelimiter(String delimiter) If this is a combined field, this is the delimiter string which should separate the values found from the propertyPaths.voidThe facet which is driven by this field.voidsetFaceted(boolean faceted) Indicates if this field has a facet.voidsetFacetVariantType(String facetVariantType) The field variant type which should be faceted on.voidsetFieldQueries(List<FieldQuery> fieldQueries) Defines how this field should be queried by variants on particular query types.voidsetFieldVariantMap(Map<String, FieldVariant> fieldVariantMap) A map of each field variant type to the correspondingFieldVariant.voidThe context ID of the field.voidsetIndexableType(String indexableType) The type to which this field belongs.voidThe label of the field, suitable for display.voidsetMultiValued(boolean multiValued) Whether or not this field should contain a list of values.voidsetMultiValuedCombinedPropertyRootPath(String multiValuedCombinedPropertyRootPath) For fields which are bothmultiValuedANDcombined, this will be path to the list containing the objects representing each value.voidsetPropertyPath(String propertyPath) The JSON path of this field excluding the root prefix, "$.".voidsetPropertyPaths(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, "$.".voidsetSearchable(boolean searchable) Whether or not the search query should be applied to this field on search.voidsetSortable(boolean sortable) Indicates if this field is sortable.voidsetSortOption(SortOption sortOption) The sort option which is driven by this field.voidsetSortVariantType(String sortVariantType) The field variant type which should be sorted on.voidsetTranslatable(boolean translatable) Indicates if this field is translatable.voidsetVariants(List<FieldVariant> variants) The specific typed variants for this field.toString()
-
Constructor Details
-
FieldDefinition
public FieldDefinition(String id, String label, String indexableType, boolean multiValued, String propertyPath, boolean combined, String multiValuedCombinedPropertyRootPath, List<String> propertyPaths, String delimiter, String abbreviation, boolean translatable, List<FieldVariant> variants, boolean faceted, Facet facet, String facetVariantType, boolean sortable, SortOption sortOption, String sortVariantType, boolean searchable, List<FieldQuery> fieldQueries, Map<String, FieldVariant> fieldVariantMap, Map<String, Object> attributes) -
FieldDefinition
public FieldDefinition()
-
-
Method Details
-
getJsonPath
Retrieve the JSON path to the property holding this field on an indexable object, if present.- Returns:
- propertyPath if present, prepended with "$."
-
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
Retrieve theFieldVariantto 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
Retrieve theFieldVariantto be used for faceting.- Returns:
- variant to be used for faceting, or null
-
getSortVariant
Retrieve theFieldVariantto be used for sorting.- Returns:
- variant to be used for sorting, or null
-
getVariantMap
Returns a lazily initialized map of each field variant type to the correspondingFieldVariant. The map is constructed with the valueFieldVariant.getType()as the key and theFieldVariantas the value.- Returns:
- a map of each field variant type to the corresponding field variant
-
builder
-
getId
The context ID of the field.- Returns:
- the context ID of the field
-
getLabel
The label of the field, suitable for display.- Returns:
- label for the field, suitable for display
-
getIndexableType
The type to which this field belongs. Populated byIndexableTypetype.- 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
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
For fields which are bothmultiValuedANDcombined, 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 becategories[*].- Returns:
- path to find multi-valued combined field's property path root list
-
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
multiValuedANDcombined, the root for this path will be an individual object in the list defined by themultiValuedCombinedPropertyRootPath. For example, if the indexable domain was:{ "categories": [ { "id": "exampleId", "name": "exampleName" } ] }, and themultiValuedCombinedPropertyRootPathwascategories[*], then the propertyPaths might beidorname.- Returns:
- path to find field's values on indexable object
-
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
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
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. Note that this is only used when Search Settings are not in use. Otherwise,Facetsare managed as their own entity rather than embedded in fields.- Returns:
- whether this field has a facet
-
getFacet
The facet which is driven by this field.- Returns:
- facet driven by this field
-
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
The sort option which is driven by this field.- Returns:
- sort driven by this field
-
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
Defines how this field should be queried by variants on particular query types.- Returns:
- the variant level field queries
-
getFieldVariantMap
A map of each field variant type to the correspondingFieldVariant. Populated bygetVariantMap().- Returns:
- map of each field variant type to the corresponding field variant
-
getAttributes
Miscellaneous attributes for this field.- Returns:
- Miscellaneous attributes for this field.
-
setId
The context ID of the field.- Parameters:
id- the context ID of the field
-
setLabel
The label of the field, suitable for display.- Parameters:
label- label for the field, suitable for display
-
setIndexableType
The type to which this field belongs. Populated byIndexableTypetype.- 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
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
For fields which are bothmultiValuedANDcombined, 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 becategories[*].- Parameters:
propertyPath- path to find multi-valued combined field's property path root list
-
setPropertyPaths
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
multiValuedANDcombined, the root for this path will be an individual object in the list defined by themultiValuedCombinedPropertyRootPath. For example, if the indexable domain was:{ "categories": [ { "id": "exampleId", "name": "exampleName" } ] }, and themultiValuedCombinedPropertyRootPathwascategories[*], then the propertyPaths might beidorname.- Parameters:
propertyPaths- paths to find field's values on indexable object
-
setDelimiter
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
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
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. Note that this is only used when Search Settings are not in use. Otherwise,Facetsare managed as their own entity rather than embedded in fields.- Parameters:
faceted- whether this field has a facet
-
setFacet
The facet which is driven by this field.- Parameters:
facet- facet driven by this field
-
setFacetVariantType
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
The sort option which is driven by this field.- Parameters:
sort- sort driven by this field
-
setSortVariantType
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
Defines how this field should be queried by variants on particular query types.- Parameters:
fieldQueries- the variant level field queries
-
setFieldVariantMap
A map of each field variant type to the correspondingFieldVariant. Populated bygetVariantMap().- Parameters:
fieldVariantMap- map of each field variant type to the corresponding field variant
-
setAttributes
Miscellaneous attributes for this field.- Parameters:
attributes- Miscellaneous attributes for this field.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-