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 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 String |
DICTIONARY_PREFIX
Deprecated.
|
protected String |
dirDescription
Deprecated.
|
protected static String |
EXTENDED
Deprecated.
|
protected static String |
INDEX_DIR
Deprecated.
|
protected static String |
POPULAR
Deprecated.
|
protected static String |
PREFIX
Deprecated.
|
protected static String |
QUERY_PREFIX
Deprecated.
|
protected static String |
SOURCE_FIELD
Deprecated.
|
protected Directory |
spellcheckerIndexDir
Deprecated.
|
protected static String |
SUGGESTIONS
Deprecated.
|
protected String |
termSourceField
Deprecated.
|
protected static String |
THRESHOLD
Deprecated.
|
appends, defaults, httpCaching, initArgs, invariants
Constructor and Description |
---|
SpellCheckerRequestHandler()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Deprecated.
Simple one or two line description
|
protected Dictionary |
getDictionary(SolrQueryRequest req)
Deprecated.
Returns a dictionary to be used when building the spell-checker index.
|
URL[] |
getDocs()
Deprecated.
Documentation URL list.
|
String |
getSource()
Deprecated.
CVS Source, SVN Source, etc
|
String |
getSourceId()
Deprecated.
CVS Id, SVN Id, etc
|
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. |
getCategory, getInitArgs, getName, getStatistics, handleRequest
protected Directory spellcheckerIndexDir
protected String dirDescription
protected String termSourceField
protected static final String PREFIX
protected static final String QUERY_PREFIX
protected static final String DICTIONARY_PREFIX
protected static final String SOURCE_FIELD
protected static final String INDEX_DIR
protected static final String THRESHOLD
protected static final String ACCURACY
protected static final String SUGGESTIONS
protected static final String POPULAR
protected static final 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 Exception
handleRequestBody
in class RequestHandlerBase
Exception
protected Dictionary getDictionary(SolrQueryRequest req)
public String getVersion()
SolrInfoMBean
getVersion
in interface SolrInfoMBean
getVersion
in class RequestHandlerBase
public String getDescription()
SolrInfoMBean
getDescription
in interface SolrInfoMBean
getDescription
in class RequestHandlerBase
public String getSourceId()
SolrInfoMBean
getSourceId
in interface SolrInfoMBean
getSourceId
in class RequestHandlerBase
public String getSource()
SolrInfoMBean
getSource
in interface SolrInfoMBean
getSource
in class RequestHandlerBase
public 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