SpellCheckComponent
instead.
See also https://issues.apache.org/jira/browse/SOLR-474 and https://issues.apache.org/jira/browse/SOLR-485@Deprecated public class SpellCheckerRequestHandler extends RequestHandlerBase implements SolrCoreAware
The results identifies the original words echoing it as an entry with the name of "words" and original word value. It also identifies if the requested "words" is contained in the index through the use of the exist true/false name value. Examples of these output parameters in the standard output format is as follows:
<str name="words">facial</str> <str name="exist">true</str>
If a query string parameter of "extendedResults" is used, then each word within the "q" parameter (seperated by a space or +) will be iterated through the spell checker and will be wrapped in an NamedList. Each word will then get its own set of results: words, exists, and suggestions.
SpellCheckComponent
for alternatives.
Also note that multiword queries will be treated as a single term if extendedResults is false. This may or may not make sense depending on how the spelling field was indexed.
Examples of the use of the standard ouput (XML) without and with the use of the "extendedResults" parameter are as follows.
The following URL examples were configured with the solr.SpellCheckerRequestHandler named as "/spellchecker".
Without the use of "extendedResults" and one word spelled correctly: facial
http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&q=facial
<?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">6</int> </lst> <str name="words">facial</str> <str name="exist">true</str> <arr name="suggestions"> <str>faciale</str> <str>faucial</str> <str>fascial</str> <str>facing</str> <str>faciei</str> <str>facialis</str> <str>social</str> <str>facile</str> <str>spacial</str> <str>glacial</str> <str>marcial</str> <str>facies</str> <str>facio</str> </arr> </response>
Without the use of "extendedResults" and two words, one spelled correctly and one misspelled: facial salophosphoprotein
http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&q=facial+salophosphoprotein
<?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">18</int> </lst> <str name="words">facial salophosphoprotein</str> <str name="exist">false</str> <arr name="suggestions"> <str>sialophosphoprotein</str> </arr> </response>
With the use of "extendedResults" and two words, one spelled correctly and one misspelled: facial salophosphoprotein
http://.../spellchecker?indent=on&onlyMorePopular=true&accuracy=.6&suggestionCount=20&extendedResults=true&q=facial+salophosphoprotein
<?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">23</int> </lst> <lst name="result"> <lst name="facial"> <int name="frequency">1</int> <lst name="suggestions"> <lst name="faciale"><int name="frequency">1</int></lst> <lst name="faucial"><int name="frequency">1</int></lst> <lst name="fascial"><int name="frequency">1</int></lst> <lst name="facing"><int name="frequency">1</int></lst> <lst name="faciei"><int name="frequency">1</int></lst> <lst name="facialis"><int name="frequency">1</int></lst> <lst name="social"><int name="frequency">1</int></lst> <lst name="facile"><int name="frequency">1</int></lst> <lst name="spacial"><int name="frequency">1</int></lst> <lst name="glacial"><int name="frequency">1</int></lst> <lst name="marcial"><int name="frequency">1</int></lst> <lst name="facies"><int name="frequency">1</int></lst> <lst name="facio"><int name="frequency">1</int></lst> </lst> </lst> <lst name="salophosphoprotein"> <int name="frequency">0</int> <lst name="suggestions"> <lst name="sialophosphoprotein"><int name="frequency">1</int></lst> <lst name="phosphoprotein"><int name="frequency">1</int></lst> <lst name="phosphoproteins"><int name="frequency">1</int></lst> <lst name="alphalipoprotein"><int name="frequency">1</int></lst> </lst> </lst> </lst> </response>
SolrInfoMBean.Category
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ACCURACY
Deprecated.
|
protected SolrParams |
args
Deprecated.
|
protected static float |
DEFAULT_ACCURACY
Deprecated.
|
protected static float |
DEFAULT_DICTIONARY_THRESHOLD
Deprecated.
|
protected static boolean |
DEFAULT_EXTENDED_RESULTS
Deprecated.
|
protected static boolean |
DEFAULT_MORE_POPULAR
Deprecated.
|
protected static int |
DEFAULT_SUGGESTION_COUNT
Deprecated.
|
protected static java.lang.String |
DICTIONARY_PREFIX
Deprecated.
|
protected java.lang.String |
dirDescription
Deprecated.
|
protected static java.lang.String |
EXTENDED
Deprecated.
|
protected static java.lang.String |
INDEX_DIR
Deprecated.
|
private static org.slf4j.Logger |
log
Deprecated.
|
protected static java.lang.String |
POPULAR
Deprecated.
|
protected static java.lang.String |
PREFIX
Deprecated.
|
protected static java.lang.String |
QUERY_PREFIX
Deprecated.
|
protected static java.lang.String |
SOURCE_FIELD
Deprecated.
|
private org.apache.lucene.search.spell.SpellChecker |
spellChecker
Deprecated.
|
protected org.apache.lucene.store.Directory |
spellcheckerIndexDir
Deprecated.
|
protected static java.lang.String |
SUGGESTIONS
Deprecated.
|
protected java.lang.String |
termSourceField
Deprecated.
|
protected static java.lang.String |
THRESHOLD
Deprecated.
|
appends, defaults, handlerStart, httpCaching, initArgs, invariants, numErrors, numRequests, numTimeouts, totalTime
Constructor and Description |
---|
SpellCheckerRequestHandler()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Deprecated.
Simple one or two line description
|
protected org.apache.lucene.search.spell.Dictionary |
getDictionary(SolrQueryRequest req)
Deprecated.
Returns a dictionary to be used when building the spell-checker index.
|
java.net.URL[] |
getDocs()
Deprecated.
Documentation URL list.
|
java.lang.String |
getSource()
Deprecated.
CVS Source, SVN Source, etc
|
java.lang.String |
getSourceId()
Deprecated.
CVS Id, SVN Id, etc
|
java.lang.String |
getVersion()
Deprecated.
Simple common usage version, e.g.
|
void |
handleRequestBody(SolrQueryRequest req,
SolrQueryResponse rsp)
Deprecated.
Processes the following query string parameters: q, extendedResults, cmd rebuild,
cmd reopen, accuracy, suggestionCount, restrictToField, and onlyMorePopular.
|
void |
inform(SolrCore core)
Deprecated.
|
void |
init(NamedList args)
Deprecated.
Initializes the
SolrRequestHandler by creating three SolrParams named. |
private void |
rebuild(SolrQueryRequest req)
Deprecated.
Rebuilds the SpellChecker index using values from the
termSourceField from the
index pointed to by the current IndexSearcher . |
private void |
reopen()
Deprecated.
Reopens the SpellChecker index directory.
|
getCategory, getInitArgs, getName, getStatistics, handleRequest
private static org.slf4j.Logger log
private org.apache.lucene.search.spell.SpellChecker spellChecker
protected org.apache.lucene.store.Directory spellcheckerIndexDir
protected java.lang.String dirDescription
protected java.lang.String termSourceField
protected static final java.lang.String PREFIX
protected static final java.lang.String QUERY_PREFIX
protected static final java.lang.String DICTIONARY_PREFIX
protected static final java.lang.String SOURCE_FIELD
protected static final java.lang.String INDEX_DIR
protected static final java.lang.String THRESHOLD
protected static final java.lang.String ACCURACY
protected static final java.lang.String SUGGESTIONS
protected static final java.lang.String POPULAR
protected static final java.lang.String EXTENDED
protected static final float DEFAULT_ACCURACY
protected static final int DEFAULT_SUGGESTION_COUNT
protected static final boolean DEFAULT_MORE_POPULAR
protected static final boolean DEFAULT_EXTENDED_RESULTS
protected static final float DEFAULT_DICTIONARY_THRESHOLD
protected SolrParams args
public void init(NamedList args)
RequestHandlerBase
SolrRequestHandler
by creating three SolrParams
named.
Name | Description |
---|---|
defaults | Contains all of the named arguments contained within the list element named "defaults". |
appends | Contains all of the named arguments contained within the list element named "appends". |
invariants | Contains all of the named arguments contained within the list element named "invariants". |
<lst name="defaults"> <str name="echoParams">explicit</str> <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str> <str name="mm">2<-1 5<-2 6<90%</str> <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str> </lst> <lst name="appends"> <str name="fq">inStock:true</str> </lst> <lst name="invariants"> <str name="facet.field">cat</str> <str name="facet.field">manu_exact</str> <str name="facet.query">price:[* TO 500]</str> <str name="facet.query">price:[500 TO *]</str> </lst>
init
in interface SolrRequestHandler
init
in class RequestHandlerBase
args
- The NamedList
to initialize fromRequestHandlerBase.handleRequest(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
,
RequestHandlerBase.handleRequestBody(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
,
SolrPluginUtils.setDefaults(org.apache.solr.request.SolrQueryRequest, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams)
,
See also the example solrconfig.xml located in the Solr codebase (example/solr/conf).
public void inform(SolrCore core)
inform
in interface SolrCoreAware
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws java.lang.Exception
handleRequestBody
in class RequestHandlerBase
java.lang.Exception
protected org.apache.lucene.search.spell.Dictionary getDictionary(SolrQueryRequest req)
private void rebuild(SolrQueryRequest req) throws java.io.IOException, SolrException
termSourceField
from the
index pointed to by the current IndexSearcher
.
Any word appearing in less that thresh documents will not be added to the spellcheck index.java.io.IOException
SolrException
private void reopen() throws java.io.IOException
java.io.IOException
public java.lang.String getVersion()
SolrInfoMBean
getVersion
in interface SolrInfoMBean
getVersion
in class RequestHandlerBase
public java.lang.String getDescription()
SolrInfoMBean
getDescription
in interface SolrInfoMBean
getDescription
in class RequestHandlerBase
public java.lang.String getSourceId()
SolrInfoMBean
getSourceId
in interface SolrInfoMBean
getSourceId
in class RequestHandlerBase
public java.lang.String getSource()
SolrInfoMBean
getSource
in interface SolrInfoMBean
getSource
in class RequestHandlerBase
public java.net.URL[] getDocs()
SolrInfoMBean
Suggested documentation URLs: Homepage for sponsoring project, FAQ on class usage, Design doc for class, Wiki, bug reporting URL, etc...
getDocs
in interface SolrInfoMBean
getDocs
in class RequestHandlerBase