Pravin,

When using the "file-based" spell checking option, it will try to give you 
suggestions for every query term regardless of whether or not thwy are in your 
spelling dictionary. Getting the behavior you want would seem to be a worthy 
enhancement, but I don't think it is currently supported.  You might be able to 
work around this if you could get your dictionary terms in the index and then 
use the "index-based" option instead.

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

-----Original Message-----
From: Pravin Agrawal [mailto:pravin_agra...@persistent.co.in] 
Sent: Saturday, December 17, 2011 4:51 AM
To: solr-user@lucene.apache.org
Cc: Tushar Adeshara
Subject: Spellchecker issue related to exact match of query in spellcheck index

Hi All,

I am trying to use file based spellchecker in solr 3.4 version and facing below 
issue.

My dictionary file contains following terms
<snip>
abcd
abcde
abcdef
abcdefg
</snip>

However, when checking spelling for abcd, it gives suggestion abcde even though 
the word abcd is present in dictionary file. Here is sample output.

http://10.88.36.192:8080/solr/spell?spellcheck.build=true&spellcheck=true&spellcheck.collate=true&q=abcd

<result name="response" numFound="0" start="0"/>
−
<lst name="spellcheck">
−
<lst name="suggestions">
−
<lst name="abcd">
<int name="numFound">1</int>
<int name="startOffset">0</int>
<int name="endOffset">4</int>
−
<arr name="suggestion">
<str>abcde</str>
</arr>
</lst>
<str name="collation">abcde</str>
</lst>
</lst>
</response>


I am expecting spell checker to give no suggestion if the word is already 
present in the dictionary, however it’s not the case as given above. I am using 
configuration as given below. Please let me know if I am missing something or 
its expected behavior. Also please let me know what should be done to get my 
desired output  (i.e. no suggestion if word is already in dictionary).

Thanks in advance.


Configuration:
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    <str name="queryAnalyzerFieldType">spellcheck_text</str>
    <lst name="spellchecker">
      <str name="classname">solr.FileBasedSpellChecker</str>
      <str name="name">default</str>
      <str name="comparatorClass">score</str>
      <str name="sourceLocation">spellings.txt</str>
      <str name="characterEncoding">UTF-8</str>
      <str name="spellcheckIndexDir">. /spellcheckerFile</str>
    </lst>
  </searchComponent>

  <requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
      <str name="spellcheck.onlyMorePopular">false</str>
      <str name="spellcheck.extendedResults">false</str>
      <str name="spellcheck.count">1</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
  </requestHandler>

Schema.xml has following fieldtype

<fieldType name="spellcheck_text" class="solr.TextField"
            positionIncrementGap="100">
            <analyzer>
                <tokenizer class="solr.WhitespaceTokenizerFactory"/>
                <filter class="solr.LowerCaseFilterFactory"/>
            </analyzer>
 </fieldType>


Thanks
Pravin



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

Reply via email to