我正在尝试使用solr来获取单词的频率。当我给这个查询: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.Ssolr统计字段中相同的单词。
例如;
字段文本包含; word2 word5 word7 word9 word2
。 Solr不会返回word2的计数编号2,而是返回1.它将为下面两个句子的word2计数返回1;
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"/>
感谢您的回答。我改变了字段来使多值参数为真,但它仍然返回错误的答案。 – yns
你可以发布你的schema.xml,所以也许我可以给你更多的信息? –
对不起,我不能把所有的schema.xml,但我编辑并把相关的部分。我希望它有帮助。 – yns