Class SolrFieldService


  • public class SolrFieldService
    extends Object
    • Constructor Detail

      • SolrFieldService

        public SolrFieldService​(com.broadleafcommerce.search.api.service.FieldTypeConverter fieldTypeConverter)
    • Method Detail

      • 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 for
        locale - (optional) the locale for the Solr field
        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 for
        locale - (optional) the locale for the Solr fields
        Returns:
        Solr field names in the format "abbreviation_type_locale"
      • getNameFromSolrField

        public String getNameFromSolrField​(String typedSolrField)
        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

        public String getTypeFromSolrField​(String typedSolrField)
        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