我在synonyms.txt文件中有一个拼写错误和更正的单词列表。我如何在solr中使用它来进行拼写建议?
例如,synonyms.txt包含以下条目:
laptap => laptop
delll => dell当我向solr服务器查询“翻拍”时,我应该得到“您的意思是:膝上型计算机吗?”的建议。
我知道schema.xml会是这样的:
<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StandardFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StandardFilterFactory"/>
</analyzer>
</fieldType>那solrconfig.xml呢?我不想使用索引,因为我已经有了一个列表。有什么想法吗?
发布于 2011-09-13 01:08:06
更新以满足不从平面文件创建索引/字典的要求:
先前的建议:
这里有一篇关于在Solr中设置拼写检查的好文章,其中包括如何配置基于文件的拼写检查。您应该能够这样做,并将样例配置中的spellings.txt文件替换为您的synonyms.txt文件。
使用Apache和Solr开始拼写检查
https://stackoverflow.com/questions/7395615
复制相似问题