Question

I am using FileBasedDictionaryIndex. I have two files. I have set up searchcomponent in solrconfig with Standard request handler and also defined a new field type in schema with appropriate filters.

I want to know whether solr automatically builds index for the dictionary or do I need to write any code (I am using Java) for build Dictionary Index.

Was it helpful?

Solution

SpellCheckComponent can be configured to automatically (re)build indices based on fields in Solr index when a commit or an optimize is done. See http://wiki.apache.org/solr/SpellCheckComponent

UPDATE: I edit this post after seeing the exchange about this topic on SOLR user list: the FileBasedDictionaryIndex needs a spellchecker.build command issued at least once (basically ignore the build / optimize trigger defined on solrconfig.xml)

OTHER TIPS

I entered this url to build spell check index.

http://localhost:8080/solr/select?   q=*:*&spellcheck=true&spellcheck.build=true&buildOnCommit=true

I got this result

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="spellcheck">true</str>
<str name="q">*:*</str>
<str name="buildOnCommit">true</str>
<str name="spellcheck.build">true</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
</response>

I am not getting why my index is not built.

My solrconfig is as below - 

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<str name="queryAnalyzerFieldType">text_spell</str>

<lst name="spellchecker">
   <str name="classname">solr.FileBasedSpellChecker</str>
   <str name="name">file1</str>
   <str name="sourceLocation">places.txt</str>

   <str name="characterEncoding">UTF-8</str>
   <str name="spellcheckIndexDir">./spellchecker1</str>
   <str name="buildOnCommit">true</str>
 </lst>

 <lst name="spellchecker">
   <str name="classname">solr.FileBasedSpellChecker</str>
   <str name="name">file2</str>

    <str name="sourceLocation">US.dic</str>
   <str name="characterEncoding">UTF-8</str>
   <str name="spellcheckIndexDir">./spellchecker2</str>
   <str name="buildOnCommit">true</str>
 </lst>

</searchComponent>

Please correct me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top