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 Mathias <ma...@innofuture.com> on 2016/10/21 08:36:03 UTC
OR two joins
Hello,
I have the following statement:
({!join from=project_uuid to=id}type:EM_PM_Timerecord AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]) OR ({!join
from=project_uuid to=id}type:EM_CM_Request_Member AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z])
It doesn't return any documents, but if I use only one of the joins e.g.:
{!join from=project_uuid to=id}type:EM_PM_Timerecord AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
It returns some documents.
If I remove the date ranges it works as well:
({!join from=project_uuid to=id}type:EM_PM_Timerecord) OR ({!join
from=project_uuid to=id}type:EM_CM_Request_Member)
In debug the parsed query looks like this:
(+JoinQuery({!join from=project_uuid to=id}type:EM_PM_Timerecord)
+created:[1420074000000 TO 1451610000000]) (+JoinQuery({!join
from=project_uuid to=id}type:EM_CM_Request_Member) +created:[1420074000000
TO 1451610000000])
Can someone tell me what I'm missing? And what is wrong with the first
statement?
Thanks in advance,
Mathias
--
View this message in context: http://lucene.472066.n3.nabble.com/OR-two-joins-tp4302415.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: OR two joins
Posted by Mathias <ma...@innofuture.com>.
I tested it with solr version 6.1.0 and 6.2.1.
Thanks,
Mathias
--
View this message in context: http://lucene.472066.n3.nabble.com/OR-two-joins-tp4302415p4302416.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: OR two joins
Posted by Mathias <ma...@innofuture.com>.
Yonik Seeley wrote
> On Fri, Oct 21, 2016 at 7:07 AM, Mathias
> <
> mathias.mahlknecht@
> > wrote:
>> With the first version I get the fallowing error:
>>
>> "org.apache.solr.search.SyntaxError: Cannot parse
>> '(type:EM_PM_Timerecord':
>> Encountered \"
> <EOF>
> \" at line 1, column 22.\nWas expecting one of:\n
>>
> <AND>
> ...\n
> <OR>
> ...\n
> <NOT>
> ...\n \"+\" ...\n \"-\" ...\n
>>
> <BAREOPER>
> ...\n \"(\" ...\n \")\" ...\n \"*\" ...\n \"^\" ...\n
>>
> <QUOTED>
> ...\n
> <TERM>
> ...\n
> <FUZZY_SLOP>
> ...\n
> <PREFIXTERM>
> ...\n
>>
> <WILDTERM>
> ...\n
> <REGEXPTERM>
> ...\n \"[\" ...\n \"{\" ...\n
>>
> <LPARAMS>
> ...\n \"filter(\" ...\n
> <NUMBER>
> ...\n"
>>
>> With the second version I get:
>>
>> "undefined field &q1=type"
>
>
> q1 should be a separate query parameter, so you may have a client
> error somewhere
>
> Try this form:
>
> &q={!join from=project_uuid to=id v=$q1} OR {!join
> from=project_uuid to=id v=$q2}
> &q1=type:EM_PM_Timerecord AND
> created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
> &q2=type:EM_CM_Request_Member AND
> created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
>
> -Yonik
Thank you, this works great.
Mathias
--
View this message in context: http://lucene.472066.n3.nabble.com/OR-two-joins-tp4302415p4302455.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: OR two joins
Posted by Yonik Seeley <ys...@gmail.com>.
On Fri, Oct 21, 2016 at 7:07 AM, Mathias
<ma...@innofuture.com> wrote:
> With the first version I get the fallowing error:
>
> "org.apache.solr.search.SyntaxError: Cannot parse '(type:EM_PM_Timerecord':
> Encountered \"<EOF>\" at line 1, column 22.\nWas expecting one of:\n
> <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n
> <BAREOPER> ...\n \"(\" ...\n \")\" ...\n \"*\" ...\n \"^\" ...\n
> <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n
> <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n
> <LPARAMS> ...\n \"filter(\" ...\n <NUMBER> ...\n"
>
> With the second version I get:
>
> "undefined field &q1=type"
q1 should be a separate query parameter, so you may have a client
error somewhere
Try this form:
&q={!join from=project_uuid to=id v=$q1} OR {!join
from=project_uuid to=id v=$q2}
&q1=type:EM_PM_Timerecord AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
&q2=type:EM_CM_Request_Member AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
-Yonik
Re: OR two joins
Posted by Mathias <ma...@innofuture.com>.
With the first version I get the fallowing error:
"org.apache.solr.search.SyntaxError: Cannot parse '(type:EM_PM_Timerecord':
Encountered \"<EOF>\" at line 1, column 22.\nWas expecting one of:\n
<AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n
<BAREOPER> ...\n \"(\" ...\n \")\" ...\n \"*\" ...\n \"^\" ...\n
<QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n
<WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n
<LPARAMS> ...\n \"filter(\" ...\n <NUMBER> ...\n"
With the second version I get:
"undefined field &q1=type"
--
View this message in context: http://lucene.472066.n3.nabble.com/OR-two-joins-tp4302415p4302450.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: OR two joins
Posted by Mikhail Khludnev <mk...@apache.org>.
try ({!join from=project_uuid to=id}(type:EM_PM_Timerecord AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z])) OR ({!join
from=project_uuid to=id}(type:EM_CM_Request_Member AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]))
or
({!join from=project_uuid to=id v=$q1}) OR ({!join
from=project_uuid to=id v=$q2})&q1=type:EM_PM_Timerecord AND
created:[2015-01-01T01:00:00Z TO
2016-01-01T01:00:00Z]&q2=type:EM_CM_Request_Member AND
created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
On Fri, Oct 21, 2016 at 11:36 AM, Mathias <mathias.mahlknecht@innofuture.com
> wrote:
> Hello,
>
> I have the following statement:
>
> ({!join from=project_uuid to=id}type:EM_PM_Timerecord AND
> created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]) OR ({!join
> from=project_uuid to=id}type:EM_CM_Request_Member AND
> created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z])
>
> It doesn't return any documents, but if I use only one of the joins e.g.:
>
> {!join from=project_uuid to=id}type:EM_PM_Timerecord AND
> created:[2015-01-01T01:00:00Z TO 2016-01-01T01:00:00Z]
>
> It returns some documents.
>
> If I remove the date ranges it works as well:
>
> ({!join from=project_uuid to=id}type:EM_PM_Timerecord) OR ({!join
> from=project_uuid to=id}type:EM_CM_Request_Member)
>
> In debug the parsed query looks like this:
>
> (+JoinQuery({!join from=project_uuid to=id}type:EM_PM_Timerecord)
> +created:[1420074000000 TO 1451610000000]) (+JoinQuery({!join
> from=project_uuid to=id}type:EM_CM_Request_Member) +created:[1420074000000
> TO 1451610000000])
>
> Can someone tell me what I'm missing? And what is wrong with the first
> statement?
>
> Thanks in advance,
> Mathias
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/OR-two-joins-tp4302415.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Sincerely yours
Mikhail Khludnev