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 Bram Biesbrouck <br...@reinvention.be> on 2019/10/09 10:35:40 UTC

How to combine [child] and [subquery?]

Hi all,

I'm diving deep into the ChildDocTransformer and its
related SubQueryAugmenter.

First of all, I think there's a bug in the Solr docs about [child]. It
states:
"This transformer returns all descendant documents of each parent document
matching your query in a flat list nested inside the matching parent
document."
This is not exact: the descendant documents are "wired into" the parent,
creating a hierarchical structure (which is nice). Or am I misinterpreting
the docs?

Secondly, the [subquery] transformer is super powerful and awesome, but it
doesn't like to be combined with [child]? I'm getting a "[subquery] name
children is duplicated" error. Is there a way to work around this? Or maybe
better: is there a way to make the [subquery] transformer behave like (a
more flexible version of) [child]? Because now, the path information (how
the children relate to their parent fields) is lost when using [subquery].

Hope to hear more!

b.

Re: How to combine [child] and [subquery?]

Posted by Bram Biesbrouck <br...@reinvention.be>.
My use case is this:

I'd like solr to return my indexed document including all nested children.
On top of that, some extra information about the root doc is added
dynamically (the subquery).
But I understand this is an advanced use case and probably not requested
frequently. I'll try to around it.

On Wed, 9 Oct 2019, 14:49 Mikhail Khludnev, <mk...@apache.org> wrote:

> I might not fully understand how you would like to combine them. The
> possible reason is that [subquery] expect regular Solr Response to act on,
> but [child] might yield something hairish.
>
> On Wed, Oct 9, 2019 at 2:40 PM Bram Biesbrouck <
> bram.biesbrouck@reinvention.be> wrote:
>
> > Hi Mikhail,
> >
> > You're right, I should file an issue for the doc thing, I'll look into
> it.
> >
> > Thanks for pointing me towards parsing the _nest_path_ field. It's
> exactly
> > what ChildDocTransformer does, indeed.
> >
> > Would you by any chance know why [child] and [subquery] can't be
> combined?
> > They don't look too related to me and I can't seem to find any logical
> > reason why they couldn't coexist in the same query.
> >
> > b.
> >
> >
> > On Wed, Oct 9, 2019 at 1:08 PM Mikhail Khludnev <mk...@apache.org> wrote:
> >
> > > Hello, Bram.
> > >
> > > I guess [child] was recently extended. Docs might be outdated, don't
> > > hesitate to contribute doc improvement.
> > > [subquery] is a neat thing, it's just queries without relying on
> > particular
> > > use case, if my understanding is right one may request something like
> > > _path_ field in [subquery], which may let to reconstruct hierarchy.
> > >
> > > On Wed, Oct 9, 2019 at 1:36 PM Bram Biesbrouck <
> > > bram.biesbrouck@reinvention.be> wrote:
> > >
> > > > Hi all,
> > > >
> > > > I'm diving deep into the ChildDocTransformer and its
> > > > related SubQueryAugmenter.
> > > >
> > > > First of all, I think there's a bug in the Solr docs about [child].
> It
> > > > states:
> > > > "This transformer returns all descendant documents of each parent
> > > document
> > > > matching your query in a flat list nested inside the matching parent
> > > > document."
> > > > This is not exact: the descendant documents are "wired into" the
> > parent,
> > > > creating a hierarchical structure (which is nice). Or am I
> > > misinterpreting
> > > > the docs?
> > > >
> > > > Secondly, the [subquery] transformer is super powerful and awesome,
> but
> > > it
> > > > doesn't like to be combined with [child]? I'm getting a "[subquery]
> > name
> > > > children is duplicated" error. Is there a way to work around this? Or
> > > maybe
> > > > better: is there a way to make the [subquery] transformer behave like
> > (a
> > > > more flexible version of) [child]? Because now, the path information
> > (how
> > > > the children relate to their parent fields) is lost when using
> > > [subquery].
> > > >
> > > > Hope to hear more!
> > > >
> > > > b.
> > > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: How to combine [child] and [subquery?]

Posted by Mikhail Khludnev <mk...@apache.org>.
I might not fully understand how you would like to combine them. The
possible reason is that [subquery] expect regular Solr Response to act on,
but [child] might yield something hairish.

On Wed, Oct 9, 2019 at 2:40 PM Bram Biesbrouck <
bram.biesbrouck@reinvention.be> wrote:

> Hi Mikhail,
>
> You're right, I should file an issue for the doc thing, I'll look into it.
>
> Thanks for pointing me towards parsing the _nest_path_ field. It's exactly
> what ChildDocTransformer does, indeed.
>
> Would you by any chance know why [child] and [subquery] can't be combined?
> They don't look too related to me and I can't seem to find any logical
> reason why they couldn't coexist in the same query.
>
> b.
>
>
> On Wed, Oct 9, 2019 at 1:08 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Hello, Bram.
> >
> > I guess [child] was recently extended. Docs might be outdated, don't
> > hesitate to contribute doc improvement.
> > [subquery] is a neat thing, it's just queries without relying on
> particular
> > use case, if my understanding is right one may request something like
> > _path_ field in [subquery], which may let to reconstruct hierarchy.
> >
> > On Wed, Oct 9, 2019 at 1:36 PM Bram Biesbrouck <
> > bram.biesbrouck@reinvention.be> wrote:
> >
> > > Hi all,
> > >
> > > I'm diving deep into the ChildDocTransformer and its
> > > related SubQueryAugmenter.
> > >
> > > First of all, I think there's a bug in the Solr docs about [child]. It
> > > states:
> > > "This transformer returns all descendant documents of each parent
> > document
> > > matching your query in a flat list nested inside the matching parent
> > > document."
> > > This is not exact: the descendant documents are "wired into" the
> parent,
> > > creating a hierarchical structure (which is nice). Or am I
> > misinterpreting
> > > the docs?
> > >
> > > Secondly, the [subquery] transformer is super powerful and awesome, but
> > it
> > > doesn't like to be combined with [child]? I'm getting a "[subquery]
> name
> > > children is duplicated" error. Is there a way to work around this? Or
> > maybe
> > > better: is there a way to make the [subquery] transformer behave like
> (a
> > > more flexible version of) [child]? Because now, the path information
> (how
> > > the children relate to their parent fields) is lost when using
> > [subquery].
> > >
> > > Hope to hear more!
> > >
> > > b.
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: How to combine [child] and [subquery?]

Posted by Bram Biesbrouck <br...@reinvention.be>.
Hi Mikhail,

You're right, I should file an issue for the doc thing, I'll look into it.

Thanks for pointing me towards parsing the _nest_path_ field. It's exactly
what ChildDocTransformer does, indeed.

Would you by any chance know why [child] and [subquery] can't be combined?
They don't look too related to me and I can't seem to find any logical
reason why they couldn't coexist in the same query.

b.


On Wed, Oct 9, 2019 at 1:08 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello, Bram.
>
> I guess [child] was recently extended. Docs might be outdated, don't
> hesitate to contribute doc improvement.
> [subquery] is a neat thing, it's just queries without relying on particular
> use case, if my understanding is right one may request something like
> _path_ field in [subquery], which may let to reconstruct hierarchy.
>
> On Wed, Oct 9, 2019 at 1:36 PM Bram Biesbrouck <
> bram.biesbrouck@reinvention.be> wrote:
>
> > Hi all,
> >
> > I'm diving deep into the ChildDocTransformer and its
> > related SubQueryAugmenter.
> >
> > First of all, I think there's a bug in the Solr docs about [child]. It
> > states:
> > "This transformer returns all descendant documents of each parent
> document
> > matching your query in a flat list nested inside the matching parent
> > document."
> > This is not exact: the descendant documents are "wired into" the parent,
> > creating a hierarchical structure (which is nice). Or am I
> misinterpreting
> > the docs?
> >
> > Secondly, the [subquery] transformer is super powerful and awesome, but
> it
> > doesn't like to be combined with [child]? I'm getting a "[subquery] name
> > children is duplicated" error. Is there a way to work around this? Or
> maybe
> > better: is there a way to make the [subquery] transformer behave like (a
> > more flexible version of) [child]? Because now, the path information (how
> > the children relate to their parent fields) is lost when using
> [subquery].
> >
> > Hope to hear more!
> >
> > b.
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: How to combine [child] and [subquery?]

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Bram.

I guess [child] was recently extended. Docs might be outdated, don't
hesitate to contribute doc improvement.
[subquery] is a neat thing, it's just queries without relying on particular
use case, if my understanding is right one may request something like
_path_ field in [subquery], which may let to reconstruct hierarchy.

On Wed, Oct 9, 2019 at 1:36 PM Bram Biesbrouck <
bram.biesbrouck@reinvention.be> wrote:

> Hi all,
>
> I'm diving deep into the ChildDocTransformer and its
> related SubQueryAugmenter.
>
> First of all, I think there's a bug in the Solr docs about [child]. It
> states:
> "This transformer returns all descendant documents of each parent document
> matching your query in a flat list nested inside the matching parent
> document."
> This is not exact: the descendant documents are "wired into" the parent,
> creating a hierarchical structure (which is nice). Or am I misinterpreting
> the docs?
>
> Secondly, the [subquery] transformer is super powerful and awesome, but it
> doesn't like to be combined with [child]? I'm getting a "[subquery] name
> children is duplicated" error. Is there a way to work around this? Or maybe
> better: is there a way to make the [subquery] transformer behave like (a
> more flexible version of) [child]? Because now, the path information (how
> the children relate to their parent fields) is lost when using [subquery].
>
> Hope to hear more!
>
> b.
>


-- 
Sincerely yours
Mikhail Khludnev