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
  • Constructor Details

    • QuerySuggesterProxy

      public QuerySuggesterProxy(String indexName, String dataProviderName)
      names for logging and metrics
      Parameters:
      indexName - index name
      dataProviderName - data provider name
    • QuerySuggesterProxy

      public QuerySuggesterProxy(String indexName, String dataType, int maxSuggestionsPerCacheEntry)
  • 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 interface QuerySuggester
      Returns:
      true if ready to serve suggestions
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • suggest

      public List<Suggestion> suggest(String term, int maxResults, Set<String> tags) throws SuggestException
      Specified by:
      suggest in interface QuerySuggester
      Parameters:
      term - the term for which to get suggestions
      maxResults - the maximum number of suggestions to return
      tags - 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 interface Instrumentable
      Parameters:
      metricsRegistryAdapter - optional adapter
      tags - these "standard" tags should be used for all added sensors. More tags can be added.
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.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 interface QuerySuggester
      Returns:
      amount of indexed records