Class ElasticsearchSuggestDataProvider
- All Implemented Interfaces:
AbstractDataProvider<SuggestData>,SuggestDataProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is always called directly after instantiating the data provider with its no-args-constructor.longgetLastDataModTime(String indexName) Get the timestamp from when the data was modified the last time.booleanRespond with 'true' if this provider is generally able to provide data for the requested index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.cxp.ocs.smartsuggest.spi.SuggestDataProvider
getName
-
Constructor Details
-
ElasticsearchSuggestDataProvider
public ElasticsearchSuggestDataProvider()
-
-
Method Details
-
configure
Description copied from interface:AbstractDataProviderThis method is always called directly after instantiating the data provider with its no-args-constructor. The given configuration is passed through the QuerySuggestManager and might be empty.
If this data provider is unusable due to missing configuration, it should throw an Exception, so it will be dropped
- Specified by:
configurein interfaceAbstractDataProvider<SuggestData>- Parameters:
config- specific data provider configuration (never null, but may be empty)
-
hasData
Description copied from interface:AbstractDataProviderRespond with 'true' if this provider is generally able to provide data for the requested index. This is a quick check when initializing the suggesters, so it should not take too long.
It's also possible to return a static "true" here and do the expensive availability check at the getLastDataModTime method, which is called async. If getLastDataModTime returns a value < 0, data update are canceled as well.
- Specified by:
hasDatain interfaceAbstractDataProvider<SuggestData>- Parameters:
indexName- identifier for the requested data- Returns:
- if data is available
-
getLastDataModTime
Description copied from interface:AbstractDataProviderGet the timestamp from when the data was modified the last time. For every change of that timestamp, the data will be pulled and indexed into suggest index.
Setting the timestamp at the data is optional, but if it is set there, it MUST be the same timestamp, otherwise the data is rejected. This feature is used to avoid potential concurrency issues.
If data is not available at all, a value < 0 should be returned.
- Specified by:
getLastDataModTimein interfaceAbstractDataProvider<SuggestData>- Parameters:
indexName- identifier for the requested data- Returns:
- unix timestamp in millis
-
loadData
- Specified by:
loadDatain interfaceAbstractDataProvider<SuggestData>- Parameters:
indexName- identifier for the requested data- Returns:
- suggest data
- Throws:
IOException- if data couldn't be loaded
-