Package org.apache.solr.spelling.suggest
Class Suggester
- java.lang.Object
-
- org.apache.solr.spelling.SolrSpellChecker
-
- org.apache.solr.spelling.suggest.Suggester
-
public class Suggester extends SolrSpellChecker
-
-
Field Summary
Fields Modifier and Type Field Description protected SolrCorecoreprotected org.apache.lucene.search.spell.Dictionarydictionarystatic StringLOCATIONLocation of the source data - either a path to a file, or null for the current IndexReader.protected org.apache.lucene.search.suggest.Lookuplookupstatic StringLOOKUP_IMPLFully-qualified class of theLookupimplementation.protected StringlookupImplprotected org.apache.lucene.index.IndexReaderreaderprotected StringsourceLocationstatic StringSTORE_DIRName of the location where to persist the dictionary.protected FilestoreDirprotected floatthresholdstatic StringTHRESHOLD_TOKEN_FREQUENCYMinimum frequency of terms to consider when building the dictionary.-
Fields inherited from class org.apache.solr.spelling.SolrSpellChecker
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name
-
-
Constructor Summary
Constructors Constructor Description Suggester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(SolrCore core, SolrIndexSearcher searcher)(re)Builds the spelling index.SpellingResultgetSuggestions(SpellingOptions options)Get suggestions for the given query.Stringinit(NamedList config, SolrCore core)voidreload(SolrCore core, SolrIndexSearcher searcher)Reloads the index.-
Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
getAccuracy, getDictionaryName, getQueryAnalyzer, getStringDistance, isSuggestionsMayOverlap, mergeSuggestions
-
-
-
-
Field Detail
-
LOCATION
public static final String LOCATION
Location of the source data - either a path to a file, or null for the current IndexReader.- See Also:
- Constant Field Values
-
LOOKUP_IMPL
public static final String LOOKUP_IMPL
Fully-qualified class of theLookupimplementation.- See Also:
- Constant Field Values
-
THRESHOLD_TOKEN_FREQUENCY
public static final String THRESHOLD_TOKEN_FREQUENCY
Minimum frequency of terms to consider when building the dictionary.- See Also:
- Constant Field Values
-
STORE_DIR
public static final String STORE_DIR
Name of the location where to persist the dictionary. If this location is relative then the data will be stored under the core's dataDir. If this is null the storing will be disabled.- See Also:
- Constant Field Values
-
sourceLocation
protected String sourceLocation
-
storeDir
protected File storeDir
-
threshold
protected float threshold
-
dictionary
protected org.apache.lucene.search.spell.Dictionary dictionary
-
reader
protected org.apache.lucene.index.IndexReader reader
-
lookup
protected org.apache.lucene.search.suggest.Lookup lookup
-
lookupImpl
protected String lookupImpl
-
core
protected SolrCore core
-
-
Method Detail
-
init
public String init(NamedList config, SolrCore core)
- Overrides:
initin classSolrSpellChecker
-
build
public void build(SolrCore core, SolrIndexSearcher searcher) throws IOException
Description copied from class:SolrSpellChecker(re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.- Specified by:
buildin classSolrSpellChecker- Throws:
IOException
-
reload
public void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException
Description copied from class:SolrSpellCheckerReloads the index. Useful if an external process is responsible for building the spell checker.- Specified by:
reloadin classSolrSpellChecker- Throws:
IOException- If there is a low-level I/O error.
-
getSuggestions
public SpellingResult getSuggestions(SpellingOptions options) throws IOException
Description copied from class:SolrSpellCheckerGet suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. TheSpellingResult.getSuggestions()suggestions must be ordered by best suggestion first.- Specified by:
getSuggestionsin classSolrSpellChecker- Parameters:
options- TheSpellingOptionsto use- Returns:
- The
SpellingResultsuggestions - Throws:
IOException- if there is an error producing suggestions
-
-