Class SolrFieldService
java.lang.Object
com.broadleafcommerce.search.provider.solr.SolrFieldService
-
Constructor Summary
ConstructorsConstructorDescriptionSolrFieldService
(com.broadleafcommerce.search.api.service.FieldTypeConverter fieldTypeConverter) -
Method Summary
Modifier and TypeMethodDescriptiongetNameFromSolrField
(String typedSolrField) Retrieves the field name from a Solr field name.getSolrField
(com.broadleafcommerce.search.api.domain.FieldVariant fieldVariant, String locale) Format the provided field variant as a Solr field name in this locale.String[]
getSolrFields
(List<com.broadleafcommerce.search.api.domain.FieldVariant> fieldVariants, String locale) Format the provided field variants as Solr field names in this locale.getTypeFromSolrField
(String typedSolrField) Retrieves the type from a Solr field name.
-
Constructor Details
-
SolrFieldService
public SolrFieldService(com.broadleafcommerce.search.api.service.FieldTypeConverter fieldTypeConverter)
-
-
Method Details
-
getSolrField
public String getSolrField(com.broadleafcommerce.search.api.domain.FieldVariant fieldVariant, @Nullable String locale) Format the provided field variant as a Solr field name in this locale. If locale is null, or the field is not translatable, locale will not be included.- Parameters:
fieldVariant
- field variant to create a Solr field name forlocale
- (optional) the locale with or without country code for the Solr field translation- Returns:
- Solr field name in the format "abbreviation_type_locale"
-
getSolrFields
public String[] getSolrFields(List<com.broadleafcommerce.search.api.domain.FieldVariant> fieldVariants, @Nullable String locale) Format the provided field variants as Solr field names in this locale. If locale is null, or the fields are not translatable, locales will not be included.- Parameters:
fieldVariants
- field variants to create Solr field names forlocale
- (optional) the locale for the Solr fields- Returns:
- Solr field names in the format "abbreviation_type_locale"
-
getNameFromSolrField
Retrieves the field name from a Solr field name.- Parameters:
typedSolrField
- Solr field name in the expected format "abbreviation_type" or "abbreviation_type_locale"- Returns:
- field name without type or locale
-
getTypeFromSolrField
Retrieves the type from a Solr field name.- Parameters:
typedSolrField
- Solr field name in the expected format "abbreviation_type" or "abbreviation_type_locale"- Returns:
- generalized form of the field type
-