You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Zheng Lin Edwin Yeo <ed...@gmail.com> on 2016/10/04 06:55:25 UTC

Faceting on both Parent and Child records in Block Join Query Parser

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

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
I _think_ what is happening is that you are going in both parent and
child directions in your filters.

Try making your query ('q') define your original domain
(q=type_s:author) and then 'books' goes inside the parent "author"
scope and that's where you change your domain.

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


On 4 October 2016 at 21:22, Zheng Lin Edwin Yeo <ed...@gmail.com> 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 <ys...@gmail.com> 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
>> <ed...@gmail.com> 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 <ar...@gmail.com>
>> > 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" <ed...@gmail.com>
>> 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
>> >> >
>> >>
>>

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Thanks for the information.
Will try them out.

Regards,
Edwin

On 5 October 2016 at 02:58, Mikhail Khludnev <mk...@apache.org> wrote:

> 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 <ed...@gmail.com>
> 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 <ys...@gmail.com> 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
> > > <ed...@gmail.com> 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 <
> arafalov@gmail.com>
> > > > 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" <ed...@gmail.com>
> > > 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
>

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Mikhail Khludnev <mk...@apache.org>.
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 <ed...@gmail.com>
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 <ys...@gmail.com> 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
> > <ed...@gmail.com> 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 <ar...@gmail.com>
> > > 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" <ed...@gmail.com>
> > 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

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
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 <ys...@gmail.com> 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
> <ed...@gmail.com> 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 <ar...@gmail.com>
> > 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" <ed...@gmail.com>
> 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
> >> >
> >>
>

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Yonik Seeley <ys...@gmail.com>.
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
<ed...@gmail.com> 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 <ar...@gmail.com>
> 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" <ed...@gmail.com> 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
>> >
>>

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
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 <ar...@gmail.com>
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" <ed...@gmail.com> 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
> >
>

Re: Faceting on both Parent and Child records in Block Join Query Parser

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
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" <ed...@gmail.com> 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
>