Interface SnSearchProvider<T extends AbstractSnSearchProviderConfiguration>
- All Known Implementing Classes:
AbstractSnSearchProvider,CSSearchSnSearchProvider
public interface SnSearchProvider<T extends AbstractSnSearchProviderConfiguration>
Abstraction for different search provider implementations.
-
Method Summary
Modifier and TypeMethodDescriptionvoidMakes sure that documents are stored on the index storage and are visible for queries.createIndex(SnContext context) Creates an index.createIndexerOperation(SnContext context, SnIndexerOperationType indexerOperationType, int totalItems) Creates a new indexer operation.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.getSearchProviderConfiguration(SnIndexConfiguration indexConfiguration) Returns the search provider configuration.search(SnContext context, String indexId, SnSearchQuery searchQuery) Executes a search query on a specific index.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.
-
Method Details
-
getSearchProviderConfiguration
Returns the search provider configuration.- Parameters:
indexConfiguration- - the index configuration- Returns:
- the search provider configuration
- Throws:
SnException- if an error occurs
-
exportConfiguration
void exportConfiguration(SnExportConfiguration exportConfiguration, List<Locale> locales) throws SnException Exports the configuration to the search provider.- Parameters:
exportConfiguration- - the export configuration- Throws:
SnException- if an error occurs
-
createIndex
Creates an index.- Parameters:
context- - the context- Throws:
SnException- if an error occurs
-
deleteIndex
Deletes an index (if it exists).- Parameters:
context- - the contextindexId- - the index id- Throws:
SnException- if an error occurs
-
createIndexerOperation
SnIndexerOperation createIndexerOperation(SnContext context, SnIndexerOperationType indexerOperationType, int totalItems) throws SnException Creates a new indexer operation.- Parameters:
context- - the context- Throws:
SnException- if an error occurs
-
updateIndexerOperationStatus
SnIndexerOperation updateIndexerOperationStatus(SnContext context, String indexerOperationId, SnIndexerOperationStatus status, String errorMessage) throws SnException Updates the status of an indexer operation.- Parameters:
context- - the contextstatus- - the statuserrorMessage- - the errorMessage- Throws:
SnException- if an error occurs
-
executeDocumentBatch
SnDocumentBatchResponse executeDocumentBatch(SnContext context, String indexId, SnDocumentBatchRequest documentBatchRequest, String indexerOperationId) throws SnException Executes a document batch.- 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
-
commit
Makes sure that documents are stored on the index storage and are visible for queries.- Parameters:
context- - the contextindexId- - the index id- Throws:
SnException- if an error occurs
-
search
SnSearchResult search(SnContext context, String indexId, SnSearchQuery searchQuery) throws SnException Executes a search query on a specific index.- Parameters:
context- - the contextindexId- - the index idsearchQuery- - the search query- Returns:
- the search result
- Throws:
SnException- if an error occurs
-
suggest
SnSuggestResult suggest(SnContext context, String indexId, SnSuggestQuery suggestQuery) throws SnException Executes a suggest query on a specific index.- Parameters:
context- - the contextindexId- - the index idsuggestQuery- - the suggest query- Returns:
- the suggest result
- Throws:
SnException- if an error occurs
-