Example usage for org.apache.lucene.search.suggest.analyzing AnalyzingInfixSuggester lookup

List of usage examples for org.apache.lucene.search.suggest.analyzing AnalyzingInfixSuggester lookup

Introduction

In this page you can find the example usage for org.apache.lucene.search.suggest.analyzing AnalyzingInfixSuggester lookup.

Prototype

public List<LookupResult> lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight)
        throws IOException 

Source Link

Document

Lookup, without any context.

Usage

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.util.SuggestHelper.java

License:Apache License

public static List<Lookup.LookupResult> getSuggestions(AnalyzingInfixSuggester suggester,
        SuggestQuery suggestQuery) {// w  ww .j  av  a 2  s. c om
    try {
        long count = suggester.getCount();
        if (count > 0) {
            return suggester.lookup(suggestQuery.getText(), 10, true, false);
        } else {
            return Collections.emptyList();
        }
    } catch (Exception e) {
        throw new RuntimeException("could not handle Suggest query " + suggestQuery, e);
    }
}