Class SnAsSearchProvider
- java.lang.Object
-
- de.hybris.platform.adaptivesearch.searchservices.strategies.impl.SnAsSearchProvider
-
- All Implemented Interfaces:
AsSearchProvider,org.springframework.beans.factory.InitializingBean
public class SnAsSearchProvider extends java.lang.Object implements AsSearchProvider, org.springframework.beans.factory.InitializingBean
Implementation ofAsSearchProviderthat uses the searchservices API.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringFACET_SORT_KEY_PREFIXprotected static java.util.Set<AsFeatureFlag>SUPPORTED_FEATURES
-
Constructor Summary
Constructors Constructor Description SnAsSearchProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected intcompareExpressions(AsExpressionData expression1, AsExpressionData expression2)protected AsFacetValueDataconvertBucketResponse(AbstractSnBucketResponse source, java.util.Set<java.lang.String> selectedBucketIds)protected AsDocumentDataconvertDocument(SnSearchHit source)protected AsExpressionDataconvertExpression(SnExpressionInfo source)protected AsFacetDataconvertFacetResponse(AbstractSnFacetResponse source)protected AsIndexConfigurationDataconvertIndexConfiguration(SnIndexConfiguration source)protected AsIndexPropertyDataconvertIndexProperty(SnField source)protected AsIndexTypeDataconvertIndexType(SnIndexType source)protected AsSortDataconvertNamedSort(SnNamedSort source)protected AsFacetDataconvertRangeBucketsFacetResponse(SnRangeBucketsFacetResponse source)protected SnSearchQueryconvertSearchQuery(AsSearchProfileContext context, AsSearchQueryData source)protected AsSearchResultDataconvertSearchResult(SnSearchResult source)protected AsFacetDataconvertTermBucketsFacetResponse(SnTermBucketsFacetResponse source)protected AsFacetSortDatacreateFacetSort(java.lang.String sortId)protected PKextractPkFromSearchHit(SnSearchHit searchHit)java.util.List<java.lang.String>getAvailableQualifiers(java.lang.String indexType, java.lang.String indexPropertyId)Return list of qualifiers for index property.protected java.util.Map<java.lang.String,AsBoostOperator>getBoostOperatorMapping()CatalogVersionServicegetCatalogVersionService()CommonI18NServicegetCommonI18NService()java.util.Optional<AsIndexConfigurationData>getIndexConfigurationForCode(java.lang.String id)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 indexTypeId)Returns a list of index properties for a given index type.java.util.Optional<AsIndexPropertyData>getIndexPropertyForCode(java.lang.String indexTypeId, java.lang.String id)Returns the index property for the provided code.java.util.Optional<AsIndexTypeData>getIndexTypeForCode(java.lang.String id)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 indexConfigurationId)Returns a list of index types for a given index configuration.L10NServicegetL10nService()SnCommonConfigurationServicegetSnCommonConfigurationService()SnContextFactorygetSnContextFactory()SnFieldTypeRegistrygetSnFieldTypeRegistry()SnIndexConfigurationServicegetSnIndexConfigurationService()SnIndexTypeServicegetSnIndexTypeService()SnQualifierTypeFactorygetSnQualifierTypeFactory()SnSearchServicegetSnSearchService()SnSessionServicegetSnSessionService()java.util.List<AsBoostType>getSupportedBoostTypes(java.lang.String indexType)Returns a list of boost types for a given index type.java.util.List<CatalogVersionModel>getSupportedCatalogVersions(java.lang.String indexConfigurationId, java.lang.String indexTypeId)Returns a list of catalog versions for a given index configuration and type.java.util.List<CurrencyModel>getSupportedCurrencies(java.lang.String indexConfigurationId, java.lang.String indexTypeId)Returns a list of currencies for a given index configuration and type.java.util.List<AsExpressionData>getSupportedFacetExpressions(java.lang.String indexTypeId)Returns a list of expressions for a given index type that can be used for facets.java.util.List<AsIndexPropertyData>getSupportedFacetIndexProperties(java.lang.String indexTypeId)Returns a list of index properties for a given index type that can be used for facets.java.util.List<AsFacetSortData>getSupportedFacetSorts(java.lang.String indexType)Returns a list of facet sorts for a given index type.java.util.List<AsFacetType>getSupportedFacetTypes(java.lang.String indexType)Returns a list of facet types for a given index type.java.util.Set<AsFeatureFlag>getSupportedFeatures(java.lang.String indexType)Returns a list of supported features.java.util.List<AsExpressionData>getSupportedGroupExpressions(java.lang.String indexTypeId)Returns a list of expressions for a given index type that can be used for groups.java.util.List<LanguageModel>getSupportedLanguages(java.lang.String indexConfigurationId, java.lang.String indexTypeId)Returns a list of languages for a given index configuration and type.java.util.List<AsExpressionData>getSupportedSortExpressions(java.lang.String indexTypeId)Returns a list of expressions for a given index type that can be used for sorts.TypeServicegetTypeService()booleanisValidBoostType(java.lang.String indexType, AsBoostType boostType)Checks if a given boost type can be used for a given index type.booleanisValidFacetExpression(java.lang.String indexTypeId, java.lang.String expression)Checks if a given index property can be used for facets.booleanisValidFacetIndexProperty(java.lang.String indexTypeId, java.lang.String indexPropertyId)Checks is a given index property can be used for facets.booleanisValidFacetSort(java.lang.String indexType, java.lang.String sort)Checks if a given sort can be used for facets.booleanisValidFacetType(java.lang.String indexType, AsFacetType facetType)Checks if a given facet type can be used for a given index type.booleanisValidGroupExpression(java.lang.String indexTypeId, java.lang.String expression)Checks if a given expression can be used for groups.booleanisValidSortExpression(java.lang.String indexTypeId, java.lang.String expression)Checks if a given expression can be used for sorts.AsSearchResultDataperformSearch(AsSearchProfileContext context, AsSearchQueryData query)protected voidpopulateBoostOperatorMapping()protected CategoryModelresolveSelectedCategory(java.util.List<CategoryModel> categoryPath)AsSearchResultDatasearch(AsSearchProfileContext context, AsSearchQueryData searchQuery)Performs a search query.voidsetCatalogVersionService(CatalogVersionService catalogVersionService)voidsetCommonI18NService(CommonI18NService commonI18NService)voidsetL10nService(L10NService l10nService)voidsetSnCommonConfigurationService(SnCommonConfigurationService snCommonConfigurationService)voidsetSnContextFactory(SnContextFactory snContextFactory)voidsetSnFieldTypeRegistry(SnFieldTypeRegistry snFieldTypeRegistry)voidsetSnIndexConfigurationService(SnIndexConfigurationService snIndexConfigurationService)voidsetSnIndexTypeService(SnIndexTypeService snIndexTypeService)voidsetSnQualifierTypeFactory(SnQualifierTypeFactory snQualifierTypeFactory)voidsetSnSearchService(SnSearchService snSearchService)voidsetSnSessionService(SnSessionService snSessionService)voidsetTypeService(TypeService typeService)
-
-
-
Field Detail
-
SUPPORTED_FEATURES
protected static final java.util.Set<AsFeatureFlag> SUPPORTED_FEATURES
-
FACET_SORT_KEY_PREFIX
protected static final java.lang.String FACET_SORT_KEY_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
populateBoostOperatorMapping
protected void populateBoostOperatorMapping()
-
getBoostOperatorMapping
protected java.util.Map<java.lang.String,AsBoostOperator> getBoostOperatorMapping()
-
getSupportedFeatures
public java.util.Set<AsFeatureFlag> getSupportedFeatures(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of supported features.- Specified by:
getSupportedFeaturesin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the supported features
-
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 id)
Description copied from interface:AsSearchProviderReturns the index configuration for the provided code.- Specified by:
getIndexConfigurationForCodein interfaceAsSearchProvider- Parameters:
id- - 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 indexConfigurationId)
Description copied from interface:AsSearchProviderReturns a list of index types for a given index configuration.- Specified by:
getIndexTypesin interfaceAsSearchProvider- Parameters:
indexConfigurationId- - the index configuration code- Returns:
- the index types
-
getIndexTypeForCode
public java.util.Optional<AsIndexTypeData> getIndexTypeForCode(java.lang.String id)
Description copied from interface:AsSearchProviderReturns the index type for the provided code.- Specified by:
getIndexTypeForCodein interfaceAsSearchProvider- Parameters:
id- - the index type code- Returns:
- the index type
-
getIndexProperties
public java.util.List<AsIndexPropertyData> getIndexProperties(java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of index properties for a given index type.- Specified by:
getIndexPropertiesin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type code- Returns:
- the index properties
-
getIndexPropertyForCode
public java.util.Optional<AsIndexPropertyData> getIndexPropertyForCode(java.lang.String indexTypeId, java.lang.String id)
Description copied from interface:AsSearchProviderReturns the index property for the provided code.- Specified by:
getIndexPropertyForCodein interfaceAsSearchProviderid- - the index property code- Returns:
- the index property
-
getSupportedCatalogVersions
public java.util.List<CatalogVersionModel> getSupportedCatalogVersions(java.lang.String indexConfigurationId, java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of catalog versions for a given index configuration and type.- Specified by:
getSupportedCatalogVersionsin interfaceAsSearchProvider- Parameters:
indexConfigurationId- - the index configurationindexTypeId- - the index type- Returns:
- the catalog versions
-
getSupportedLanguages
public java.util.List<LanguageModel> getSupportedLanguages(java.lang.String indexConfigurationId, java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of languages for a given index configuration and type.- Specified by:
getSupportedLanguagesin interfaceAsSearchProvider- Parameters:
indexConfigurationId- - the index configurationindexTypeId- - the index type- Returns:
- the languages
-
getSupportedCurrencies
public java.util.List<CurrencyModel> getSupportedCurrencies(java.lang.String indexConfigurationId, java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of currencies for a given index configuration and type.- Specified by:
getSupportedCurrenciesin interfaceAsSearchProvider- Parameters:
indexConfigurationId- - the index configurationindexTypeId- - the index type- Returns:
- the currencies
-
getSupportedFacetIndexProperties
public java.util.List<AsIndexPropertyData> getSupportedFacetIndexProperties(java.lang.String indexTypeId)
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:
indexTypeId- - the index type code- Returns:
- the index properties
-
isValidFacetIndexProperty
public boolean isValidFacetIndexProperty(java.lang.String indexTypeId, java.lang.String indexPropertyId)Description copied from interface:AsSearchProviderChecks is a given index property can be used for facets.- Specified by:
isValidFacetIndexPropertyin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type codeindexPropertyId- - the code of the index property- Returns:
trueif the index property can be used for facets,falseotherwise
-
getSupportedFacetExpressions
public java.util.List<AsExpressionData> getSupportedFacetExpressions(java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of expressions for a given index type that can be used for facets.- Specified by:
getSupportedFacetExpressionsin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type code- Returns:
- the expressions
-
isValidFacetExpression
public boolean isValidFacetExpression(java.lang.String indexTypeId, java.lang.String expression)Description copied from interface:AsSearchProviderChecks if a given index property can be used for facets.- Specified by:
isValidFacetExpressionin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type codeexpression- - the facet expression- Returns:
trueif expression can be used for facets,falseotherwise
-
getSupportedFacetTypes
public java.util.List<AsFacetType> getSupportedFacetTypes(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of facet types for a given index type.- Specified by:
getSupportedFacetTypesin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the facet types
-
isValidFacetType
public boolean isValidFacetType(java.lang.String indexType, AsFacetType facetType)Description copied from interface:AsSearchProviderChecks if a given facet type can be used for a given index type.- Specified by:
isValidFacetTypein interfaceAsSearchProvider- Parameters:
indexType- - the index type codefacetType- - the facet type- Returns:
trueif facet type can be used,falseotherwise
-
getSupportedFacetSorts
public java.util.List<AsFacetSortData> getSupportedFacetSorts(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of facet sorts for a given index type.- Specified by:
getSupportedFacetSortsin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the facet sorts
-
createFacetSort
protected AsFacetSortData createFacetSort(java.lang.String sortId)
-
isValidFacetSort
public boolean isValidFacetSort(java.lang.String indexType, java.lang.String sort)Description copied from interface:AsSearchProviderChecks if a given sort can be used for facets.- Specified by:
isValidFacetSortin interfaceAsSearchProvider- Parameters:
indexType- - the index type codesort- - the sort- Returns:
trueif sort can be used for facets,falseotherwise
-
getSupportedBoostTypes
public java.util.List<AsBoostType> getSupportedBoostTypes(java.lang.String indexType)
Description copied from interface:AsSearchProviderReturns a list of boost types for a given index type.- Specified by:
getSupportedBoostTypesin interfaceAsSearchProvider- Parameters:
indexType- - the index type code- Returns:
- the boost types
-
isValidBoostType
public boolean isValidBoostType(java.lang.String indexType, AsBoostType boostType)Description copied from interface:AsSearchProviderChecks if a given boost type can be used for a given index type.- Specified by:
isValidBoostTypein interfaceAsSearchProvider- Parameters:
indexType- - the index type codeboostType- - the boost type- Returns:
trueif boost type can be used,falseotherwise
-
getSupportedSortExpressions
public java.util.List<AsExpressionData> getSupportedSortExpressions(java.lang.String indexTypeId)
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:
indexTypeId- - the index type code- Returns:
- the expressions
-
isValidSortExpression
public boolean isValidSortExpression(java.lang.String indexTypeId, java.lang.String expression)Description copied from interface:AsSearchProviderChecks if a given expression can be used for sorts.- Specified by:
isValidSortExpressionin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type codeexpression- - the sort expression- Returns:
trueif expression can be used for sorts,falseotherwise
-
getSupportedGroupExpressions
public java.util.List<AsExpressionData> getSupportedGroupExpressions(java.lang.String indexTypeId)
Description copied from interface:AsSearchProviderReturns a list of expressions for a given index type that can be used for groups.- Specified by:
getSupportedGroupExpressionsin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type code- Returns:
- the expressions
-
isValidGroupExpression
public boolean isValidGroupExpression(java.lang.String indexTypeId, java.lang.String expression)Description copied from interface:AsSearchProviderChecks if a given expression can be used for groups.- Specified by:
isValidGroupExpressionin interfaceAsSearchProvider- Parameters:
indexTypeId- - the index type codeexpression- - the sort expression- Returns:
trueif expression can be used for groups,falseotherwise
-
getAvailableQualifiers
public java.util.List<java.lang.String> getAvailableQualifiers(java.lang.String indexType, java.lang.String indexPropertyId) throws AsExceptionDescription copied from interface:AsSearchProviderReturn list of qualifiers for index property.- Specified by:
getAvailableQualifiersin interfaceAsSearchProvider- Parameters:
indexType- - the index type codeindexPropertyId- - the index property code- Returns:
- the qualifiers
- Throws:
AsException
-
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
-
performSearch
public AsSearchResultData performSearch(AsSearchProfileContext context, AsSearchQueryData query) throws AsException
- Throws:
AsException
-
convertSearchQuery
protected SnSearchQuery convertSearchQuery(AsSearchProfileContext context, AsSearchQueryData source)
-
resolveSelectedCategory
protected CategoryModel resolveSelectedCategory(java.util.List<CategoryModel> categoryPath)
-
convertSearchResult
protected AsSearchResultData convertSearchResult(SnSearchResult source)
-
convertIndexConfiguration
protected AsIndexConfigurationData convertIndexConfiguration(SnIndexConfiguration source)
-
convertIndexType
protected AsIndexTypeData convertIndexType(SnIndexType source)
-
convertIndexProperty
protected AsIndexPropertyData convertIndexProperty(SnField source)
-
convertExpression
protected AsExpressionData convertExpression(SnExpressionInfo source)
-
compareExpressions
protected int compareExpressions(AsExpressionData expression1, AsExpressionData expression2)
-
convertDocument
protected AsDocumentData convertDocument(SnSearchHit source)
-
convertFacetResponse
protected AsFacetData convertFacetResponse(AbstractSnFacetResponse source)
-
convertTermBucketsFacetResponse
protected AsFacetData convertTermBucketsFacetResponse(SnTermBucketsFacetResponse source)
-
convertRangeBucketsFacetResponse
protected AsFacetData convertRangeBucketsFacetResponse(SnRangeBucketsFacetResponse source)
-
convertBucketResponse
protected AsFacetValueData convertBucketResponse(AbstractSnBucketResponse source, java.util.Set<java.lang.String> selectedBucketIds)
-
convertNamedSort
protected AsSortData convertNamedSort(SnNamedSort source)
-
extractPkFromSearchHit
protected PK extractPkFromSearchHit(SnSearchHit searchHit)
-
getTypeService
public TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getL10nService
public L10NService getL10nService()
-
setL10nService
public void setL10nService(L10NService l10nService)
-
getCommonI18NService
public CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getCatalogVersionService
public CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getSnSessionService
public SnSessionService getSnSessionService()
-
setSnSessionService
public void setSnSessionService(SnSessionService snSessionService)
-
getSnFieldTypeRegistry
public SnFieldTypeRegistry getSnFieldTypeRegistry()
-
setSnFieldTypeRegistry
public void setSnFieldTypeRegistry(SnFieldTypeRegistry snFieldTypeRegistry)
-
getSnIndexConfigurationService
public SnIndexConfigurationService getSnIndexConfigurationService()
-
setSnIndexConfigurationService
public void setSnIndexConfigurationService(SnIndexConfigurationService snIndexConfigurationService)
-
getSnIndexTypeService
public SnIndexTypeService getSnIndexTypeService()
-
setSnIndexTypeService
public void setSnIndexTypeService(SnIndexTypeService snIndexTypeService)
-
getSnCommonConfigurationService
public SnCommonConfigurationService getSnCommonConfigurationService()
-
setSnCommonConfigurationService
public void setSnCommonConfigurationService(SnCommonConfigurationService snCommonConfigurationService)
-
getSnQualifierTypeFactory
public SnQualifierTypeFactory getSnQualifierTypeFactory()
-
setSnQualifierTypeFactory
public void setSnQualifierTypeFactory(SnQualifierTypeFactory snQualifierTypeFactory)
-
getSnContextFactory
public SnContextFactory getSnContextFactory()
-
setSnContextFactory
public void setSnContextFactory(SnContextFactory snContextFactory)
-
getSnSearchService
public SnSearchService getSnSearchService()
-
setSnSearchService
public void setSnSearchService(SnSearchService snSearchService)
-
-