Class MvelToSearchCriteriaConversionServiceImpl

java.lang.Object
org.broadleafcommerce.core.search.service.solr.MvelToSearchCriteriaConversionServiceImpl
All Implemented Interfaces:
MvelToSearchCriteriaConversionService

@Service("blMvelToSearchCriteriaConversionService") public class MvelToSearchCriteriaConversionServiceImpl extends Object implements MvelToSearchCriteriaConversionService
Convenience methods for converting simple MVEL rules to Solr SearchCriteria
Author:
Chris Kittrell (ckittrell)
  • Field Details

  • Constructor Details

    • MvelToSearchCriteriaConversionServiceImpl

      public MvelToSearchCriteriaConversionServiceImpl()
  • Method Details

    • convert

      public SearchCriteria convert(String mvelRule)
      Description copied from interface: MvelToSearchCriteriaConversionService
      Given a simple MVEL rule, convert it to Search Criteria.
      Specified by:
      convert in interface MvelToSearchCriteriaConversionService
      Returns:
      the converted MVEL rule in the form of Search Criteria
    • isProductRule

      protected boolean isProductRule(String rule)
    • isCustomFieldIndexed

      protected boolean isCustomFieldIndexed(List<IndexFieldType> indexFieldTypes)
    • isCategoryTargetingRule

      protected boolean isCategoryTargetingRule(String mvelRule)
    • getCategoryIds

      protected Long[] getCategoryIds(String mvelRule)
    • convertRuleToFilters

      protected Collection<String> convertRuleToFilters(String matchRule)
    • convertFieldName

      protected String convertFieldName(String fieldName)
    • parseMethod

      protected String parseMethod(String fieldName)
      Takes in a fieldName that contains a method (indicated with "()") and converts the method to an attribute. Currently supports getX() methods For example, getType() -> type
      Parameters:
      fieldName -
      Returns:
    • isWildCardSearch

      protected boolean isWildCardSearch(String fieldValue)
      Determines if the given field value string represents a wild card search. In Solr a wild card search either starts or ends with an asterisk.
      Parameters:
      fieldValue - the String field value
      Returns:
      whether the value is for a wildcard search
    • getCustomFieldPropertyName

      protected String getCustomFieldPropertyName(String mvelRule)
    • getRuleOrPropertyFromFunction

      protected String getRuleOrPropertyFromFunction(String mvelRule)
    • getCustomFieldValue

      protected String getCustomFieldValue(String mvelRule)