1、统计单词在某个字段出现的频率次数

    term frequency实现使用了function query. 

    例如统计‘公司’这个关键字在text这个字段中出现的次数
    在返回的时候进行计算统计,即在返回参数fl中设置为fl=id,freq:termfreq(text,'公司') 

    solr 统计频率(term frequency)

    http://localhost:8983/solr/test/select?fl=id,freq:termfreq(text,'公司')&indent=on&q=*:*&wt=json

    solr 统计频率(term frequency)

    对于多个term的Or查询,用sum进行统计,termfreq不支持phrase的统计。 
     freq:sum(termfreq(text,'中国'),termfreq(text,'公司'))

    solr 统计频率(term frequency)

    http://localhost:8983/solr/test/select?fl=freq:sum(termfreq(text,'中国'),termfreq(text,'公司'))&indent=on&q=*:*&wt=json

 

相关文章:

  • 2022-12-23
  • 2021-05-11
  • 2022-01-31
  • 2022-12-23
  • 2021-12-28
  • 2021-11-07
  • 2021-12-08
  • 2021-08-22
猜你喜欢
  • 2021-09-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-12-21
相关资源
相似解决方案