Class SolrAsSearchProvider
- java.lang.Object
-
- de.hybris.platform.adaptivesearchsolr.strategies.impl.SolrAsSearchProvider
-
- All Implemented Interfaces:
AsSearchProvider
public class SolrAsSearchProvider extends java.lang.Object implements AsSearchProvider
Default implementation forAsSearchProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringADAPTIVE_SEARCH_CATALOG_VERSIONSprotected static java.lang.StringADAPTIVE_SEARCH_CATEGORY_PATHprotected static java.lang.StringADAPTIVE_SEARCH_KEEP_EXCLUDED_VALUES_KEYprotected static java.lang.StringADAPTIVE_SEARCH_RESULTprotected static java.lang.StringCODE_PARAMprotected static java.lang.StringDEFAULT_QUERY_TEMPLATEprotected static java.lang.StringEXPRESSION_PARAMprotected static java.lang.StringINDEX_CONFIGURATION_PARAMprotected static java.lang.StringINDEX_TYPE_PARAMprotected static java.util.regex.PatternVALID_INDEX_PROPERTY_NAME_REGEX_PATTERN
-
Constructor Summary
Constructors Constructor Description SolrAsSearchProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcompareIndexProperties(AsIndexPropertyData indexProperty1, AsIndexPropertyData indexProperty2)protected intcompareSortExpressions(AsExpressionData expression1, AsExpressionData expression2)protected <S,T>
java.util.List<T>convertAll(java.util.Collection<? extends S> source, java.util.function.Function<S,T> converter)protected AsIndexConfigurationDataconvertIndexConfiguration(SolrFacetSearchConfigModel solrIndexConfiguration)protected AsIndexPropertyDataconvertIndexProperty(SolrIndexedPropertyModel source)protected AsIndexTypeDataconvertIndexType(SolrIndexedTypeModel source)protected SearchQueryconvertSearchQuery(AsSearchProfileContext context, AsSearchQueryData searchQuery)protected AsSearchResultDataconvertSearchResult(AsSearchProfileContext context, SearchResult result)protected AsExpressionDataconvertSortExpression(SolrIndexedPropertyModel source)protected AsDocumentDatacreateDocumentData(Document document)protected AsFacetDatacreateFacetData(Facet facet)protected AsFacetValueDatacreateFacetValueData(FacetValue facetValue)protected AsExpressionDatacreateScoreSortExpression()protected AsSortDatacreateSortData(IndexedTypeSort sort)protected AsSearchResultDataexecuteInLocalViewWithLocale(java.util.Locale localeForLanguage, java.util.function.Supplier<AsSearchResultData> action)CommonI18NServicegetCommonI18NService()FacetSearchConfigServicegetFacetSearchConfigService()FacetSearchServicegetFacetSearchService()I18NServicegetI18nService()java.util.Optional<AsIndexConfigurationData>getIndexConfigurationForCode(java.lang.String code)Returns the index configuration for the provided code.java.util.List<AsIndexConfigurationData>getIndexConfigurations()Returns a list of index configurations.java.util.List<AsIndexPropertyData>getIndexProperties(java.lang.String indexType)Returns a list of index properties for a given index type.java.util.Optional<AsIndexPropertyData>getIndexPropertyForCode(java.lang.String indexType, java.lang.String code)Returns the index property for the provided code.java.util.Optional<AsIndexTypeData>getIndexTypeForCode(java.lang.String code)Returns the index type for the provided code.java.util.List<AsIndexTypeData>getIndexTypes()Returns a list of index types.java.util.List<AsIndexTypeData>getIndexTypes(java.lang.String indexConfiguration)Returns a list of index types for a given index configuration.SessionServicegetSessionService()SolrAsTypeMappingRegistrygetSolrAsTypeMappingRegistry()SolrFacetSearchConfigDaogetSolrFacetSearchConfigDao()SolrIndexedPropertyDaogetSolrIndexedPropertyDao()SolrIndexedPropertyTypeRegistrygetSolrIndexedPropertyTypeRegistry()SolrIndexedTypeDaogetSolrIndexedTypeDao()java.util.List<CatalogVersionModel>getSupportedCatalogVersions(java.lang.String indexConfiguration, java.lang.String indexType)Returns a list of catalog versions for a given index configuration and type.java.util.List<CurrencyModel>getSupportedCurrencies(java.lang.String indexConfiguration, java.lang.String indexType)Returns a list of currencies for a given index configuration and type.java.util.List<AsIndexPropertyData>getSupportedFacetIndexProperties(java.lang.String indexType)Returns a list of index properties for a given index type that can be used for facets.java.util.List<LanguageModel>getSupportedLanguages(java.lang.String indexConfiguration, java.lang.String indexType)Returns a list of languages for a given index configuration and type.java.util.List<AsExpressionData>getSupportedSortExpressions(java.lang.String indexType)Returns a list of expressions for a given index type that can be used for sorts.protected booleanisValidFacetIndexProperty(SolrIndexedPropertyModel indexProperty)booleanisValidFacetIndexProperty(java.lang.String indexType, java.lang.String code)Checks is a given index property can be used for facets.booleanisValidSortExpression(java.lang.String indexType, java.lang.String expression)Checks is a given expression can be used for facets.protected booleanisValidSortIndexProperty(SolrIndexedPropertyModel indexProperty)AsSearchResultDataperformSearch(AsSearchProfileContext context, AsSearchQueryData searchQuery)protected IndexedTyperesolveIndexedType(FacetSearchConfig facetSearchConfig, java.lang.String identifier)protected CategoryModelresolveSelectedCategory(java.util.List<CategoryModel> categoryPath)AsSearchResultDatasearch(AsSearchProfileContext context, AsSearchQueryData searchQuery)Performs a search query.voidsetCommonI18NService(CommonI18NService commonI18NService)voidsetFacetSearchConfigService(FacetSearchConfigService facetSearchConfigService)voidsetFacetSearchService(FacetSearchService facetSearchService)voidsetI18nService(I18NService i18nService)voidsetSessionService(SessionService sessionService)voidsetSolrAsTypeMappingRegistry(SolrAsTypeMappingRegistry solrAsTypeMappingRegistry)voidsetSolrFacetSearchConfigDao(SolrFacetSearchConfigDao solrFacetSearchConfigDao)voidsetSolrIndexedPropertyDao(SolrIndexedPropertyDao solrIndexedPropertyDao)voidsetSolrIndexedPropertyTypeRegistry(SolrIndexedPropertyTypeRegistry solrIndexedPropertyTypeRegistry)voidsetSolrIndexedTypeDao(SolrIndexedTypeDao solrIndexedTypeDao)
-
-
-
Field Detail
-
INDEX_CONFIGURATION_PARAM
protected static final java.lang.String INDEX_CONFIGURATION_PARAM
- See Also:
- Constant Field Values
-
INDEX_TYPE_PARAM
protected static final java.lang.String INDEX_TYPE_PARAM
- See Also:
- Constant Field Values
-
CODE_PARAM
protected static final java.lang.String CODE_PARAM
- See Also:
- Constant Field Values
-
EXPRESSION_PARAM
protected static final java.lang.String EXPRESSION_PARAM
- See Also:
- Constant Field Values
-
DEFAULT_QUERY_TEMPLATE
protected static final java.lang.String DEFAULT_QUERY_TEMPLATE
- See Also:
- Constant Field Values
-
ADAPTIVE_SEARCH_RESULT
protected static final java.lang.String ADAPTIVE_SEARCH_RESULT
- See Also:
- Constant Field Values
-
ADAPTIVE_SEARCH_CATALOG_VERSIONS
protected static final java.lang.String ADAPTIVE_SEARCH_CATALOG_VERSIONS
- See Also:
- Constant Field Values
-
ADAPTIVE_SEARCH_CATEGORY_PATH
protected static final java.lang.String ADAPTIVE_SEARCH_CATEGORY_PATH
- See Also:
- Constant Field Values
-
ADAPTIVE_SEARCH_KEEP_EXCLUDED_VALUES_KEY
protected static final java.lang.String ADAPTIVE_SEARCH_KEEP_EXCLUDED_VALUES_KEY
- See Also:
- Constant Field Values
-
VALID_INDEX_PROPERTY_NAME_REGEX_PATTERN
protected static final java.util.regex.Pattern VALID_INDEX_PROPERTY_NAME_REGEX_PATTERN
-
-
Method Detail
-
getIndexConfigurations
public java.util.List<AsIndexConfigurationData> getIndexConfigurations()
Description copied from interface:AsSearchProviderReturns a list of index configurations.- Specified by:
getIndexConfigurationsin interfaceAsSearchProvider- Returns:
- the index configurations
-
getIndexConfigurationForCode
public java.util.Optional<AsIndexConfigurationData> getIndexConfigurationForCode(java.lang.String code)
Description copied from interface:AsSearchProviderReturns the index configuration for the provided code.- Specified by:
getIndexConfigurationForCodein interfaceAsSearchProvider- Parameters:
code- - the index configuration code- Returns:
- the index type
-
getIndexTypes
public java.util.List<AsIndexTypeData> getIndexTypes()
Description copied from interface:AsSearchProviderReturns a list of index types.- Specified by:
getIndexTypesin interfaceAsSearchProvider- Returns:
- the index types
-
getIndexTypes
public java.util.List<AsIndexTypeData> getIndexTypes(java.lang.String indexConfiguration)
Description copied from interface:AsSearchProviderReturns a list of index types for a given index configuration.- Specified by:
getIndexTypesin interfaceAsSearchProvider- Parameters:
indexConfiguration- - the index configuration code- Returns:
- the index types
-
getIndexTypeForCode
public java.util.Optional<AsIndexTypeData> getIndexTypeForCode(java.lang.String code)
Description copied from interface:AsSearchProviderReturns the index type for the provided code.- Specified by:
getIndexTypeForCodein interfaceAsSearchProvider- Parameters:
code- - the index type code- Returns:
- the index type
-
getIndexProperties
public java.util.List<AsIndexPropertyData> getIndexProperties(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of index properties for a given index type.- Specified by:
getIndexPropertiesin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the index properties
-
getIndexPropertyForCode
public java.util.Optional<AsIndexPropertyData> getIndexPropertyForCode(java.lang.String indexType, java.lang.String code)
Description copied from interface:AsSearchProviderReturns the index property for the provided code.- Specified by:
getIndexPropertyForCodein interfaceAsSearchProvidercode- - the index property code- Returns:
- the index property
-
getSupportedCatalogVersions
public java.util.List<CatalogVersionModel> getSupportedCatalogVersions(java.lang.String indexConfiguration, java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of catalog versions for a given index configuration and type.- Specified by:
getSupportedCatalogVersionsin interfaceAsSearchProvider- Parameters:
indexConfiguration- - the index configurationindexType- - the index type- Returns:
- the catalog versions
-
getSupportedLanguages
public java.util.List<LanguageModel> getSupportedLanguages(java.lang.String indexConfiguration, java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of languages for a given index configuration and type.- Specified by:
getSupportedLanguagesin interfaceAsSearchProvider- Parameters:
indexConfiguration- - the index configurationindexType- - the index type- Returns:
- the languages
-
getSupportedCurrencies
public java.util.List<CurrencyModel> getSupportedCurrencies(java.lang.String indexConfiguration, java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of currencies for a given index configuration and type.- Specified by:
getSupportedCurrenciesin interfaceAsSearchProvider- Parameters:
indexConfiguration- - the index configurationindexType- - the index type- Returns:
- the currencies
-
getSupportedFacetIndexProperties
public java.util.List<AsIndexPropertyData> getSupportedFacetIndexProperties(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of index properties for a given index type that can be used for facets.- Specified by:
getSupportedFacetIndexPropertiesin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the index properties
-
isValidFacetIndexProperty
public boolean isValidFacetIndexProperty(java.lang.String indexType, java.lang.String code)Description copied from interface:AsSearchProviderChecks is a given index property can be used for facets.- Specified by:
isValidFacetIndexPropertyin interfaceAsSearchProvider- Parameters:
indexType- - the index type codecode- - the code of the index property- Returns:
trueif the index property can be used for facets,falseotherwise
-
isValidFacetIndexProperty
protected boolean isValidFacetIndexProperty(SolrIndexedPropertyModel indexProperty)
-
getSupportedSortExpressions
public java.util.List<AsExpressionData> getSupportedSortExpressions(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of expressions for a given index type that can be used for sorts.- Specified by:
getSupportedSortExpressionsin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the expressions
-
isValidSortExpression
public boolean isValidSortExpression(java.lang.String indexType, java.lang.String expression)Description copied from interface:AsSearchProviderChecks is a given expression can be used for facets.- Specified by:
isValidSortExpressionin interfaceAsSearchProvider- Parameters:
indexType- - the index type codeexpression- - the sort expression- Returns:
trueif expression can be used for sorts,falseotherwise
-
isValidSortIndexProperty
protected boolean isValidSortIndexProperty(SolrIndexedPropertyModel indexProperty)
-
convertIndexConfiguration
protected AsIndexConfigurationData convertIndexConfiguration(SolrFacetSearchConfigModel solrIndexConfiguration)
-
convertIndexType
protected AsIndexTypeData convertIndexType(SolrIndexedTypeModel source)
-
convertIndexProperty
protected AsIndexPropertyData convertIndexProperty(SolrIndexedPropertyModel source)
-
compareIndexProperties
protected int compareIndexProperties(AsIndexPropertyData indexProperty1, AsIndexPropertyData indexProperty2)
-
createScoreSortExpression
protected AsExpressionData createScoreSortExpression()
-
convertSortExpression
protected AsExpressionData convertSortExpression(SolrIndexedPropertyModel source)
-
compareSortExpressions
protected int compareSortExpressions(AsExpressionData expression1, AsExpressionData expression2)
-
search
public AsSearchResultData search(AsSearchProfileContext context, AsSearchQueryData searchQuery) throws AsException
Description copied from interface:AsSearchProviderPerforms a search query.- Specified by:
searchin interfaceAsSearchProvider- Parameters:
context- - the search profile contextsearchQuery- - the search query- Throws:
AsException- if and exception occurs during the search
-
executeInLocalViewWithLocale
protected AsSearchResultData executeInLocalViewWithLocale(java.util.Locale localeForLanguage, java.util.function.Supplier<AsSearchResultData> action) throws AsException
- Throws:
AsException
-
performSearch
public AsSearchResultData performSearch(AsSearchProfileContext context, AsSearchQueryData searchQuery) throws AsException
- Throws:
AsException
-
resolveIndexedType
protected IndexedType resolveIndexedType(FacetSearchConfig facetSearchConfig, java.lang.String identifier) throws AsException
- Throws:
AsException
-
resolveSelectedCategory
protected CategoryModel resolveSelectedCategory(java.util.List<CategoryModel> categoryPath)
-
convertSearchQuery
protected SearchQuery convertSearchQuery(AsSearchProfileContext context, AsSearchQueryData searchQuery) throws FacetConfigServiceException, AsException
-
convertSearchResult
protected AsSearchResultData convertSearchResult(AsSearchProfileContext context, SearchResult result)
-
createDocumentData
protected AsDocumentData createDocumentData(Document document)
-
createFacetData
protected AsFacetData createFacetData(Facet facet)
-
createFacetValueData
protected AsFacetValueData createFacetValueData(FacetValue facetValue)
-
convertAll
protected <S,T> java.util.List<T> convertAll(java.util.Collection<? extends S> source, java.util.function.Function<S,T> converter)
-
createSortData
protected AsSortData createSortData(IndexedTypeSort sort)
-
getSolrFacetSearchConfigDao
public SolrFacetSearchConfigDao getSolrFacetSearchConfigDao()
-
setSolrFacetSearchConfigDao
public void setSolrFacetSearchConfigDao(SolrFacetSearchConfigDao solrFacetSearchConfigDao)
-
getSolrIndexedTypeDao
public SolrIndexedTypeDao getSolrIndexedTypeDao()
-
setSolrIndexedTypeDao
public void setSolrIndexedTypeDao(SolrIndexedTypeDao solrIndexedTypeDao)
-
getSolrIndexedPropertyDao
public SolrIndexedPropertyDao getSolrIndexedPropertyDao()
-
setSolrIndexedPropertyDao
public void setSolrIndexedPropertyDao(SolrIndexedPropertyDao solrIndexedPropertyDao)
-
getSolrIndexedPropertyTypeRegistry
public SolrIndexedPropertyTypeRegistry getSolrIndexedPropertyTypeRegistry()
-
setSolrIndexedPropertyTypeRegistry
public void setSolrIndexedPropertyTypeRegistry(SolrIndexedPropertyTypeRegistry solrIndexedPropertyTypeRegistry)
-
getSolrAsTypeMappingRegistry
public SolrAsTypeMappingRegistry getSolrAsTypeMappingRegistry()
-
setSolrAsTypeMappingRegistry
public void setSolrAsTypeMappingRegistry(SolrAsTypeMappingRegistry solrAsTypeMappingRegistry)
-
getFacetSearchService
public FacetSearchService getFacetSearchService()
-
setFacetSearchService
public void setFacetSearchService(FacetSearchService facetSearchService)
-
getFacetSearchConfigService
public FacetSearchConfigService getFacetSearchConfigService()
-
setFacetSearchConfigService
public void setFacetSearchConfigService(FacetSearchConfigService facetSearchConfigService)
-
getSessionService
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getI18nService
public I18NService getI18nService()
-
setI18nService
public void setI18nService(I18NService i18nService)
-
getCommonI18NService
public CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
-