Lucene ApacheSolr:由group by生成的数据总和
我们有一个要求,我们需要按特定字段对记录进行分组,并取相应数字字段的总和 e、 x.按用户ID从用户操作组中选择用户ID、总和(单击计数) 我们正在尝试使用apache solr实现这一点,并发现有两种实现方法:Lucene ApacheSolr:由group by生成的数据总和,lucene,solr,Lucene,Solr,我们有一个要求,我们需要按特定字段对记录进行分组,并取相应数字字段的总和 e、 x.按用户ID从用户操作组中选择用户ID、总和(单击计数) 我们正在尝试使用apache solr实现这一点,并发现有两种实现方法: 正在使用字段折叠功能(),但发现了以下两个问题: 1.1. 这不是发行版的一部分,可以作为补丁提供,所以我们不确定是否可以在生产中使用它。 1.2. 我们不收回总额,而是单独计算,我们需要在客户端进行汇总 使用Stats组件和facetedsearch()。这满足了我们的要求,但对于非
Terance.为什么不使用StatComponent可从Solr 1.4以上版本获得
$ curl 'http://search/select?q=*&rows=0&stats=on&stats.field=click_count' |
tidy -xml -indent -quiet -wrap 2000000
<?xml version="1.0" encoding="utf-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">17</int>
<lst name="params">
<str name="q">*</str>
<str name="stats">on</str>
<arr name="stats.field">
<str>click_count</str>
</arr>
<str name="rows">0</str>
</lst>
</lst>
<result name="response" numFound="577" start="0" />
<lst name="stats">
<lst name="stats_fields">
<lst name="click_count">
<double name="min">1.0</double>
<double name="max">3487.0</double>
<double name="sum">47912.0</double>
<long name="count">577</long>
<long name="missing">0</long>
<double name="sumOfSquares">4.0208702E7</double>
<double name="mean">83.0363951473137</double>
<double name="stddev">250.79824725438448</double>
</lst>
</lst>
</lst>
</response>
$curl'http://search/select?q=*&行=0&stats=on&stats.field=单击计数'|
tidy-xml-indent-quiet-wrap 2000000
0
17
*
在…上
点击计数
0
1
3487
47912
577
0
4.0208702E7
83.0363951473137
250.79824725438448
数据集有多大?你会把指数分成几部分吗?我认为你应该试着用第二种方法来衡量。在Solr1.4中,facet的启动速度非常快。