Hmm, if I add:
<lst name="spellchecker">
<str name="classname">solr.FileBasedSpellChecker</str>
<str name="name">file</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="indexDir">./spellcheckerFile</str>
</lst>
To the examples declaration with the spellings.txt in the working
directory, it works for me.
Did you see any exceptions in your log?
On Jun 21, 2008, at 5:28 PM, Ronald K. Braun wrote:
I'm playing with the new code checked in under SOLR-572 (compliments
to everyone who worked on that!) and am having a couple of problems.
I'm running on Windows under Tomcat 5.5.25.
1. Just in comparison with the old SpellCheckerRequestHandler
methodology, when I specified in solrconfig.xml
<str name="sp.dictionary.indexDir">spell</str>
it built the spelling index under my solr/data directory as
c:/solr/data/spell. My solr home is configured in server.xml for
tomcat via:
<Context ... <Environment name="solr/home" type="java.lang.String"
value="C:/solr" override="true" /> </Context>
Under the new handler, setting the analogous (I think) parameter
<str name="spellcheckIndexDir">spell</str>
drops the spell index directory in my tomcat install directory
C:/Program Files/Apache Software Foundation/Tomcat 5.5/spell rather
than my solr/data. Should I configure my solr/home differently or can
this be made to work as before? The previous solr/data default on an
unqualified parameter value was a good one for keeping the index files
in the same location.
2. I'm having difficulty getting the FileBasedSpellChecker to work --
probably something silly on my part but given the above I thought
there might be container differences that haven't been vetted. Here
is my config:
<searchComponent name="spellcheck"
class="org.apache.solr.handler.component.SpellCheckComponent">
<lst name="defaults">
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<str name="queryAnalyzerFieldType">spell</str>
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">dictionary</str>
<str
name="classname">org.apache.solr.spelling.IndexBasedSpellChecker</str>
<str name="spellcheckIndexDir">spellchecker</str>
</lst>
<lst name="spellchecker">
<str
name="classname">org.apache.solr.spelling.FileBasedSpellChecker</str>
<str name="name">external</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="spellcheckIndexDir">spellchecker2</str>
</lst>
</searchComponent>
<queryConverter name="queryConverter"
class="org.apache.solr.spelling.SpellingQueryConverter"/>
<requestHandler name="/spellCheckCompRH"
class="org.apache.solr.handler.component.SearchHandler">
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
spellings.txt contains:
pizza
history
http://localhost/solr/spellCheckCompRH?spellcheck=true&q=pizzza&spellcheck.dictionary=default&spellcheck.build=true
gives me a suggestion of pizza, works wonderfully.
http://localhost/solr/spellCheckCompRH?spellcheck=true&q=pizzza&spellcheck.dictionary=external&spellcheck.build=true
gives me no suggestions. (Even with a more fleshed out dictionary
file, I haven't been able to get suggestions for any query I've tried
for the external dictionary.)
In both cases I can see the indexes getting rebuilt, and the size of
external index varies with the size of my spellings.txt, so I know
that the contents of spellings.txt is getting indexed (and peeking
into the segment files, I see the text entries). It is as if
everything is getting set up correctly but the actual index is coming
up empty at query time.
Any suggestions for what I might be doing wrong?
Thanks!
Ron
--------------------------
Grant Ingersoll
http://www.lucidimagination.com
Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ