不幸的是,如果不对schema应用任何修改就无法完成,因为solr.StrField不会保留术语频率信息。
报价从schema.xml中:
...
1.2: omitTermFreqAndPositions attribute introduced, true by default
except for text fields.
...
但是,如果你可以申请一些变化,那么下面的工作(在Solr的4.5.1测试):
1)对模式进行以下更改之一:
- 将字段更改为text_general (或任何solr.TextField字段);
<field name="point_statusses" type="text_general" indexed="true" stored="true" multiValued="true" />
- OR添加
omitTermFreqAndPositions="false"
到point_statusses定义:
<field name="point_statusses" type="string" indexed="true" stored="true" multiValued="true" omitTermFreqAndPositions="false"/>
2)通过术语频率滤波器。 例子:
{!frange l=2 u=2}termfreq(point_statusses,'FREE')
或2至3 '免费' point_statusses:
{!frange l=2 u=3}termfreq(point_statusses,'FREE')
最后Solr的查询可能恰好具有2 '免费' point_statusses
搜索文件看起来像这样:
http://localhost:8983/solr/stack20746538/select?q=*:*&fq={!frange l=2 u=3}termfreq(point_statusses,'FREE')
您可以从_schema.xml_和_solrconfig.xml_中的查询处理程序中添加'fields'和'types'吗? – cheffe
完成希望你能帮忙;) – Xavier