Class LuceneQuerySuggester

    • Constructor Detail

      • LuceneQuerySuggester

        public LuceneQuerySuggester​(@NonNull
                                    @NonNull Path indexFolder,
                                    @NonNull
                                    @NonNull Locale locale,
                                    @NonNull
                                    @NonNull ModifiedTermsService modifiedTermsService,
                                    org.apache.lucene.analysis.CharArraySet stopWords)
        Constructor.
        Parameters:
        indexFolder - the parent folder for the specific suggesters
        locale - the locale of the client. Used to load the proper stopwords
        modifiedTermsService - service that provides mappings for modified terms
        stopWords - optional set of stopwords. may be null
    • Method Detail

      • 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
        tags - these "standard" tags should be used for all added sensors. More tags can be added.
      • isReady

        public boolean isReady()
        Specified by:
        isReady in interface QuerySuggester
        Returns:
        true if ready to serve suggestions
      • suggest

        public List<Suggestion> suggest​(String term,
                                        int maxResults,
                                        Set<String> tags)
        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
      • destroy

        public void destroy()
        Description copied from interface: QuerySuggester
        Destroys any resources created by this suggester
        Specified by:
        destroy in interface QuerySuggester
      • 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