org.apache.lucene.search.suggest
Class DocumentValueSourceDictionary

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

public class DocumentValueSourceDictionary
extends DocumentDictionary

Dictionary with terms and optionally payload information taken from stored fields in a Lucene index. Similar to DocumentDictionary, except it obtains the weight of the terms in a document based on a ValueSource.

NOTE:

In practice the ValueSource will likely be obtained using the lucene expression module. The following example shows how to create a ValueSource from a simple addition of two fields: Expression expression = JavascriptCompiler.compile("f1 + f2"); SimpleBindings bindings = new SimpleBindings(); bindings.add(new SortField("f1", SortField.Type.LONG)); bindings.add(new SortField("f2", SortField.Type.LONG)); ValueSource valueSource = expression.getValueSource(bindings);


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.search.suggest.DocumentDictionary
DocumentDictionary.DocumentInputIterator
 
Field Summary
 
Fields inherited from class org.apache.lucene.search.suggest.DocumentDictionary
payloadField, reader
 
Constructor Summary
DocumentValueSourceDictionary(IndexReader reader, String field, ValueSource weightsValueSource)
          Creates a new dictionary with the contents of the fields named field for the terms and uses the weightsValueSource supplied to determine the score.
DocumentValueSourceDictionary(IndexReader reader, String field, ValueSource weightsValueSource, String payload)
          Creates a new dictionary with the contents of the fields named field for the terms, payloadField for the corresponding payloads and uses the weightsValueSource supplied to determine the score.
 
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
 

Constructor Detail

DocumentValueSourceDictionary

public DocumentValueSourceDictionary(IndexReader reader,
                                     String field,
                                     ValueSource weightsValueSource,
                                     String payload)
Creates a new dictionary with the contents of the fields named field for the terms, payloadField for the corresponding payloads and uses the weightsValueSource supplied to determine the score.


DocumentValueSourceDictionary

public DocumentValueSourceDictionary(IndexReader reader,
                                     String field,
                                     ValueSource weightsValueSource)
Creates a new dictionary with the contents of the fields named field for the terms and uses the weightsValueSource supplied to determine the score.

Method Detail

getEntryIterator

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

Specified by:
getEntryIterator in interface Dictionary
Overrides:
getEntryIterator in class DocumentDictionary
Returns:
Iterator
Throws:
IOException


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