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

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

Introduction

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

Prototype

@Override
    public long getCount() throws IOException 

Source Link

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) {/*from w  w  w  .ja  v a 2s  .  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);
    }
}