Setting Request Handler
Hi, I have a request handler in my solrconfig.xml : /spellCheckCompRH It utilizes the search component "spellcheck". When I specify following query in browser, I get correct spelling suggestions from the file dictionary. http://localhost:8080/solr/spellCheckCompRH/?q=SolrDocs&spellcheck.q=rel evancy&spellcheck=true&fl=title,score&spellcheck.dictionary=file Now I write a java program to achieve the same result: Code snippet . . server = new CommonsHttpSolrServer("http://localhost:8080/solr";); . . SolrQuery query = new SolrQuery(); query.setQuery("solr" ); query.setFields("*,score"); query.set("qt", spellCheckCompRH); query.set("spellcheck", "true"); query.set(SpellingParams.SPELLCHECK_DICT, "file"); query.set(SpellingParams.SPELLCHECK_Q , "solt"); . . QueryResponse rsp = server.query( query ); SolrDocumentList docs = rsp.getResults(); SpellCheckResponse srsp = rsp.getSpellCheckResponse(); I get documents for my query but I do not get any spelling suggestions. I think that the request handler is not getting set for the query correctly. Can someone please help. Best Regards, Mukta
Re: Setting Request Handler
Inline below... Also, though, you should note that the /spellCheckCompRH that is packaged with the example is not necessarily the best way to actually use the SpellCheckComponent. It is intended to be used as a component in whatever your MAIN Request Handler is, it merely shows the how of hooking it in. On Dec 10, 2008, at 7:51 AM, Deshpande, Mukta wrote: Hi, I have a request handler in my solrconfig.xml : /spellCheckCompRH It utilizes the search component "spellcheck". When I specify following query in browser, I get correct spelling suggestions from the file dictionary. http://localhost:8080/solr/spellCheckCompRH/?q=SolrDocs&spellcheck.q=rel evancy&spellcheck=true&fl=title,score&spellcheck.dictionary=file Now I write a java program to achieve the same result: Code snippet . . server = new CommonsHttpSolrServer("http://localhost:8080/solr";); . . SolrQuery query = new SolrQuery(); query.setQuery("solr" ); query.setFields("*,score"); query.set("qt", spellCheckCompRH); Is spellCheckCompRH a variable? Does it equal "/spellCheckCompRH"? query.set("spellcheck", "true"); query.set(SpellingParams.SPELLCHECK_DICT, "file"); query.set(SpellingParams.SPELLCHECK_Q , "solt"); . . QueryResponse rsp = server.query( query ); SolrDocumentList docs = rsp.getResults(); SpellCheckResponse srsp = rsp.getSpellCheckResponse(); I get documents for my query but I do not get any spelling suggestions. I think that the request handler is not getting set for the query correctly. Can someone please help. Best Regards, Mukta -- Grant Ingersoll Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ
RE: Setting Request Handler
Hi Grant, Thanks for the help. So now I can have multiple components, configured as "last-components" of standard request handler. Best Regards, Mukta -Original Message- From: Grant Ingersoll [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2008 9:25 PM To: solr-user@lucene.apache.org Subject: Re: Setting Request Handler Inline below... Also, though, you should note that the /spellCheckCompRH that is packaged with the example is not necessarily the best way to actually use the SpellCheckComponent. It is intended to be used as a component in whatever your MAIN Request Handler is, it merely shows the how of hooking it in. On Dec 10, 2008, at 7:51 AM, Deshpande, Mukta wrote: > Hi, > > I have a request handler in my solrconfig.xml : /spellCheckCompRH It > utilizes the search component "spellcheck". > > When I specify following query in browser, I get correct spelling > suggestions from the file dictionary. > > http://localhost:8080/solr/spellCheckCompRH/?q=SolrDocs&spellcheck.q=r > el evancy&spellcheck=true&fl=title,score&spellcheck.dictionary=file > > Now I write a java program to achieve the same result: > > Code snippet > > . > . > > server = new CommonsHttpSolrServer("http://localhost:8080/solr";); > . > . > SolrQuery query = new SolrQuery(); > query.setQuery("solr" ); > query.setFields("*,score"); > query.set("qt", spellCheckCompRH); Is spellCheckCompRH a variable? Does it equal "/spellCheckCompRH"? > > query.set("spellcheck", "true"); > query.set(SpellingParams.SPELLCHECK_DICT, "file"); > query.set(SpellingParams.SPELLCHECK_Q , "solt"); . > . > QueryResponse rsp = server.query( query ); SolrDocumentList docs = > rsp.getResults(); SpellCheckResponse srsp = > rsp.getSpellCheckResponse(); > > I get documents for my query but I do not get any spelling > suggestions. > I think that the request handler is not getting set for the query > correctly. > > Can someone please help. > > Best Regards, > Mukta -- Grant Ingersoll Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ