Example usage for org.apache.lucene.search.suggest DocumentDictionary DocumentDictionary

List of usage examples for org.apache.lucene.search.suggest DocumentDictionary DocumentDictionary

Introduction

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

Prototype

public DocumentDictionary(IndexReader reader, String field, String weightField, String payloadField,
        String contextsField) 

Source Link

Document

Creates a new dictionary with the contents of the fields named field for the terms, weightField for the weights that will be used for the the corresponding terms, payloadField for the corresponding payloads for the entry and contextsField for associated contexts.

Usage

From source file:com.shaie.suggest.ContextSuggestDemo.java

License:Apache License

private void buildSuggesterIndex() throws IOException {
    try (DirectoryReader reader = DirectoryReader.open(indexDir)) {
        final Dictionary dictionary = new DocumentDictionary(reader, "content", null, null, "username");
        suggester.build(dictionary);/*from  w w  w .jav a  2s. com*/
        suggester.refresh();
    }
}