我在solr中设置了建议者查询。我有以下设置,
太阳能配置
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">productSuggest</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">mySuggester</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
架构文件
<field name="SpecMaterial" type="string" uninvertible="true" default="SpecMaterial" indexed="true" stored="true"/>
<copyField source="SpecMaterial" dest="productSuggest" maxChars="30000"/>
<field name="productSuggest" type="textSuggest" default="productSuggest" stored="true" indexed="true"/>
<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
我在网址下面使用它
http://localhost:8983/solr/test_products/suggest?suggest=true&suggest.dictionary=mySuggester&wt=json&suggest.q=Medium
但是建议者返回0个结果,例如
{
"responseHeader":{
"status":0,
"QTime":0},
"suggest":{"mySuggester":{
"Medium":{
"numFound":0,
"suggestions":[]}
}
}
}
如果代码中有任何错误?为什么我们可以在提示器中使用copyfeild?