org.apache.solr.spelling
Class AbstractLuceneSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.AbstractLuceneSpellChecker
- Direct Known Subclasses:
- FileBasedSpellChecker, IndexBasedSpellChecker
public abstract class AbstractLuceneSpellChecker
- extends SolrSpellChecker
Abstract base class for all Lucene-based spell checking implementations.
Refer to SpellCheckComponent
for more details.
- Since:
- solr 1.3
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
public static final Logger LOG
SPELLCHECKER_ARG_NAME
public static final String SPELLCHECKER_ARG_NAME
- See Also:
- Constant Field Values
LOCATION
public static final String LOCATION
- See Also:
- Constant Field Values
INDEX_DIR
public static final String INDEX_DIR
- See Also:
- Constant Field Values
ACCURACY
public static final String ACCURACY
- See Also:
- Constant Field Values
STRING_DISTANCE
public static final String STRING_DISTANCE
- See Also:
- Constant Field Values
FIELD_TYPE
public static final String FIELD_TYPE
- See Also:
- Constant Field Values
field
protected String field
fieldTypeName
protected String fieldTypeName
spellChecker
protected org.apache.lucene.search.spell.SpellChecker spellChecker
sourceLocation
protected String sourceLocation
index
protected org.apache.lucene.store.Directory index
dictionary
protected org.apache.lucene.search.spell.Dictionary dictionary
DEFAULT_SUGGESTION_COUNT
public static final int DEFAULT_SUGGESTION_COUNT
- See Also:
- Constant Field Values
indexDir
protected String indexDir
accuracy
protected float accuracy
FIELD
public static final String FIELD
- See Also:
- Constant Field Values
AbstractLuceneSpellChecker
public AbstractLuceneSpellChecker()
init
public String init(org.apache.solr.common.util.NamedList config,
SolrCore core)
- Overrides:
init in class SolrSpellChecker
getSuggestions
public SpellingResult getSuggestions(Collection<org.apache.lucene.analysis.Token> tokens,
org.apache.lucene.index.IndexReader reader,
int count,
boolean onlyMorePopular,
boolean extendedResults)
throws IOException
- Description copied from class:
SolrSpellChecker
- Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer.
The
SpellingResult.getSuggestions() suggestions must be ordered by best suggestion first.
- Specified by:
getSuggestions in class SolrSpellChecker
- Parameters:
tokens - The Tokens to be spell checked.reader - The (optional) IndexReader. If there is not IndexReader, than extendedResults are not possiblecount - The maximum number of suggestions to returnonlyMorePopular - TODOextendedResults - TODO
- Throws:
IOException
determineReader
protected org.apache.lucene.index.IndexReader determineReader(org.apache.lucene.index.IndexReader reader)
reload
public void reload()
throws IOException
- Description copied from class:
SolrSpellChecker
- Reloads the index. Useful if an external process is responsible for building the spell checker.
- Specified by:
reload in class SolrSpellChecker
- Throws:
IOException
initIndex
protected void initIndex()
throws IOException
- Initialize the
index variable based on the indexDir. Does not actually create the spelling index.
- Throws:
IOException
getAccuracy
public float getAccuracy()
getField
public String getField()
getFieldTypeName
public String getFieldTypeName()
getIndexDir
public String getIndexDir()
getSourceLocation
public String getSourceLocation()
Copyright © 2009 Apache Software Foundation. All Rights Reserved.