我正在尝试使用 solr 获取单词的频率。当我给出这个查询时:
localSolr/solr/select?q=someQuery&rows=0&facet=true&facet.field=content&wt=xml
solr 给我类似的频率;
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="content">
<int name="word1">24</int>
<int name="word2">12</int>
<int name="word3">8</int>
但当我数着单词的时候;我发现word2的实际计数是13。Solr将字段中相同的单词计数为1。
例如;
字段文本组成;word2 word5 word7 word9 word2
。 Solr 不会返回 word2 的计数数字 2,而是返回 1。对于下面两个句子,它返回 1 作为 word2 的计数;
word2 word10 word11 word12
word2 word9 word7 word2 word23
所以频率返回错误。我已经检查了方面字段,但没有找到合适的参数。我该如何修复它以便计算句子中的相同单词?
编辑 :
schema.xml 的相关部分:
<fieldType name="text_tr" class="solr.TextField" positionIncrementGap="100">
<field name="content" type="text_tr" stored="true" indexed="true" multiValued="true"/>
<copyField source="content" dest="text"/>
<field name="text" type="text_tr" stored="false" indexed="true" multiValued="true"/>
如果您要分面的字段是多值的,则分面中的每个单词都会获得正确的计数
我忘了提一件事:术语向量分量会带你去你需要的地方
在查询中,tv.tf将为您提供每个术语的术语频率,同时tv.fl告诉 solr 应在哪些字段上计算频率
NB这会让你的索引时间比现在慢(又名:你必须尝试一下)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)