我正在开发一个需要我第一次使用 Solr 的应用程序。我进行了设置,索引了正确的数据,并根据需要进行了查询,但我似乎无法让拼写检查组件正常工作。无论我查询什么,拼写检查器都不会返回任何建议。我已经包含了我的 solrconfig 和 schema.xml 的相关部分。
架构.xml
<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
<analyzer type="index">
<charFilter class="solr.HTMLStripCharFilterFactory"/>
<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>
<!-- CUT -->
<field name="spell" type="textSpell" indexed="true" stored="true" />
solrconfig.xml
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck.onlyMorePopular">false</str>
<!-- <str name="spellcheck.extendedResults">false</str> -->
<str name="spellcheck.count">3</str>
<str name="qf">
frontlist_flapcopy^0.5 title^2.0 subtitle^1.0 series^1.5 author^3.0 frontlist_ean^6.0
</str>
<str name="pf">
frontlist_flapcopy^0.5 title^2.0 subtitle^1.0 series^1.5 author^3.0 frontlist_ean^6.0
</str>
<str name="fl">
title,subtitle,series,author,eans,formats,prices,frontlist_ean,onsaledate,imprint,frontlist_flapcopy
</str>
<str name="mm">
2<-1 5<-2 6<90%
</str>
<int name="ps">100</int>
<bool name="hl">true</bool>
<str name="q.alt">*:*</str>
<str name="hl.fl">title,subtitle,series,author,frontlist_flapcopy</str>
<str name="f.title.hl.fragsize">0</str>
<str name="f.title.hl.alternateField">title</str>
<str name="f.subtitle.hl.fragsize">0</str>
<str name="f.subtitle.hl.alternateField">url</str>
<str name="f.series.hl.fragsize">0</str>
<str name="f.series.hl.alternateField">url</str>
<str name="f.author.hl.fragsize">0</str>
<str name="f.author.hl.alternateField">url</str>
<str name="f.frontlist_flapcopy.hl.fragsize">0</str>
<str name="f.frontlist_flapcopy.hl.alternateField">url</str>
<str name="echoParams">explicit</str>
<float name="accuracy">0.7</float>
</lst>
<lst name="appends">
<str name="fq">forsaleinusa:true</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
<!-- CUT -->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="name">default</str>
<str name="classname">solr.IndexBasedSpellChecker</str>
<str name="field">spell</str>
<str name="spellcheckIndexDir">/path/to/my/spell/index</str>
<str name="accuracy">0.7</str>
<float name="thresholdTokenFrequency">.0001</float>
</lst>
<lst name="spellchecker">
<str name="name">jarowinkler</str>
<str name="classname">solr.IndexBasedSpellChecker</str>
<str name="field">spell</str>
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
<str name="spellcheckIndexDir">/path/to/my/spell/index</str>
</lst>
<str name="queryAnalyzerFieldType">textSpell</str>
</searchComponent>
当我去http://localhost:8983/solr/select/?q=query&spellcheck.build=true
查看/path/to/my/spell/index 中生成的文件时,有一个segments.gen 和一个segments_1,它们都只包含几个字节的二进制数据。然后,当我输入查询并附&spellcheck=true
加到查询字符串时,无论我的查询如何,我都没有收到任何建议:
<lst name="spellcheck">
<lst name="suggestions"/>
</lst>
知道这里发生了什么吗?