Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7FB25200B8B for ; Tue, 4 Oct 2016 20:59:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7E376160ACC; Tue, 4 Oct 2016 18:59:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C449B160AC7 for ; Tue, 4 Oct 2016 20:59:00 +0200 (CEST) Received: (qmail 3749 invoked by uid 500); 4 Oct 2016 18:58:59 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 3738 invoked by uid 99); 4 Oct 2016 18:58:59 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2016 18:58:59 +0000 Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id D7DEF1A0044 for ; Tue, 4 Oct 2016 18:58:58 +0000 (UTC) Received: by mail-it0-f42.google.com with SMTP id 189so12406166ity.1 for ; Tue, 04 Oct 2016 11:58:58 -0700 (PDT) X-Gm-Message-State: AA6/9RlCGtvBl5JF1dBst/pPFWZAKM+YuhXL+J5kZni+YP6OfbulJa9qsa09EfCCPKN4GHuyVCOCly9bMqV6kA== X-Received: by 10.36.134.194 with SMTP id u185mr6145426itd.23.1475607537946; Tue, 04 Oct 2016 11:58:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.21.97 with HTTP; Tue, 4 Oct 2016 11:58:57 -0700 (PDT) In-Reply-To: References: From: Mikhail Khludnev Date: Tue, 4 Oct 2016 21:58:57 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Faceting on both Parent and Child records in Block Join Query Parser To: solr-user Content-Type: multipart/alternative; boundary=94eb2c0892c8209a8c053e0ea7c0 archived-at: Tue, 04 Oct 2016 18:59:01 -0000 --94eb2c0892c8209a8c053e0ea7c0 Content-Type: text/plain; charset=UTF-8 Edwin, It seems like you try to pull document hierarchy back. That's usually done by searching parents and fl=[child ..],,. On Tue, Oct 4, 2016 at 5:22 PM, Zheng Lin Edwin Yeo wrote: > Some of the sample documents are like the following: > > Author is the Header, while Books are the Child > > Author: Edwin > Books: Book 1 > Book 2 > Book 3 > > Author: John > Books: Book 4 > Book 5 > > For this query: > > http://localhost:8983/solr/collection1/select?q=*:* > &json.facet={ > author:{ > type:terms, > field:author_s, > domain: { blockParent : "type_s:author" } > }, > books:{ > type:terms, > field:book_s, > domain: { blockChild : "type_s:book" } > } > }&fl=null&rows=0 > > I'll get the following results: > > "facets":{ > "count":2, > "author":{ > "buckets":[{ > "val":"Edwin", > "count":1, > "books":{ > "buckets":[]}}, > { > "val":"John", > "count":1, > "books":{ > "buckets":[]}}, > > I can't manage to get the list of books to be displayed in the buckets for > books. > > > Regards, > Edwin > > > On 4 October 2016 at 19:29, Yonik Seeley wrote: > > > Perhaps show a couple sample documents, and then what data you're > > looking for in a response? > > This stuff can be tough to pin down without concrete examples. > > > > -Yonik > > > > > > On Tue, Oct 4, 2016 at 5:22 AM, Zheng Lin Edwin Yeo > > wrote: > > > I have tried to use this nested query, but I still can't get results > for > > > the list of books. > > > > > > http://localhost:8983/solr/collection1/select?q=*:* > > > &json.facet={ > > > items:{ > > > type:terms, > > > field:author_s, > > > domain: { blockParent : "type_s:author" }, > > > facet:{ > > > by1:{ > > > type:terms, > > > field:book_s, > > > domain: { blockChild : "type_s:book" } > > > } > > > } > > > } > > > } > > > }&fl=null&rows=0 > > > > > > > > > Only when I didn't use the nested method, but query it individually > like > > > the one below, the I managed to get the result. > > > > > > http://localhost:8983/solr/collection1/select?q=*:* > > > &json.facet={ > > > items:{ > > > type:terms, > > > field:author_s, > > > domain: { blockParent : "type_s:author" } > > > }, > > > by1:{ > > > type:terms, > > > field:book_s, > > > domain: { blockChild : "type_s:book" } > > > } > > > }&fl=null&rows=0 > > > > > > > > > Regards, > > > Edwin > > > > > > > > > On 4 October 2016 at 15:22, Alexandre Rafalovitch > > > wrote: > > > > > >> You need to switch the domain to the child records. It is somewhere in > > the > > >> guide or Yonik's blog linked. > > >> > > >> Regards, > > >> Alex > > >> > > >> On 4 Oct 2016 1:55 PM, "Zheng Lin Edwin Yeo" > > wrote: > > >> > > >> > Hi, > > >> > > > >> > Is it possible to do nested faceting on both records in parent and > > child > > >> in > > >> > a single query? > > >> > > > >> > For example, I want to facet both author_s and book_s. Author is > > indexed > > >> as > > >> > a parent, whereas Book is indexed as a child. > > >> > > > >> > I tried the following JSON Facet query, which is to do a facet of > all > > the > > >> > list of author (in the parent), followed by a facet of all the list > of > > >> > books (in the child) that are written by the author. > > >> > > > >> > http://localhost:8983/solr/collection1/select?q=*:* > > >> > &json.facet={ > > >> > items:{ > > >> > type:terms, > > >> > field:author_s, > > >> > facet:{ > > >> > by1:{ > > >> > type:terms, > > >> > field:book_s > > >> > } > > >> > } > > >> > } > > >> > } > > >> > }&fl=null&rows=0 > > >> > > > >> > > > >> > However, it only managed to return me the facet of the list of > > author. I > > >> > could not get any results for the list of books. Is this possible to > > be > > >> > done, or what could be wrong with my query? > > >> > > > >> > > > >> > Regards, > > >> > Edwin > > >> > > > >> > > > -- Sincerely yours Mikhail Khludnev --94eb2c0892c8209a8c053e0ea7c0--