org.eaglei.solr.suggest
Class LuceneAutoSuggestProvider

java.lang.Object
  extended by org.eaglei.solr.suggest.LuceneAutoSuggestProvider
All Implemented Interfaces:
org.eaglei.lexical.SuggestionProvider, LuceneIndexSchema, LuceneAutoSuggestIndexSchema

public class LuceneAutoSuggestProvider
extends java.lang.Object
implements LuceneAutoSuggestIndexSchema, org.eaglei.lexical.SuggestionProvider

Clients of this class must create and populate the Lucene Directory according to the schema in LuceneAutoSuggestIndexSchema before using this provider.

Author:
rfrost, tbashor

Field Summary
static float DEFAULT_SCORE_THRESHHOLD
          Default score threshold
static int MAX_FRAGMENTS
          Max number of fragments for highlighting
 
Fields inherited from interface org.eaglei.solr.suggest.LuceneAutoSuggestIndexSchema
FIELD_IS_INSTANCE, FIELD_IS_VALUE_OF, FIELD_ROOT_TYPE, FIELD_TYPE
 
Fields inherited from interface org.eaglei.solr.LuceneIndexSchema
FIELD_ENTITY_LABEL, FIELD_INSTITUTION_URI, FIELD_LABEL, FIELD_STUB, FIELD_URI
 
Constructor Summary
LuceneAutoSuggestProvider(org.apache.lucene.analysis.Analyzer queryAnalyzer, org.apache.lucene.analysis.Analyzer indexAnalyzer, org.apache.lucene.store.Directory directory)
          Creates a new ModelEntityExtractor.
LuceneAutoSuggestProvider(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.store.Directory directory)
          Creates a new ModelEntityExtractor that uses the same analyzer for indexing and querying.
 
Method Summary
 void setFuzzyRewrite(boolean fuzzyRewrite)
          Sets the flag that controls whether the original query is rewritten to a "fuzzy" form (levenstein edit distance) if the original execution fails to retrieve results.
 void setScoreThreshold(float threshold)
          Sets the Lucene score threshold.
 java.util.List<org.eaglei.lexical.EntityMatch> suggest(org.eaglei.lexical.EntityMatchRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SCORE_THRESHHOLD

public static final float DEFAULT_SCORE_THRESHHOLD
Default score threshold

See Also:
Constant Field Values

MAX_FRAGMENTS

public static final int MAX_FRAGMENTS
Max number of fragments for highlighting

See Also:
Constant Field Values
Constructor Detail

LuceneAutoSuggestProvider

public LuceneAutoSuggestProvider(org.apache.lucene.analysis.Analyzer analyzer,
                                 org.apache.lucene.store.Directory directory)
                          throws java.io.IOException
Creates a new ModelEntityExtractor that uses the same analyzer for indexing and querying.

Parameters:
analyzer - Analyzer used for both querying and indexing
directory - Lucene directory. This directory should already contain a valid index populated according to the schema in LuceneIndexer.
Throws:
java.io.IOException - Thrown if there is an error building the index.

LuceneAutoSuggestProvider

public LuceneAutoSuggestProvider(org.apache.lucene.analysis.Analyzer queryAnalyzer,
                                 org.apache.lucene.analysis.Analyzer indexAnalyzer,
                                 org.apache.lucene.store.Directory directory)
                          throws java.io.IOException
Creates a new ModelEntityExtractor.

Parameters:
queryAnalyzer - Analyzer to use for query execution.
indexAnalyzer - Analyzer to use for index creation.
directory - Lucene directory. This directory should already contain a valid index populated according to the schema in LuceneIndexer.
Throws:
java.io.IOException - Thrown if there is an error building the index.
Method Detail

setFuzzyRewrite

public void setFuzzyRewrite(boolean fuzzyRewrite)
Sets the flag that controls whether the original query is rewritten to a "fuzzy" form (levenstein edit distance) if the original execution fails to retrieve results.

Parameters:
fuzzyRewrite - True for fuzzy rewrite.

setScoreThreshold

public void setScoreThreshold(float threshold)
Sets the Lucene score threshold. Matches with a score of less than this will not be returned. Set to <= 0 to return all matches.

Parameters:
threshold - The threshold.

suggest

public java.util.List<org.eaglei.lexical.EntityMatch> suggest(org.eaglei.lexical.EntityMatchRequest request)
                                                       throws java.io.IOException
Specified by:
suggest in interface org.eaglei.lexical.SuggestionProvider
Parameters:
request -
Returns:
Throws:
java.io.IOException


Copyright © 2009-2011 Eagle-I. All Rights Reserved.