public class Suggester extends SolrSpellChecker
| Modifier and Type | Field and Description |
|---|---|
protected SolrCore |
core |
protected org.apache.lucene.search.spell.Dictionary |
dictionary |
(package private) static SpellingResult |
EMPTY_RESULT |
private LookupFactory |
factory |
static java.lang.String |
LOCATION
Location of the source data - either a path to a file, or null for the
current IndexReader.
|
private static org.slf4j.Logger |
LOG |
protected org.apache.lucene.search.suggest.Lookup |
lookup |
static java.lang.String |
LOOKUP_IMPL
Fully-qualified class of the
Lookup implementation. |
protected java.lang.String |
lookupImpl |
protected org.apache.lucene.index.IndexReader |
reader |
protected java.lang.String |
sourceLocation |
static java.lang.String |
STORE_DIR
Name of the location where to persist the dictionary.
|
protected java.io.File |
storeDir |
protected float |
threshold |
static java.lang.String |
THRESHOLD_TOKEN_FREQUENCY
Minimum frequency of terms to consider when building the dictionary.
|
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name| Constructor and Description |
|---|
Suggester() |
| Modifier and Type | Method and Description |
|---|---|
void |
build(SolrCore core,
SolrIndexSearcher searcher)
(re)Builds the spelling index.
|
SpellingResult |
getSuggestions(java.util.Collection<org.apache.lucene.analysis.Token> tokens,
org.apache.lucene.index.IndexReader reader,
int count,
boolean onlyMorePopular,
boolean extendedResults)
Get suggestions for the given query.
|
SpellingResult |
getSuggestions(SpellingOptions options)
Get suggestions for the given query.
|
java.lang.String |
init(NamedList config,
SolrCore core) |
void |
reload(SolrCore core,
SolrIndexSearcher searcher)
Reloads the index.
|
getDictionaryName, getQueryAnalyzer, getSuggestions, getSuggestions, getSuggestionsprivate static final org.slf4j.Logger LOG
public static final java.lang.String LOCATION
public static final java.lang.String LOOKUP_IMPL
Lookup implementation.public static final java.lang.String THRESHOLD_TOKEN_FREQUENCY
public static final java.lang.String STORE_DIR
protected java.lang.String sourceLocation
protected java.io.File storeDir
protected float threshold
protected org.apache.lucene.search.spell.Dictionary dictionary
protected org.apache.lucene.index.IndexReader reader
protected org.apache.lucene.search.suggest.Lookup lookup
protected java.lang.String lookupImpl
protected SolrCore core
private LookupFactory factory
static SpellingResult EMPTY_RESULT
public java.lang.String init(NamedList config, SolrCore core)
init in class SolrSpellCheckerpublic void build(SolrCore core, SolrIndexSearcher searcher)
SolrSpellCheckerbuild in class SolrSpellCheckerpublic void reload(SolrCore core, SolrIndexSearcher searcher) throws java.io.IOException
SolrSpellCheckerreload in class SolrSpellCheckerjava.io.IOExceptionpublic 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
SolrSpellCheckerSpellingResult.getSuggestions() suggestions must be ordered by best suggestion first.getSuggestions in class SolrSpellCheckertokens - 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.IOExceptionpublic SpellingResult getSuggestions(SpellingOptions options) throws java.io.IOException
SolrSpellCheckerSpellingResult.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 SolrSpellCheckeroptions - The SpellingOptions to useSpellingResult suggestionsjava.io.IOException - if there is an error producing suggestions