Class QuerySuggesterProxy
java.lang.Object
de.cxp.ocs.smartsuggest.querysuggester.QuerySuggesterProxy
- All Implemented Interfaces:
Instrumentable
,QuerySuggester
,AutoCloseable
,org.apache.lucene.util.Accountable
public class QuerySuggesterProxy
extends Object
implements QuerySuggester, Instrumentable, org.apache.lucene.util.Accountable
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
Fields inherited from interface de.cxp.ocs.smartsuggest.querysuggester.QuerySuggester
DEFAULT_MAXIMUM_RESULTS
-
Constructor Summary
ConstructorsConstructorDescriptionQuerySuggesterProxy
(String indexName, String dataProviderName) names for logging and metricsQuerySuggesterProxy
(String indexName, String dataType, int maxSuggestionsPerCacheEntry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
instrument
(Optional<MeterRegistryAdapter> metricsRegistryAdapter, Iterable<io.micrometer.core.instrument.Tag> tags) Optional meter registry (adapter that gives access to the actual meter-registry).boolean
isReady()
long
long
return amount of records indexed into this QuerySuggester.void
updateQueryMapper
(@NonNull QuerySuggester newSuggester) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
Methods inherited from interface de.cxp.ocs.smartsuggest.querysuggester.QuerySuggester
destroy, suggest
-
Constructor Details
-
QuerySuggesterProxy
names for logging and metrics- Parameters:
indexName
- index namedataProviderName
- data provider name
-
QuerySuggesterProxy
-
-
Method Details
-
updateQueryMapper
public void updateQueryMapper(@NonNull @NonNull QuerySuggester newSuggester) throws org.apache.lucene.store.AlreadyClosedException - Throws:
org.apache.lucene.store.AlreadyClosedException
-
isReady
public boolean isReady()- Specified by:
isReady
in interfaceQuerySuggester
- Returns:
- true if ready to serve suggestions
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
suggest
public List<Suggestion> suggest(String term, int maxResults, Set<String> tags) throws SuggestException - Specified by:
suggest
in interfaceQuerySuggester
- Parameters:
term
- the term for which to get suggestionsmaxResults
- the maximum number of suggestions to returntags
- the group names used for filtering- Returns:
- A list of suggestions for the given term
- Throws:
SuggestException
-
instrument
public void instrument(Optional<MeterRegistryAdapter> metricsRegistryAdapter, Iterable<io.micrometer.core.instrument.Tag> tags) Description copied from interface:Instrumentable
Optional meter registry (adapter that gives access to the actual meter-registry). If not available, no metrics should be measured.- Specified by:
instrument
in interfaceInstrumentable
- Parameters:
metricsRegistryAdapter
- optional adaptertags
- these "standard" tags should be used for all added sensors. More tags can be added.
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsed
in interfaceorg.apache.lucene.util.Accountable
-
recordCount
public long recordCount()Description copied from interface:QuerySuggester
return amount of records indexed into this QuerySuggester.- Specified by:
recordCount
in interfaceQuerySuggester
- Returns:
- amount of indexed records
-