在 solrconfig.xml ,
中添加了一个搜索组件,如下所示
<searchComponent class="solr.SuggestComponent" name="suggest">
<lst name="suggester">
<str name="name">suggest</str>
<str name="lookupImpl">FSTLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">suggestions</str> //indexed field of type textspell
<str name="weightField">price</str><!--
<float name="threshold">0.005</float> -->
<str name="buildOnCommit">true</str>
<str name="suggestAnalyzerFieldType">string</str>
</lst>
</searchComponent>
然后添加了一个请求处理程序来处理如下建议,
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">suggest</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr></requestHandler>
在 schema.xml 中添加了名为field
的{{1}},
suggestions
<field name="suggestions" type="textSpell" indexed="true" stored="false" multiValued="true" />
field type
的定义为,
textSpell
在我查询时<fieldType class="solr.TextField" name="textSpell" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer></fieldType>
和restarting
特定reindexing
名为core
之后,
libshelf
结果是,
http://localhost:8983/solr/libshelf/suggest?suggest=true&suggest.build=true&suggest.dictionary=suggest&wt=json&suggest.q=c
自提法的{
"responseHeader": {
"status": 0,
"QTime": 32
},
"command": "build",
"suggest": {
"suggest": {
"c": {
"numFound": 0,
"suggestions": []
}
}
}}
基于dicionaries
字段indexed
和pagecontent
以来已创建了两个pagetitle
到copyfields
seed
如下,
suggesters
如何解决此问题?