solr TermsComponent数据统计

1.solrconfig.xml添加如下配置:

<searchComponent name="terms" class="solr.TermsComponent"/>

  <!-- A request handler for demonstrating the terms component -->
  <requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
        <bool name="terms">true</bool>
        <bool name="distrib">false</bool>
    </lst>
    <arr name="components">
        <str>terms</str>
    </arr>
  </requestHandler>

2.URL访问

http://localhost:8983/solr/test_core/terms?q=*%3A*&wt=json&indent=true&terms.fl=field

返回结果:默认按结果的出现频率倒序排序。

{
  "responseHeader":{
    "status":0,
    "QTime":31},
  "terms":{
    "field":[
      "新闻图片",4262,
      "专题",4261,
      "设计",3229,
      "凤凰网",2020,
      "凤凰新媒体",1980,
      "创意",1610,
      "艺术",1170,
      "时尚",1128,
      "nba",1025,
      "新闻",940]
    }
}

相关参数说明

  • erms={true|false} - Turn on the TermsComponent

  • terms.fl={FIELD NAME} - Required. The name of the field to get the terms from. May be specified multiple times as terms.fl=field1&terms.fl=field2...

  • terms.lower={The lower bound term} - Optional. The term to start at. If not specified, the empty string is used, meaning start at the beginning of the field.
  • terms.lower.incl={true|false} - Optional. Include the lower bound term in the result set. Default is true.
  • terms.mincount=<Integer> - Optional. The minimum doc frequency to return in order to be included. Results are inclusive of the mincount (i.e. >= mincount)

  • terms.maxcount=<Integer> - Optional. The maximum doc frequency. Default is -1 to have no upper bound. Results are inclusive of the maxcount (i.e. <= maxcount)

  • terms.prefix={String} - Optional. Restrict matches to terms that start with the prefix.
  • terms.regex={String} - Optional. Restrict matches to terms that match the regular expression. <!> Solr3.1

  • terms.regex.flag={case_insensitive|comments|multiline|literal|dotall|unicode_case|canon_eq|unix_lines} - Optional. Flags to be used when evaluating the regular expression defined in the "terms.regex" parameter (see http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#compile%28java.lang.String,%20int%29 fore more details). This parameter can be defined multiple times (each time with different flag) <!> Solr3.1

  • terms.limit={integer} - The maximum number of terms to return. The default is 10. If < 0, then include all terms.

  • terms.upper={The upper bound term} - The term to stop at. Either upper or terms.limit must be set.
  • terms.upper.incl={true|false} - Include the upper bound term in the result set. Default is false.
  • terms.raw={true|false} - If true, return the raw characters of the indexed term, regardless of if it is human readable. For instance, the indexed form of numeric numbers is not human readable. The default is false.
  • terms.sort={count|index} - If count, sorts the terms by the term frequency (highest count first). If index, returns the terms in index order. Default is to sort by count.
详见: http://wiki.apache.org/solr/TermsComponent


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值