IndexReader indexReader = null;
IndexSearcher indexSearch = null;
try{
indexReader = searchSuggestIndexer.openSuggestIndexReader();
indexSearch = new IndexSearcher(indexReader);
Hits hits = indexSearch.search(prefixQuery);
int maxNumCandidate = maxSuggestionSize;
if(idxReader != null && field != null){
maxNumCandidate = maxSuggestionSize * 10;
}
PriorityQueue<SuggestWord> suggestQueue = new PriorityQueue<SuggestWord>(maxNumCandidate);
for(int i = 0; i < hits.length() && i < maxNumCandidate; i++){
String sugWord = hits.doc(i).get("t");
// check if the 'sugWord' matches at least one doc in the
// source index database (idxReader)
if(idxReader != null && field != null){
int freq = idxReader.docFreq(new Term(field,sugWord));
if(freq > 0){