Class CSSearchSnSearchProvider
java.lang.Object
de.hybris.platform.searchservices.spi.service.impl.AbstractSnSearchProvider<CSSearchSnSearchProviderConfiguration>
de.hybris.platform.searchprovidercssearchservices.spi.service.impl.CSSearchSnSearchProvider
- All Implemented Interfaces:
SnSearchProvider<CSSearchSnSearchProviderConfiguration>,org.springframework.beans.factory.InitializingBean
public class CSSearchSnSearchProvider
extends AbstractSnSearchProvider<CSSearchSnSearchProviderConfiguration>
implements org.springframework.beans.factory.InitializingBean
Implementation of
SnSearchProvider for the search core service.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic interfacestatic interfaceprotected static classprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final RetryConfigurationprotected static final Stringstatic final RetryConfigurationstatic final RetryConfigurationstatic final RetryConfiguration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabortIndexerOperation(SnContext context, String indexerOperationId, String message) Marks an indexer operation as aborted.voidbuildLocalizedName(CSSearchSnSearchProvider.ConverterContext converterContext, Map<Locale, String> source) protected StringbuildQualifierHeader(Map.Entry<String, List<SnQualifier>> entry) protected StringbuildRequestExceptionMessage(String message, com.hybris.charon.exp.HttpException exception) voidMakes sure that documents are stored on the index storage and are visible for queries.voidcompleteIndexerOperation(SnContext context, String indexerOperationId) Marks an indexer operation as completed.protected QualifierDTOconvertCurrencyQualifier(CSSearchSnSearchProvider.ConverterContext converterContext, SnCurrency source) protected QualifierTypeDTOconvertCurrencyQualifierType(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration indexConfiguration) protected DocumentBatchOperationRequestDTOprotected SnDocumentBatchOperationResponseprotected DocumentBatchRequestDTOconvertDocumenBatchRequest(SnDocumentBatchRequest source, String indexerOperationId) protected SnDocumentBatchResponseprotected SnDocumentOperationStatusconvertDocumenOperationStatus(Integer statusCode) protected Stringprotected DocumentDTOconvertDocument(SnDocument source) protected FieldDTOconvertField(CSSearchSnSearchProvider.ConverterContext converterContext, SnField source) protected FieldTypeDTOconvertFieldType(SnFieldType source) protected SnIndexconvertIndex(IndexDTO source) protected IndexConfigurationDTOconvertIndexConfiguration(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration source) protected SnIndexerOperationprotected SnIndexerOperationStatusprotected IndexerOperationStatusDTOprotected SnIndexerOperationTypeprotected IndexerOperationTypeDTOprotected IndexTypeDTOconvertIndexType(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexType source) protected LanguageDTOconvertLanguage(CSSearchSnSearchProvider.ConverterContext converterContext, SnLanguage source) protected SearchQueryDTOconvertSearchQuery(SnSearchQuery source) protected SnSearchResultconvertSearchResult(SnSearchQuery searchQuery, SearchResultDTO source) protected SearchToleranceDTOprotected SuggestQueryDTOconvertSuggestQuery(SnSuggestQuery source) protected SnSuggestResultconvertSuggestResult(SuggestResultDTO source) protected SynonymDictionaryDTOconvertSynonymDictionary(CSSearchSnSearchProvider.ConverterContext converterContext, SnSynonymDictionary source) protected SynonymEntryDTOconvertSynonymEntry(SnSynonymEntry source) protected CSSearchClientcreateClient(SnIndexConfiguration indexConfiguration) createIndex(SnContext context) Creates an index.createIndexerOperation(SnContext context, SnIndexerOperationType indexerOperationType, int totalItems) Creates a new indexer operation.protected StringcreateLanguageHeader(SnContext context) protected StringcreateQualifierHeader(SnContext context) voiddeleteIndex(SnContext context, String indexId) Deletes an index (if it exists).executeDocumentBatch(SnContext context, String indexId, SnDocumentBatchRequest documentBatchRequest, String indexerOperationId) Executes a document batch.voidexportConfiguration(SnExportConfiguration exportConfiguration, List<Locale> locales) Exports the configuration to the search provider.protected voidexportIndexConfiguration(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration indexConfiguration, CSSearchClient client) protected voidexportIndexTypes(CSSearchSnSearchProvider.ConverterContext converterContext, List<SnIndexType> indexTypes, CSSearchClient client) protected voidexportSynonymDictionaries(CSSearchSnSearchProvider.ConverterContext converterContext, List<SnSynonymDictionary> synonymDictionaries, CSSearchClient client) voidfailIndexerOperation(SnContext context, String indexerOperationId, String message) Marks an indexer operation as failed.protected booleanfilterQualifierHeader(Map.Entry<String, List<SnQualifier>> entry) protected ma.glasnost.orika.MapperFacadeprotected voidhandleRequestException(String message, CSSearchSnSearchProvider.InterruptableRunnable handler) protected <T> ThandleRequestException(String message, CSSearchSnSearchProvider.InterruptableSupplier<T> handler) protected voidregisterMappings(ma.glasnost.orika.MapperFactory mapperFactory) search(SnContext context, String indexId, SnSearchQuery searchQuery) Executes a search query on a specific index.voidsetApiRegistryClientService(ApiRegistryClientService apiRegistryClientService) voidsetClientFactory(ClientFactory clientFactory) voidsetCommonI18NService(CommonI18NService commonI18NService) voidsetDestinationService(DestinationService<ConsumedDestinationModel> destinationService) suggest(SnContext context, String indexId, SnSuggestQuery suggestQuery) Executes a suggest query on a specific index.updateIndexerOperationStatus(SnContext context, String indexerOperationId, SnIndexerOperationStatus status, String errorMessage) Updates the status of an indexer operation.protected voidwaitForIndexDeletionOrElseThrow(CSSearchClient client, String indexId, String errorMessage) protected IndexerOperationDTOwaitForIndexerOperationStatusOrElseThrow(CSSearchClient client, String indexerOperationId, IndexerOperationStatusDTO pendingStatus, IndexerOperationStatusDTO expectedStatus, String errorMessage) protected IndexDTOwaitForIndexStatusOrElseThrow(CSSearchClient client, String indexId, IndexStatusDTO pendingStatus, IndexStatusDTO expectedStatus, String errorMessage) protected TaskDTOwaitForTaskStatusOrElseThrow(CSSearchClient client, String taskId, TaskStatusDTO pendingStatus, TaskStatusDTO expectedStatus, String errorMessage, RetryConfiguration retryConfiguration) Methods inherited from class de.hybris.platform.searchservices.spi.service.impl.AbstractSnSearchProvider
getSearchProviderConfiguration
-
Field Details
-
CREATE_INDEX_FAILED_MSG
- See Also:
-
CREATE_UPDATE_INDEX_TYPE_FAILED_MSG
- See Also:
-
DELETE_INDEX_FAILED_MSG
- See Also:
-
COMMIT_INDEX_FAILED_MSG
- See Also:
-
CREATE_INDEXER_OPERATION_FAILED_MSG
- See Also:
-
COMPLETE_INDEXER_OPERATION_FAILED_MSG
- See Also:
-
ABORT_INDEXER_OPERATION_FAILED_MSG
- See Also:
-
FAIL_INDEXER_OPERATION_FAILED_MSG
- See Also:
-
DOCUMENT_BATCH_FAILED_MSG
- See Also:
-
INDEX_RETRY_CONFIGURATION
-
INDEX_COMMIT_RETRY_CONFIGURATION
-
INDEXER_OPERATION_RETRY_CONFIGURATION
-
DOCUMENT_BATCH_RETRY_CONFIGURATION
-
-
Constructor Details
-
CSSearchSnSearchProvider
public CSSearchSnSearchProvider()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
registerMappings
protected void registerMappings(ma.glasnost.orika.MapperFactory mapperFactory) -
getMapperFacade
protected ma.glasnost.orika.MapperFacade getMapperFacade() -
exportConfiguration
public void exportConfiguration(SnExportConfiguration exportConfiguration, List<Locale> locales) throws SnException Description copied from interface:SnSearchProviderExports the configuration to the search provider.- Specified by:
exportConfigurationin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
exportConfiguration- - the export configuration- Throws:
SnException- if an error occurs
-
exportSynonymDictionaries
protected void exportSynonymDictionaries(CSSearchSnSearchProvider.ConverterContext converterContext, List<SnSynonymDictionary> synonymDictionaries, CSSearchClient client) throws SnException - Throws:
SnException
-
convertSynonymDictionary
protected SynonymDictionaryDTO convertSynonymDictionary(CSSearchSnSearchProvider.ConverterContext converterContext, SnSynonymDictionary source) -
convertSynonymEntry
-
exportIndexConfiguration
protected void exportIndexConfiguration(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration indexConfiguration, CSSearchClient client) throws SnException - Throws:
SnException
-
convertIndexConfiguration
protected IndexConfigurationDTO convertIndexConfiguration(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration source) -
convertLanguage
protected LanguageDTO convertLanguage(CSSearchSnSearchProvider.ConverterContext converterContext, SnLanguage source) -
convertCurrencyQualifierType
protected QualifierTypeDTO convertCurrencyQualifierType(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexConfiguration indexConfiguration) -
convertCurrencyQualifier
protected QualifierDTO convertCurrencyQualifier(CSSearchSnSearchProvider.ConverterContext converterContext, SnCurrency source) -
exportIndexTypes
protected void exportIndexTypes(CSSearchSnSearchProvider.ConverterContext converterContext, List<SnIndexType> indexTypes, CSSearchClient client) throws SnException - Throws:
SnException
-
convertIndexType
protected IndexTypeDTO convertIndexType(CSSearchSnSearchProvider.ConverterContext converterContext, SnIndexType source) -
convertField
protected FieldDTO convertField(CSSearchSnSearchProvider.ConverterContext converterContext, SnField source) -
convertFieldType
-
convertSearchTolerance
-
createIndex
Description copied from interface:SnSearchProviderCreates an index.- Specified by:
createIndexin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the context- Throws:
SnException- if an error occurs
-
convertIndex
-
deleteIndex
Description copied from interface:SnSearchProviderDeletes an index (if it exists).- Specified by:
deleteIndexin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexId- - the index id- Throws:
SnException- if an error occurs
-
waitForIndexStatusOrElseThrow
protected IndexDTO waitForIndexStatusOrElseThrow(CSSearchClient client, String indexId, IndexStatusDTO pendingStatus, IndexStatusDTO expectedStatus, String errorMessage) throws SnException - Throws:
SnException
-
waitForIndexDeletionOrElseThrow
protected void waitForIndexDeletionOrElseThrow(CSSearchClient client, String indexId, String errorMessage) throws SnException - Throws:
SnException
-
createIndexerOperation
public SnIndexerOperation createIndexerOperation(SnContext context, SnIndexerOperationType indexerOperationType, int totalItems) throws SnException Description copied from interface:SnSearchProviderCreates a new indexer operation.- Specified by:
createIndexerOperationin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the context- Throws:
SnException- if an error occurs
-
updateIndexerOperationStatus
public SnIndexerOperation updateIndexerOperationStatus(SnContext context, String indexerOperationId, SnIndexerOperationStatus status, String errorMessage) throws SnException Description copied from interface:SnSearchProviderUpdates the status of an indexer operation.- Specified by:
updateIndexerOperationStatusin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextstatus- - the statuserrorMessage- - the errorMessage- Throws:
SnException- if an error occurs
-
completeIndexerOperation
public void completeIndexerOperation(SnContext context, String indexerOperationId) throws SnException Description copied from interface:SnSearchProviderMarks an indexer operation as completed.- Specified by:
completeIndexerOperationin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexerOperationId- - the indexer operation id- Throws:
SnException- if an error occurs
-
abortIndexerOperation
public void abortIndexerOperation(SnContext context, String indexerOperationId, String message) throws SnException Description copied from interface:SnSearchProviderMarks an indexer operation as aborted.- Specified by:
abortIndexerOperationin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexerOperationId- - the indexer operation idmessage- - the message- Throws:
SnException- if an error occurs
-
failIndexerOperation
public void failIndexerOperation(SnContext context, String indexerOperationId, String message) throws SnException Description copied from interface:SnSearchProviderMarks an indexer operation as failed.- Specified by:
failIndexerOperationin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexerOperationId- - the indexer operation idmessage- - the message- Throws:
SnException- if an error occurs
-
waitForIndexerOperationStatusOrElseThrow
protected IndexerOperationDTO waitForIndexerOperationStatusOrElseThrow(CSSearchClient client, String indexerOperationId, IndexerOperationStatusDTO pendingStatus, IndexerOperationStatusDTO expectedStatus, String errorMessage) throws SnException - Throws:
SnException
-
convertIndexerOperationType
-
convertIndexerOperationType
-
convertIndexerOperationStatus
-
convertIndexerOperationStatus
-
convertIndexerOperation
-
executeDocumentBatch
public SnDocumentBatchResponse executeDocumentBatch(SnContext context, String indexId, SnDocumentBatchRequest documentBatchRequest, String indexerOperationId) throws SnException Description copied from interface:SnSearchProviderExecutes a document batch.- Specified by:
executeDocumentBatchin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexId- - the index iddocumentBatchRequest- - the document batch requestindexerOperationId- - the indexer operation id- Returns:
- the document batch response
- Throws:
SnException- if an error occurs
-
convertDocument
-
convertDocumenBatchRequest
protected DocumentBatchRequestDTO convertDocumenBatchRequest(SnDocumentBatchRequest source, String indexerOperationId) -
convertDocumenBatchOperationRequest
protected DocumentBatchOperationRequestDTO convertDocumenBatchOperationRequest(SnDocumentBatchOperationRequest source) -
convertDocumenOperationType
-
convertDocumenBatchResponse
-
convertDocumenBatchOperationResponse
protected SnDocumentBatchOperationResponse convertDocumenBatchOperationResponse(DocumentBatchOperationResponseDTO source) -
convertDocumenOperationStatus
-
commit
Description copied from interface:SnSearchProviderMakes sure that documents are stored on the index storage and are visible for queries.- Specified by:
commitin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexId- - the index id- Throws:
SnException- if an error occurs
-
waitForTaskStatusOrElseThrow
protected TaskDTO waitForTaskStatusOrElseThrow(CSSearchClient client, String taskId, TaskStatusDTO pendingStatus, TaskStatusDTO expectedStatus, String errorMessage, RetryConfiguration retryConfiguration) throws SnException - Throws:
SnException
-
search
public SnSearchResult search(SnContext context, String indexId, SnSearchQuery searchQuery) throws SnException Description copied from interface:SnSearchProviderExecutes a search query on a specific index.- Specified by:
searchin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexId- - the index idsearchQuery- - the search query- Returns:
- the search result
- Throws:
SnException- if an error occurs
-
convertSearchQuery
-
convertSearchResult
-
suggest
public SnSuggestResult suggest(SnContext context, String indexId, SnSuggestQuery suggestQuery) throws SnException Description copied from interface:SnSearchProviderExecutes a suggest query on a specific index.- Specified by:
suggestin interfaceSnSearchProvider<CSSearchSnSearchProviderConfiguration>- Parameters:
context- - the contextindexId- - the index idsuggestQuery- - the suggest query- Returns:
- the suggest result
- Throws:
SnException- if an error occurs
-
convertSuggestQuery
-
convertSuggestResult
-
createLanguageHeader
-
createQualifierHeader
-
filterQualifierHeader
-
buildQualifierHeader
-
createClient
- Throws:
SnException
-
buildLocalizedName
-
handleRequestException
protected void handleRequestException(String message, CSSearchSnSearchProvider.InterruptableRunnable handler) throws SnException - Throws:
SnException
-
handleRequestException
protected <T> T handleRequestException(String message, CSSearchSnSearchProvider.InterruptableSupplier<T> handler) throws SnException - Throws:
SnException
-
buildRequestExceptionMessage
-
getDestinationService
-
setDestinationService
-
getApiRegistryClientService
-
setApiRegistryClientService
-
getCommonI18NService
-
setCommonI18NService
-
getClientFactory
-
setClientFactory
-