lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Rafalovitch <arafa...@gmail.com>
Subject Re: Return parent's records which has more than certain number of childs
Date Thu, 01 Sep 2016 03:21:58 GMT
On 1 September 2016 at 08:50, Zheng Lin Edwin Yeo <edwinyeozl@gmail.com> wrote:
> When searching for children you can assign ^=1 per every hit, then
> you can aggregate these hits with {!parent ... score=total}, then
> you can cut off parents exceeding number of child limit with {!frange}.
>
> - Just to check, is this done during query time?

This is during query time. You have to be very careful to put these
things together. I am not sure I got everything quite correct, but it
should be something like this:

http://localhost:8983/solr/git/select?indent=on&wt=json&q=*:*&fq={!frange
l=2 u=3}query($qmatch)&qmatch={!parent which=type:commit
score=total}diffType:MODIFY^=1&fl=*,score,[child
parentFilter=type:commit]

Or in paramEcho for easier read:

"params":{
      "q":"*:*",
      "indent":"on",
      "qmatch":"{!parent which=type:commit score=total}diffType:MODIFY^=1",
      "fl":"*,score,[child parentFilter=type:commit]",
      "fq":"{!frange l=2 u=3}query($qmatch)",
      "wt":"json"}},

Regards,
   Alex.
P.s. The fields/structure comes from the git-to-solr project at:
https://github.com/arafalov/git-to-solr




----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/

Mime
View raw message