org.apache.lucene.search.suggest
Class FileDictionary

java.lang.Object
  extended by org.apache.lucene.search.suggest.FileDictionary
All Implemented Interfaces:
Dictionary

public class FileDictionary
extends Object
implements Dictionary

Dictionary represented by a text file.

Format allowed: 1 entry per line:
An entry can be:

where the default fieldDelimiter is "\t"

NOTE:

Example:
word1 word2 TAB 100 TAB payload1
word3 TAB 101
word4 word3 TAB 102


Field Summary
static String DEFAULT_FIELD_DELIMITER
          Tab-delimited fields are most common thus the default, but one can override this via the constructor
 
Constructor Summary
FileDictionary(InputStream dictFile)
          Creates a dictionary based on an inputstream.
FileDictionary(InputStream dictFile, String fieldDelimiter)
          Creates a dictionary based on an inputstream.
FileDictionary(Reader reader)
          Creates a dictionary based on a reader.
FileDictionary(Reader reader, String fieldDelimiter)
          Creates a dictionary based on a reader.
 
Method Summary
 InputIterator getEntryIterator()
          Returns an iterator over all the entries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FIELD_DELIMITER

public static final String DEFAULT_FIELD_DELIMITER
Tab-delimited fields are most common thus the default, but one can override this via the constructor

See Also:
Constant Field Values
Constructor Detail

FileDictionary

public FileDictionary(InputStream dictFile)
Creates a dictionary based on an inputstream. Using DEFAULT_FIELD_DELIMITER as the field seperator in a line.

NOTE: content is treated as UTF-8


FileDictionary

public FileDictionary(Reader reader)
Creates a dictionary based on a reader. Using DEFAULT_FIELD_DELIMITER as the field seperator in a line.


FileDictionary

public FileDictionary(Reader reader,
                      String fieldDelimiter)
Creates a dictionary based on a reader. Using fieldDelimiter to seperate out the fields in a line.


FileDictionary

public FileDictionary(InputStream dictFile,
                      String fieldDelimiter)
Creates a dictionary based on an inputstream. Using fieldDelimiter to seperate out the fields in a line.

NOTE: content is treated as UTF-8

Method Detail

getEntryIterator

public InputIterator getEntryIterator()
Description copied from interface: Dictionary
Returns an iterator over all the entries

Specified by:
getEntryIterator in interface Dictionary
Returns:
Iterator


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.