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 David Frese <da...@active-group.de> on 2017/11/23 19:06:32 UTC
Combining complex joins with other criteria
Hi there everbody,
I want to combine joins with multiple criteria and other criteria, with
variying boolean operators, but I keep getting
"org.apache.solr.search.SyntaxError: Cannot parse" errors. I tried with
an installation of version 6.3, and also with the embedded server in
version 7.1
Given these two documents:
{"id": "p1", "name": "Mike"}
{"id": "a1", "pid": "p1", "city": "London"}
thw following queries work just fine:
{!join from=pid to=id}(city:"London" AND id:"a1")
name:"Mike" AND id:"p1"
name:"Mike" AND {!join from=pid to=id}city:"London"
but when I start trying multiple criteria to the join, I keep getting
parse errors with a message like "Cannot parse '(city:"London"':
Encountered "<EOF>" at line 1, column 39."
Seems something is eating up (or not eating) the braces?
I tried all the following variants already, and all fail:
name:"Mike" AND {!join from=pid to=id}(city:"London" AND id:"a1")
name:"Mike" AND ({!join from=pid to=id}(city:"London" AND id:"a1"))
(name:"Mike") AND ({!join from=pid to=id}(city:"London" AND id:"a1"))
(name:"Mike" AND {!join from=pid to=id}(city:"London" AND id:"a1"))
Some other variants do parse, but are somehow misunderstood and do not
yield any results, like:
name:"Mike" AND ({!join from=pid to=id}city:"London" AND id:"a1")
Thanks for any help!
--
David Frese
Re: Combining complex joins with other criteria
Posted by Mikhail Khludnev <mk...@apache.org>.
This is my pet peeve in Solr.
When q={!join ..}all tokens goes into join qp
but even if we put space in front of curly brace q= {!join
..}1st_only_token_goes_to_join_qp
I remember there were some discussion in comments, but I believe it is not
raised ever raised as a defect.
We have some json query syntax introduced recently, it might work more
predictable.
On Fri, Nov 24, 2017 at 1:08 AM, David Frese <da...@active-group.de>
wrote:
> Am 23.11.17 um 20:13 schrieb Mikhail Khludnev:
>
>> Hello, David.
>> It should be like
>> q=name:"Mike" AND {!join from=pid to=id v=$qq}&qq=city:"London" AND
>> id:"a1"
>>
>>
> Thanks a lot!
>
> But this looks like working around a bug, given that
>
> >> {!join from=pid to=id}(city:"London" AND id:"a1")
>
> works fine. Is there any documentation about this? Or an open issue?
>
> --
> David Frese
> +49 7071 70896 75
>
> Active Group GmbH
> Hechinger Str. 12/1, 72072 Tübingen
> Registergericht: Amtsgericht Stuttgart, HRB 224404
> Geschäftsführer: Dr. Michael Sperber
>
--
Sincerely yours
Mikhail Khludnev
Re: Combining complex joins with other criteria
Posted by David Frese <da...@active-group.de>.
Am 23.11.17 um 20:13 schrieb Mikhail Khludnev:
> Hello, David.
> It should be like
> q=name:"Mike" AND {!join from=pid to=id v=$qq}&qq=city:"London" AND id:"a1"
>
Thanks a lot!
But this looks like working around a bug, given that
>> {!join from=pid to=id}(city:"London" AND id:"a1")
works fine. Is there any documentation about this? Or an open issue?
--
David Frese
+49 7071 70896 75
Active Group GmbH
Hechinger Str. 12/1, 72072 Tübingen
Registergericht: Amtsgericht Stuttgart, HRB 224404
Geschäftsführer: Dr. Michael Sperber
Re: Combining complex joins with other criteria
Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, David.
It should be like
q=name:"Mike" AND {!join from=pid to=id v=$qq}&qq=city:"London" AND id:"a1"
On Thu, Nov 23, 2017 at 10:06 PM, David Frese <da...@active-group.de>
wrote:
> Hi there everbody,
>
> I want to combine joins with multiple criteria and other criteria, with
> variying boolean operators, but I keep getting
> "org.apache.solr.search.SyntaxError: Cannot parse" errors. I tried with
> an installation of version 6.3, and also with the embedded server in
> version 7.1
>
> Given these two documents:
>
> {"id": "p1", "name": "Mike"}
> {"id": "a1", "pid": "p1", "city": "London"}
>
> thw following queries work just fine:
>
> {!join from=pid to=id}(city:"London" AND id:"a1")
> name:"Mike" AND id:"p1"
> name:"Mike" AND {!join from=pid to=id}city:"London"
>
> but when I start trying multiple criteria to the join, I keep getting
> parse errors with a message like "Cannot parse '(city:"London"':
> Encountered "<EOF>" at line 1, column 39."
> Seems something is eating up (or not eating) the braces?
>
> I tried all the following variants already, and all fail:
>
> name:"Mike" AND {!join from=pid to=id}(city:"London" AND id:"a1")
>
> name:"Mike" AND ({!join from=pid to=id}(city:"London" AND id:"a1"))
>
> (name:"Mike") AND ({!join from=pid to=id}(city:"London" AND id:"a1"))
>
> (name:"Mike" AND {!join from=pid to=id}(city:"London" AND id:"a1"))
>
> Some other variants do parse, but are somehow misunderstood and do not
> yield any results, like:
>
> name:"Mike" AND ({!join from=pid to=id}city:"London" AND id:"a1")
>
>
>
> Thanks for any help!
>
> --
> David Frese
>
--
Sincerely yours
Mikhail Khludnev