The most likely problem is forgetting to specify "spellcheck.build=true" on the 
first query since the last restart.  This builds the spell check dictionary 
used by the IndexBasedSpellChecker.  You should put this in a warming query or 
alternatively, specify build-on-commit or build-on-optimize.

It also looks like <str name="queryAnalyzerFieldType">textSpell</str> should 
probably be <str name="queryAnalyzerFieldType">textSpellPhrase</str> .

Finally, if you've done a build and changing the query Analyzer field type 
doesn't help, then you have to wonder if "dizeagar" exists somewhere in your 
data.  If the keyword exists in the spelling dictionary, Solr's spellchecker 
will not try to correct it.  See 
https://issues.apache.org/jira/browse/SOLR-2585 for a potential solution to 
this problem.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: tamanjit.bin...@yahoo.co.in [mailto:tamanjit.bin...@yahoo.co.in] 
Sent: Tuesday, August 02, 2011 12:30 AM
To: solr-user@lucene.apache.org
Subject: Spell Check

Hi All,
Facing some issue with Solr spellcheck. I got an index based dictionary
made.

My changes to *solrconfig.xml* are:

 <searchComponent name="spellcheck" class="solr.SpellCheckComponent">

    <str name="queryAnalyzerFieldType">textSpell</str>

      <lst name="spellchecker">
        <str name="classname">solr.IndexBasedSpellChecker</str>
        <str name="name">locSpell</str>
        <str name="field">locSpell</str>
        <str name="buildOnOptimize">true</str>
        <str name="spellcheckIndexDir">./spellchecker_loc_spell</str>
   </lst>
  </searchComponent>

  <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
    <lst name="locSpell">
        <str name="echoParams">explicit</str>
      
        <str name="spellcheck.dictionary">locSpell</str>
      <str name="spellcheck.onlyMorePopular">false</str>
      
      <str name="spellcheck.extendedResults">true</str>
      
      <str name="spellcheck.count">5</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
  </requestHandler>

I got my dictionary made to the folder spellchecker_loc_spell post an
optimize.

Now my changes to schema.xml are as follows:

New *fieldtype
*

<fieldType name="textSpellPhrase" class="solr.TextField"
        positionIncrementGap="100" stored="false" multiValued="true">
        <analyzer>
                <tokenizer class="solr.KeywordTokenizerFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
</fieldType>


my *fields*:

<field name="id" type="integer" indexed="true" stored="true"/>       
   <field name="locName" type="string" indexed="true" stored="true"/>       
   <field name="ct" type="integer" indexed="true" stored="true"/>       
   <field name="st" type="integer" indexed="true" stored="true"/>       
   <field name="ppd" type="string" indexed="true" stored="true"/>       
   <field name="ecd" type="string" indexed="true" stored="true"/>       
   <field name="city" type="text" indexed="true" stored="true"/>       
   <field name="state" type="text" indexed="true" stored="true"/>       
  <field name="locSpell" type="textSpellPhrase" indexed="true"
stored="false"/>       


 <defaultSearchField>locName</defaultSearchField>

 

         <copyField source="locName" dest="locSpell"/>





Now when I send the following command

http://SolrIP/MagicBricks/Locality/spellCheckCompRH/?q=Dizeagar&version=2.2&start=0&rows=10&indent=on&spellcheck=true&spellcheck.collate=true&spellcheck.extendedResults=true&spellcheck.count=3&spellcheck.dictionary=locSpell


I get the following result::


−
        <response>
−
        <lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<result name="response" numFound="0" start="0"/>
−
        <lst name="spellcheck">
−
        <lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>
</response>


Which should not be the case as it is wrongly spelled. Could anyone help me
out as to why am I getting this strange result that it is
correctlySpelled=true when it is not.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Spell-Check-tp3218037p3218037.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to