2
我在synonym.txt文件中有拼写错误和更正的单词列表。我如何在solr中使用拼写建议?如何从solr的synonym.txt获取拼写建议?
例如synonyms.txt包含以下项目:
laptap => laptop
delll => dell
当我查询“laptap”到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中?我不想使用索引,因为我已经有了一个列表。任何想法?
FileBasedSpellChecker创建和使用一个拼写字典基于断平面文件是相同创建索引。我有拼写错误的单词到纠正单词的映射,我想使用这些映射,而不是在索引中搜索。我不知道如何使用FileBasedSpellChecker来使用我的文件作为建议。 – qwerty
没有意识到FileBasedSpellChecker从平面文件中创建拼写字典。 –