List of usage examples for org.apache.lucene.search.suggest.analyzing AnalyzingInfixSuggester lookup
public List<LookupResult> lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight) throws IOException
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); } }