Class FieldDefinition.FieldDefinitionBuilder
- java.lang.Object
-
- com.broadleafcommerce.search.api.domain.FieldDefinition.FieldDefinitionBuilder
-
- Enclosing class:
- FieldDefinition
public static class FieldDefinition.FieldDefinitionBuilder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.FieldDefinition
build()
FieldDefinition.FieldDefinitionBuilder
combined(boolean combined)
Whether or not this field should be a combination of multiple path values.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.FieldDefinition.FieldDefinitionBuilder
facet(Facet facet)
The facet which is driven by this field.FieldDefinition.FieldDefinitionBuilder
faceted(boolean faceted)
Indicates if this field has a facet.FieldDefinition.FieldDefinitionBuilder
facetVariantType(String facetVariantType)
The field variant type which should be faceted on.FieldDefinition.FieldDefinitionBuilder
fieldQueries(List<FieldQuery> fieldQueries)
Defines how this field should be queried by variants on particular query types.FieldDefinition.FieldDefinitionBuilder
fieldVariantMap(Map<String,FieldVariant> fieldVariantMap)
A map of each field variant type to the correspondingFieldVariant
.FieldDefinition.FieldDefinitionBuilder
id(String id)
The context ID of the field.FieldDefinition.FieldDefinitionBuilder
indexableType(String indexableType)
The type to which this field belongs.FieldDefinition.FieldDefinitionBuilder
label(String label)
The label of the field, suitable for display.FieldDefinition.FieldDefinitionBuilder
multiValued(boolean multiValued)
Whether or not this field should contain a list of values.FieldDefinition.FieldDefinitionBuilder
multiValuedCombinedPropertyRootPath(String multiValuedCombinedPropertyRootPath)
For fields which are bothmultiValued
ANDcombined
, this will be path to the list containing the objects representing each value.FieldDefinition.FieldDefinitionBuilder
propertyPath(String propertyPath)
The JSON path of this field excluding the root prefix, "$.".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, "$.".FieldDefinition.FieldDefinitionBuilder
searchable(boolean searchable)
Whether or not the search query should be applied to this field on search.FieldDefinition.FieldDefinitionBuilder
sortable(boolean sortable)
Indicates if this field is sortable.FieldDefinition.FieldDefinitionBuilder
sortOption(SortOption sortOption)
The sort option which is driven by this field.FieldDefinition.FieldDefinitionBuilder
sortVariantType(String sortVariantType)
The field variant type which should be sorted on.String
toString()
FieldDefinition.FieldDefinitionBuilder
translatable(boolean translatable)
Indicates if this field is translatable.FieldDefinition.FieldDefinitionBuilder
variants(List<FieldVariant> variants)
The specific typed variants for this field.
-
-
-
Method Detail
-
id
public FieldDefinition.FieldDefinitionBuilder id(String id)
The context ID of the field.- Parameters:
id
- the context ID of the field- Returns:
this
.
-
label
public FieldDefinition.FieldDefinitionBuilder label(String 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 byIndexableType
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 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
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
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
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
public FieldDefinition.FieldDefinitionBuilder variants(List<FieldVariant> 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.- Parameters:
faceted
- whether this field has a facet- Returns:
this
.
-
facet
public FieldDefinition.FieldDefinitionBuilder facet(Facet 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 correspondingFieldVariant
. Populated byFieldDefinition.getVariantMap()
.- Parameters:
fieldVariantMap
- map of each field variant type to the corresponding field variant- Returns:
this
.
-
build
public FieldDefinition build()
-
-