Class FieldDefinition.FieldDefinitionBuilder
java.lang.Object
com.broadleafcommerce.search.api.domain.FieldDefinition.FieldDefinitionBuilder
- Enclosing class:
- FieldDefinition
-
Method Summary
Modifier and TypeMethodDescriptionabbreviation
(String abbreviation) Short field name which will be used for request parameters for example in sorting and filtering, as well as response field names.attributes
(Map<String, Object> attributes) Miscellaneous attributes for this field.build()
combined
(boolean combined) Whether or not this field should be a combination of multiple path values.If this is a combined field, this is the delimiter string which should separate the values found from the propertyPaths.The facet which is driven by this field.faceted
(boolean faceted) Indicates if this field has a facet.facetVariantType
(String facetVariantType) The field variant type which should be faceted on.fieldQueries
(List<FieldQuery> fieldQueries) Defines how this field should be queried by variants on particular query types.fieldVariantMap
(Map<String, FieldVariant> fieldVariantMap) A map of each field variant type to the correspondingFieldVariant
.The context ID of the field.indexableType
(String indexableType) The type to which this field belongs.The label of the field, suitable for display.multiValued
(boolean multiValued) Whether or not this field should contain a list of values.multiValuedCombinedPropertyRootPath
(String multiValuedCombinedPropertyRootPath) For fields which are bothmultiValued
ANDcombined
, this will be path to the list containing the objects representing each value.propertyPath
(String propertyPath) The JSON path of this field excluding the root prefix, "$.".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, "$.".searchable
(boolean searchable) Whether or not the search query should be applied to this field on search.sortable
(boolean sortable) Indicates if this field is sortable.sortOption
(SortOption sortOption) The sort option which is driven by this field.sortVariantType
(String sortVariantType) The field variant type which should be sorted on.toString()
translatable
(boolean translatable) Indicates if this field is translatable.variants
(List<FieldVariant> variants) The specific typed variants for this field.
-
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
The type to which this field belongs. Populated byIndexableType
type.- Parameters:
indexableType
- type to which this field belongs- Returns:
this
.
-
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
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
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 bothmultiValued
ANDcombined
, 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- Returns:
this
.
-
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
ANDcombined
, 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 themultiValuedCombinedPropertyRootPath
wascategories[*]
, then the propertyPaths might beid
orname
.- Parameters:
propertyPaths
- paths to find field's values on indexable object- Returns:
this
.
-
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
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
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
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
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
Indicates if this field is sortable.- Parameters:
sortable
- whether this field is sortable- Returns:
this
.
-
sortOption
The sort option which is driven by this field.- Parameters:
sort
- sort driven by this field- Returns:
this
.
-
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
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
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 correspondingFieldVariant
. Populated byFieldDefinition.getVariantMap()
.- Parameters:
fieldVariantMap
- map of each field variant type to the corresponding field variant- Returns:
this
.
-
attributes
Miscellaneous attributes for this field.- Parameters:
attributes
- Miscellaneous attributes for this field.- Returns:
this
.
-
build
-
toString
-