如果我在 SOLR 索引中搜索一个单词,我会得到包含该单词的文档的文档计数,但如果该单词在文档中包含更多次,则每个文档的总计数仍然为 1。
我需要计算每个返回的文档在字段中搜索单词的次数。
我在 Solr和SOLR词频中阅读了词频,并启用了词向量组件,但它不起作用。
我以这种方式配置了我的字段:
<field name="text_text" type="textgen" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
但是,如果我进行以下查询:
http://localhost:8888/solr/sources/select?q=text_text%3A%22Peter+Pan%22&fl=text_text&wt=json&indent=true&tv.tf
我没有任何计数:
{
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"fl":"text_text",
"tv.tf":"",
"indent":"true",
"q":"text_text:\"Peter Pan\"",
"wt":"json"}},
"response":{"numFound":12,"start":0,"docs":[
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"},
{
"text_text":"Text of the document"}]
}}
我看到“numFound”值为 12,但“彼得潘”一词在所有 12 个文档中包含 20 次。
你能帮我找出我错的地方吗?
非常感谢!