suggest部分比较简单,只给出相应的PrefixQuery查询,拿出相应的条目,schema.xml中只有两个字段:
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="weight" type="float" indexed="true" stored="true" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>id</defaultSearchField>
对应更新的是主题词和对应影响因子的csv文件:
curl http://192.168.1.21:8983/solr/suggest/update/csv?commit=true --data-binary @en_suggest.csv -H ‘Content-type:text/plain; charset=utf-8‘
curl http://192.168.1.21:8983/solr/suggest/update/csv?commit=true --data-binary @zh_suggest.csv -H ‘Content-type:text/plain; charset=utf-8‘
进行prefixquery之后按照weight降序排列:
http://192.168.1.21:8983/solr/suggest/select/?q=%E7%94%B2*&rows=5&sort=weight+desc
得到如下: