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 Summary
FieldsModifier and TypeFieldDescriptionprotected CatalogServicestatic final Stringprotected IndexFieldDaoprotected LocaleServiceprotected SolrHelperService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGiven a simple MVEL rule, convert it to Search Criteria.protected StringconvertFieldName(String fieldName) protected Collection<String>convertRuleToFilters(String matchRule) protected Long[]getCategoryIds(String mvelRule) protected StringgetCustomFieldPropertyName(String mvelRule) protected StringgetCustomFieldValue(String mvelRule) protected StringgetRuleOrPropertyFromFunction(String mvelRule) protected booleanisCategoryTargetingRule(String mvelRule) protected booleanisCustomFieldIndexed(List<IndexFieldType> indexFieldTypes) protected booleanisProductRule(String rule) protected booleanisWildCardSearch(String fieldValue) Determines if the given field value string represents a wild card search.protected StringparseMethod(String fieldName) Takes in a fieldName that contains a method (indicated with "()") and converts the method to an attribute.
-
Field Details
-
CATEGORY_FORMAT_REGEX
- See Also:
-
catalogService
-
indexFieldDao
-
localeService
-
solrHelperService
-
-
Constructor Details
-
MvelToSearchCriteriaConversionServiceImpl
public MvelToSearchCriteriaConversionServiceImpl()
-
-
Method Details
-
convert
Description copied from interface:MvelToSearchCriteriaConversionServiceGiven a simple MVEL rule, convert it to Search Criteria.- Specified by:
convertin interfaceMvelToSearchCriteriaConversionService- Returns:
- the converted MVEL rule in the form of Search Criteria
-
isProductRule
-
isCustomFieldIndexed
-
isCategoryTargetingRule
-
getCategoryIds
-
convertRuleToFilters
-
convertFieldName
-
parseMethod
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
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
-
getRuleOrPropertyFromFunction
-
getCustomFieldValue
-