public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker
Refer to SpellCheckComponent for more details.
Modifier and Type | Field and Description |
---|---|
protected float |
accuracy |
static java.lang.String |
ACCURACY |
static java.lang.String |
COMPARATOR_CLASS |
static int |
DEFAULT_SUGGESTION_COUNT |
protected org.apache.lucene.search.spell.Dictionary |
dictionary |
static java.lang.String |
FIELD |
static java.lang.String |
FREQ_COMP |
protected org.apache.lucene.store.Directory |
index |
static java.lang.String |
INDEX_DIR |
protected java.lang.String |
indexDir |
static java.lang.String |
LOCATION |
static org.slf4j.Logger |
log |
static java.lang.String |
SCORE_COMP |
protected org.apache.lucene.search.spell.StringDistance |
sd |
protected java.lang.String |
sourceLocation |
protected org.apache.lucene.search.spell.SpellChecker |
spellChecker |
static java.lang.String |
SPELLCHECKER_ARG_NAME |
static java.lang.String |
STRING_DISTANCE |
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD_TYPE, fieldTypeName, name
Constructor and Description |
---|
AbstractLuceneSpellChecker() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.lucene.index.IndexReader |
determineReader(org.apache.lucene.index.IndexReader reader) |
float |
getAccuracy() |
java.lang.String |
getField() |
java.lang.String |
getFieldTypeName() |
java.lang.String |
getIndexDir() |
java.lang.String |
getSourceLocation() |
org.apache.lucene.search.spell.SpellChecker |
getSpellChecker() |
org.apache.lucene.search.spell.StringDistance |
getStringDistance() |
SpellingResult |
getSuggestions(java.util.Collection<org.apache.lucene.analysis.Token> tokens,
org.apache.lucene.index.IndexReader reader,
int count,
boolean onlyMorePopular,
boolean extendedResults)
Kept around for back compatibility purposes.
|
SpellingResult |
getSuggestions(SpellingOptions options)
Get suggestions for the given query.
|
java.lang.String |
init(NamedList config,
SolrCore core) |
protected void |
initIndex()
|
void |
reload(SolrCore core,
SolrIndexSearcher searcher)
Reloads the index.
|
build, getDictionaryName, getQueryAnalyzer, getSuggestions, getSuggestions, getSuggestions
public static final org.slf4j.Logger log
public static final java.lang.String SPELLCHECKER_ARG_NAME
public static final java.lang.String LOCATION
public static final java.lang.String INDEX_DIR
public static final java.lang.String ACCURACY
public static final java.lang.String STRING_DISTANCE
public static final java.lang.String COMPARATOR_CLASS
public static final java.lang.String SCORE_COMP
public static final java.lang.String FREQ_COMP
protected org.apache.lucene.search.spell.SpellChecker spellChecker
protected java.lang.String sourceLocation
protected org.apache.lucene.store.Directory index
protected org.apache.lucene.search.spell.Dictionary dictionary
public static final int DEFAULT_SUGGESTION_COUNT
protected java.lang.String indexDir
protected float accuracy
public static final java.lang.String FIELD
protected org.apache.lucene.search.spell.StringDistance sd
public java.lang.String init(NamedList config, SolrCore core)
init
in class SolrSpellChecker
public SpellingResult getSuggestions(java.util.Collection<org.apache.lucene.analysis.Token> tokens, org.apache.lucene.index.IndexReader reader, int count, boolean onlyMorePopular, boolean extendedResults) throws java.io.IOException
getSuggestions
in class SolrSpellChecker
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
- TODOjava.io.IOException
public SpellingResult getSuggestions(SpellingOptions options) throws java.io.IOException
SolrSpellChecker
SpellingResult.getSuggestions()
suggestions must be ordered by best suggestion first.
Note: This method is abstract in Solr 4.0 and beyond and is the recommended way of implementing the spell checker. For now,
it calls SolrSpellChecker.getSuggestions(java.util.Collection, org.apache.lucene.index.IndexReader, boolean, boolean)
.getSuggestions
in class SolrSpellChecker
options
- The SpellingOptions
to useSpellingResult
suggestionsjava.io.IOException
- if there is an error producing suggestionsprotected org.apache.lucene.index.IndexReader determineReader(org.apache.lucene.index.IndexReader reader)
public void reload(SolrCore core, SolrIndexSearcher searcher) throws java.io.IOException
SolrSpellChecker
reload
in class SolrSpellChecker
java.io.IOException
protected void initIndex() throws java.io.IOException
java.io.IOException
public float getAccuracy()
public java.lang.String getField()
public java.lang.String getFieldTypeName()
public java.lang.String getIndexDir()
public java.lang.String getSourceLocation()
public org.apache.lucene.search.spell.StringDistance getStringDistance()
public org.apache.lucene.search.spell.SpellChecker getSpellChecker()