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 Mark Olsen <mo...@experts-exchange.com> on 2014/04/08 21:48:38 UTC

Range query and join, oarse exception when parens are added

Solr version 4.2.1

I'm having an issue using a "join" query with a range query, but only when the query is wrapped in parens.

This query works:

{!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 TO 50]

However this query does not (just wrapping with parens):

({!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 TO 50])

Caused by: org.apache.solr.parser.ParseException: Encountered "<EOF>" at line 1, column 34.
Was expecting one of:
    "TO" ...
    <RANGE_QUOTED> ...
    <RANGE_GOOP> ...

        at org.apache.solr.parser.QueryParser.generateParseException(QueryParser.java:651)
        at org.apache.solr.parser.QueryParser.jj_consume_token(QueryParser.java:533)
        at org.apache.solr.parser.QueryParser.Term(QueryParser.java:346)
        at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:186)
        at org.apache.solr.parser.QueryParser.Query(QueryParser.java:108)
        at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:97)
        at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:160)
        ... 45 more


Is this a known bug in this version of Solr (4.2.1)?

Thank you,
Mark

Re: Range query and join, oarse exception when parens are added

Posted by Shawn Heisey <so...@elyograg.org>.
On 4/8/2014 1:48 PM, Mark Olsen wrote:
> Solr version 4.2.1
>
> I'm having an issue using a "join" query with a range query, but only when the query is wrapped in parens.
>
> This query works:
>
> {!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 TO 50]
>
> However this query does not (just wrapping with parens):
>
> ({!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 TO 50])

The {!join...} part of that is a localParam.  It must precede the entire 
query.  If you want to add parens, here's how you would need to do it:

{!join from=member_profile_doc_id 
to=id}(language_proficiency_id_number:[30 TO 50])

With the left parenthesis where you placed it, the localParam is 
considered part of the query itself.  It becomes incorrect Solr syntax 
at that point.

Thanks,
Shawn