Question regarding subqueries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question regarding subqueries

Bram Biesbrouck-2
Hi all,

I'm struggling with a little period-sign difficulty and instead of pulling
out my hair, I wonder if any of you could help me out...

Here's the query:
q=uri:"/en/blah"&fl=id,uri,children:[subquery]&children.q={!prefix f=id v=$
row.id}&children.fl=*

It just searches for a document with the field "uri" set to "/en/blah".
For every hit (just one), it tries to manually fetch the subdocuments using
the id field of the hit since its children have id's like
<parent-id>.<child-id>.
Note that I know this should be done with nested documents and the
ChildDocTransformer... this is just an exercise to train my brain...

The query above works fine. However, it also returns the parent document,
because the prefix search includes it as well, of course. However, if I'm
changing the subquery to something along the lines of this:

{!prefix f=id v=concat($row.id,".")}
or
{!prefix f=id v="$row.id\.")}
or
{!query defType=lucene v=concat("id:",$row.id,".")}

I get no results back.

I feel like I'm missing only a simple thing here, but can't seem to
pinpoint it.

Any help?

b.
<http://www.reinvention.be> *We do video technology*
Visit our new website! <http://www.reinvention.be> *Bram Biesbrouck*
[hidden email]
+32 486 118280 <0032%20486%20118280>
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding subqueries

Mikhail Khludnev-2
Hello, Bram.

Something like that is possible in principle, but it will take enormous
efforts to tackle exact syntax.
Why not something like children.fq=-parent:true ?

On Wed, Oct 2, 2019 at 8:52 PM Bram Biesbrouck <
[hidden email]> wrote:

> Hi all,
>
> I'm struggling with a little period-sign difficulty and instead of pulling
> out my hair, I wonder if any of you could help me out...
>
> Here's the query:
> q=uri:"/en/blah"&fl=id,uri,children:[subquery]&children.q={!prefix f=id v=$
> row.id}&children.fl=*
>
> It just searches for a document with the field "uri" set to "/en/blah".
> For every hit (just one), it tries to manually fetch the subdocuments using
> the id field of the hit since its children have id's like
> <parent-id>.<child-id>.
> Note that I know this should be done with nested documents and the
> ChildDocTransformer... this is just an exercise to train my brain...
>
> The query above works fine. However, it also returns the parent document,
> because the prefix search includes it as well, of course. However, if I'm
> changing the subquery to something along the lines of this:
>
> {!prefix f=id v=concat($row.id,".")}
> or
> {!prefix f=id v="$row.id\.")}
> or
> {!query defType=lucene v=concat("id:",$row.id,".")}
>
> I get no results back.
>
> I feel like I'm missing only a simple thing here, but can't seem to
> pinpoint it.
>
> Any help?
>
> b.
> <http://www.reinvention.be> *We do video technology*
> Visit our new website! <http://www.reinvention.be> *Bram Biesbrouck*
> [hidden email]
> +32 486 118280 <0032%20486%20118280>
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding subqueries

Bram Biesbrouck-2
Hi Mikhail,

You're right, I'm probably over-complicating things. I was stuck trying to
combine a function in a regular query using a local variable, but Solr
doesn't seem to bend the way my mind did ;-)
Anyway, I worked around it using your suggestion and/or a slightly modified
prefix parser plugin.
Thanks for taking the time to reply, btw!

best,

b.

On Wed, Oct 2, 2019 at 9:05 PM Mikhail Khludnev <[hidden email]> wrote:

> Hello, Bram.
>
> Something like that is possible in principle, but it will take enormous
> efforts to tackle exact syntax.
> Why not something like children.fq=-parent:true ?
>
> On Wed, Oct 2, 2019 at 8:52 PM Bram Biesbrouck <
> [hidden email]> wrote:
>
> > Hi all,
> >
> > I'm struggling with a little period-sign difficulty and instead of
> pulling
> > out my hair, I wonder if any of you could help me out...
> >
> > Here's the query:
> > q=uri:"/en/blah"&fl=id,uri,children:[subquery]&children.q={!prefix f=id
> v=$
> > row.id}&children.fl=*
> >
> > It just searches for a document with the field "uri" set to "/en/blah".
> > For every hit (just one), it tries to manually fetch the subdocuments
> using
> > the id field of the hit since its children have id's like
> > <parent-id>.<child-id>.
> > Note that I know this should be done with nested documents and the
> > ChildDocTransformer... this is just an exercise to train my brain...
> >
> > The query above works fine. However, it also returns the parent document,
> > because the prefix search includes it as well, of course. However, if I'm
> > changing the subquery to something along the lines of this:
> >
> > {!prefix f=id v=concat($row.id,".")}
> > or
> > {!prefix f=id v="$row.id\.")}
> > or
> > {!query defType=lucene v=concat("id:",$row.id,".")}
> >
> > I get no results back.
> >
> > I feel like I'm missing only a simple thing here, but can't seem to
> > pinpoint it.
> >
> > Any help?
> >
> > b.
> > <http://www.reinvention.be> *We do video technology*
> > Visit our new website! <http://www.reinvention.be> *Bram Biesbrouck*
> > [hidden email]
> > +32 486 118280 <0032%20486%20118280>
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>