[
https://issues.apache.org/jira/browse/SOLR-5560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13863889#comment-13863889
]
Ryan Cutter edited comment on SOLR-5560 at 1/7/14 4:11 AM:
-----------------------------------------------------------
Attached patch will make both queries:
1: TERM1 AND {!lucene df=text v="TERM2 TERM3 \"TERM4 TERM5\""}
2: TERM1 AND {!lucene df=text}(TERM2 TERM3 "TERM4 TERM5")
yield:
+id:TERM1 +(text:term2 text:term3 text:"term4 term5")
The issue is QueryParserTokenManager.java:266 which will stop processing once a
space is read (leading to "{!lucene df=text}(TERM2"):
{code}if ((0xfffffdfefffff9ffL & l) == 0L)
break;{code}
So I added a flag that ensures we don't break while a parenthesis hasn't been
closed. I think this should be a new state but I have little idea what's going
on with the states in QueryParserTokenManager. Not much is documented and
states are unremarkable ints.
Added some unit tests too. Anyway, hope this helps.
was (Author: ryancutter):
Attached patch will make both queries:
1: TERM1 AND {!lucene df=text v="TERM2 TERM3 \"TERM4 TERM5\""}
2: TERM1 AND {!lucene df=text}(TERM2 TERM3 "TERM4 TERM5")
yield:
+id:TERM1 +(text:term2 text:term3 text:"term4 term5")
The issue is QueryParserTokenManager.java:266 which will stop processing once a
space was read (leading to "{!lucene df=text}(TERM2"):
{code}if ((0xfffffdfefffff9ffL & l) == 0L)
break;{code}
So I added a flag that ensures we don't break while a parenthesis hasn't been
closed. I think this should be a new state but I have little idea what's going
on with the states in QueryParserTokenManager. Not much is documented and
states are unremarkable ints.
Added some unit tests too. Anyway, hope this helps.
> Enable LocalParams without escaping the query
> ---------------------------------------------
>
> Key: SOLR-5560
> URL: https://issues.apache.org/jira/browse/SOLR-5560
> Project: Solr
> Issue Type: Bug
> Components: query parsers
> Affects Versions: 4.6
> Reporter: Isaac Hebsh
> Fix For: 4.7, 4.6.1
>
> Attachments: SOLR-5560.patch
>
>
> This query should be a legit syntax:
> http://localhost:8983/solr/collection1/select?debugQuery=true&defType=lucene&df=id&q=TERM1
> AND {!lucene df=text}(TERM2 TERM3 "TERM4 TERM5")
> currently it isn't, because the LocalParams can be specified on a single term
> only.
> [~billnbell] thinks it is a bug.
> From the mailing list:
> {quote}
> We want to set a LocalParam on a nested query. When quering with "v" inline
> parameter, it works fine:
> http://localhost:8983/solr/collection1/select?debugQuery=true&defType=lucene&df=id&q=TERM1
> AND {!lucene df=text v="TERM2 TERM3 \"TERM4 TERM5\""}
> the parsedquery_toString is
> +id:TERM1 +(text:term2 text:term3 text:"term4 term5")
> Query using the "_query_" also works fine:
> http://localhost:8983/solr/collection1/select?debugQuery=true&defType=lucene&df=id&q=TERM1
> AND _query_:"{!lucene df=text}TERM2 TERM3 \"TERM4 TERM5\""
> (parsedquery is exactly the same).
> Obviously, there is the option of external parameter ({...
> v=$nestedq}&nestedq=...)
> This is a good solution, but it is not practical, when having a lot of such
> nested queries.
> BUT, when trying to put the nested query in place, it yields syntax error:
> http://localhost:8983/solr/collection1/select?debugQuery=true&defType=lucene&df=id&q=TERM1
> AND {!lucene df=text}(TERM2 TERM3 "TERM4 TERM5")
> org.apache.solr.search.SyntaxError: Cannot parse '(TERM2'
> The previous options are less preferred, because the escaping that should be
> made on the nested query.
> {quote}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]