Example usage for org.apache.lucene.search.suggest.fst WFSTCompletionLookup getCount

List of usage examples for org.apache.lucene.search.suggest.fst WFSTCompletionLookup getCount

Introduction

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

Prototype

@Override
    public long getCount() 

Source Link

Usage

From source file:org.opengrok.suggest.SuggesterProjectData.java

License:Open Source License

private WFSTCompletionLookup build(final IndexReader indexReader, final String field) throws IOException {
    WFSTInputIterator iterator = new WFSTInputIterator(
            new LuceneDictionary(indexReader, field).getEntryIterator(), indexReader, field,
            getSearchCounts(field));//from  w  w w  .  ja  v  a2  s . c o  m

    WFSTCompletionLookup lookup = createWFST();
    lookup.build(iterator);

    double averageLength = (double) iterator.termLengthAccumulator / lookup.getCount();
    averageLengths.put(field, averageLength);

    return lookup;
}