简体   繁体   English

Solr查询一个唯一对

[英]Solr Query for a a Unique pair

I have Solr documents having 3 fields Sender, Receiver and Time. 我有具有3个字段发件人,收件人和时间的Solr文档。 I want to query what is the total time for all unique pair of Sender+Reciever. 我想查询发件人和收件人的所有唯一对的总时间是多少。

Below is Solr Document format and 4 record(for example): 下面是Solr文档格式和4条记录(例如):

Sender Reciever Time 发件人收件时间

  1. John Robert 10 约翰·罗伯特10
  2. John Rocky 20 约翰·洛基20
  3. Robert John 10 罗伯特·约翰10
  4. Rocky John 20 落基约翰20

Expected Output 预期产量

  1. John Robert ->Total Time = 20*(10+10)* 约翰·罗伯特->总时间= 20 *(10 + 10)*
  2. John Rocky ->Total Time = 40*(20+20)* 约翰·洛基->总时间= 40 *(20 + 20)*

What is the query that I can write for it(single or nested). 我可以为其编写的查询是什么(单个或嵌套)。 I tried stats but I am not able to put condition for a unique pair. 我尝试了统计数据,但无法为唯一一对设置条件。

You could use the signature generated from those two fields and then group/stat on those. 您可以使用从这两个字段生成的签名 ,然后对它们进行分组/统计。 But you need to do that during indexing time. 但是您需要在索引期间执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM