Class SolrFieldService

java.lang.Object
com.broadleafcommerce.search.provider.solr.SolrFieldService

public class SolrFieldService extends Object
  • 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 for
      locale - (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 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