|
|
-
RE: IndexBasedSpellChecker on multiple fieldsDyer, James 2011-10-20, 14:18
Here's approximately how I've got it set up to do essentially the same thing, in one of our production indexes:
----------- schema.xml has: <fieldType name="text_spelling" class="solr.TextField" positionIncrementGap="100"> { whitespaceanalyzer, stopwordfilter, wordfelimiterfilter, lowercasefilter ... or whatever your app needs } </fieldType> <field name="abstract"... /> <field name="subject" ... /> <field name="spelling_abstract_subject" type="text_spelling" indexed="true" stored="false" multiValued="true" omitNorms="true" /> <copyField source="abstract" dest="spelling_abstract_subject" /> <copyField source="subject" dest="spelling_abstract_subject" /> ------------- solrconfig.xml has: <requestHandler name="search_abstract_and_subject" class="solr.SearchHandler" > <lst name="defaults"> <str name="defType">edismax</str> <str name="echoParams">explicit</str> <float name="tie">0.01</float> <str name="qf">abstract subject</str> <str name="q.alt">*:*</str> <str name="spellcheck">true</str> <str name="spellcheck.dictionary">spellchecker_abstract_subject</str> <str name="spellcheck.count">10</str> <str name="spellcheck.collate">true</str> <str name="spellcheck.maxCollationTries">10</str> <str name="spellcheck.maxCollations">1</str> <str name="spellcheck.collateExtendedResults">true</str> </lst> <arr name="last-components"> <str>spellcheck</str> </arr> </requestHandler> <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> <str name="queryAnalyzerFieldType">text_spelling</str> <lst name="spellchecker"> <str name="name">spellchecker_abstract_subject</str> <str name="field">spelling_abstract_subject</str> <str name="fieldType">text_spelling</str> <str name="spellcheckIndexDir">./spellchecker</str> </lst> </searchComponent> --------------- You can then query across the 2 fields and get spell suggestions like this: q=query goes here&qt=search_abstract_and_subject Of course if this is the first query since startup/commit, unless you're building automatically somehow, add: &spellcheck.build=true James Dyer E-Commerce Systems Ingram Content Group (615) 213-4311 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Simone Tripodi Sent: Thursday, October 20, 2011 8:58 AM To: [EMAIL PROTECTED] Subject: Re: IndexBasedSpellChecker on multiple fields Hi James, sorry for the noise but I am not able to using the approach described, I'm sure I'm misconfiguring something. Basically, I have 2 fields, `abstract` and `subject`, and a field `master-dictionary` where the first to have ben copied. Then, in solrconfig.xml I configured the SpellCheckComponent which executes checks on master-dictionary field... When I start Solr, raises an exception: Oct 20, 2011 3:51:00 PM org.apache.solr.common.SolrException log SEVERE: org.apache.solr.common.SolrException: Specified dictionary does not exist. at org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:164) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:194) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129) at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368) at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:54) at org.apache.solr.core.SolrCore$3.call(SolrCore.java:1177) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) Can you help me please checking this schema[1]? Many thanks in advance, all the best! Simo [1] https://gist.github.com/1301194 http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Oct 19, 2011 at 9:39 AM, Simone Tripodi <[EMAIL PROTECTED]> wrote: |