You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "John Kleven (JIRA)" <ji...@apache.org> on 2007/02/04 09:15:05 UTC

[jira] Created: (SOLR-140) single quote in search query will break any sorts

single quote in search query will break any sorts
-------------------------------------------------

                 Key: SOLR-140
                 URL: https://issues.apache.org/jira/browse/SOLR-140
             Project: Solr
          Issue Type: Bug
          Components: search
    Affects Versions: 1.1.0
         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
            Reporter: John Kleven


Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.

For example,
If  I want to search for the word ----   jam's   ---- 
including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.

Note: %27 is a single quote encoded for URI's

Here's the examples....
http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)

Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).

email rsp from Yonik:
Hmmm, Solr tries to be smart about splitting the query from the sort
specification.
If it sees a semicolon inside quotes (single or double), or backslash
escaped, then it will treat it as part of the query.

An immediate workaround would be to query for "jam's" or jam\'s

It would be helpful if you could open a JIRA issue for this.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-140) single quote in search query will break any sorts

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated SOLR-140:
------------------------------

    Attachment: split_sort.txt

A quick patch to the problem.
Not a complete solution, but it should make the situation better, with little cost.


> single quote in search query will break any sorts
> -------------------------------------------------
>
>                 Key: SOLR-140
>                 URL: https://issues.apache.org/jira/browse/SOLR-140
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
>            Reporter: John Kleven
>         Attachments: split_sort.txt
>
>
> Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.
> For example,
> If  I want to search for the word ----   jam's   ---- 
> including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.
> Note: %27 is a single quote encoded for URI's
> Here's the examples....
> http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
> http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)
> Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).
> email rsp from Yonik:
> Hmmm, Solr tries to be smart about splitting the query from the sort
> specification.
> If it sees a semicolon inside quotes (single or double), or backslash
> escaped, then it will treat it as part of the query.
> An immediate workaround would be to query for "jam's" or jam\'s
> It would be helpful if you could open a JIRA issue for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-140) single quote in search query will break any sorts

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473955 ] 

Yonik Seeley commented on SOLR-140:
-----------------------------------

Committed.
Perhaps try the next nightly build (2007-02-18 or later) with the app server in /example to verify.


> single quote in search query will break any sorts
> -------------------------------------------------
>
>                 Key: SOLR-140
>                 URL: https://issues.apache.org/jira/browse/SOLR-140
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
>            Reporter: John Kleven
>         Attachments: split_sort.txt
>
>
> Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.
> For example,
> If  I want to search for the word ----   jam's   ---- 
> including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.
> Note: %27 is a single quote encoded for URI's
> Here's the examples....
> http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
> http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)
> Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).
> email rsp from Yonik:
> Hmmm, Solr tries to be smart about splitting the query from the sort
> specification.
> If it sees a semicolon inside quotes (single or double), or backslash
> escaped, then it will treat it as part of the query.
> An immediate workaround would be to query for "jam's" or jam\'s
> It would be helpful if you could open a JIRA issue for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-140) single quote in search query will break any sorts

Posted by "John Kleven (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473494 ] 

John Kleven commented on SOLR-140:
----------------------------------

This patch didn't help me.  Details as follows:

I applied the patch (split_sort.txt)

I then recompiled this version:  apache-solr-1.1.0-incubating

using: ant compile then ant dist

I then copied:
/opt/apache-solr-1.1.0-incubating/dist/apache-solr-1.1.1-dev-incubating.war

as solr.war, and deployed it via tomcat.

Unfortunately, i could not find any differences in behaviour.

If I search for anything, and add a 's  (apostrophe s) AND use a sort (i.e.,
;price or whatever) it returns me no hits.  I did notice that with both pre
and post patched .war file, if you use an escape char (as u recommended) i.e.,
\'s it will work.

Maybe i didn't do something right, not sure.  Thanks for the patch though,
let me know if you would like me to try another.

> single quote in search query will break any sorts
> -------------------------------------------------
>
>                 Key: SOLR-140
>                 URL: https://issues.apache.org/jira/browse/SOLR-140
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
>            Reporter: John Kleven
>         Attachments: split_sort.txt
>
>
> Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.
> For example,
> If  I want to search for the word ----   jam's   ---- 
> including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.
> Note: %27 is a single quote encoded for URI's
> Here's the examples....
> http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
> http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)
> Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).
> email rsp from Yonik:
> Hmmm, Solr tries to be smart about splitting the query from the sort
> specification.
> If it sees a semicolon inside quotes (single or double), or backslash
> escaped, then it will treat it as part of the query.
> An immediate workaround would be to query for "jam's" or jam\'s
> It would be helpful if you could open a JIRA issue for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-140) single quote in search query will break any sorts

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473503 ] 

Yonik Seeley commented on SOLR-140:
-----------------------------------

Thanks for reminding me about this patch.
I just tried it out again and it works for me, so I think it's probably an installation issue, or you have a more complicated query than I've tested with.

Without patch:
http://localhost:8983/solr/select?indent=on&wt=json&q=solr%27s%3Bprice+desc&debugQuery=on

{
 "responseHeader":{
  "status":0,
  "QTime":0,
  "params":{
	"wt":"json",
	"indent":"on",
	"q":"solr's;price desc",
	"debugQuery":"on"}},
 "response":{"numFound":0,"start":0,"docs":[]
 },
 "debug":{
  "rawquerystring":"solr's;price desc",
  "querystring":"solr's;price desc",
  "parsedquery":"PhraseQuery(text:\"solr price\") text:desc",
  "parsedquery_toString":"text:\"solr price\" text:desc",
  "explain":{}}}

With patch:
{
 "responseHeader":{
  "status":0,
  "QTime":100,
  "params":{
	"wt":"json",
	"indent":"on",
	"q":"solr's;price desc",
	"debugQuery":"on"}},
 "response":{"numFound":0,"start":0,"docs":[]
 },
 "debug":{
  "rawquerystring":"solr's;price desc",
  "querystring":"solr's",
  "parsedquery":"text:solr",
  "parsedquery_toString":"text:solr",
  "explain":{}}}

> single quote in search query will break any sorts
> -------------------------------------------------
>
>                 Key: SOLR-140
>                 URL: https://issues.apache.org/jira/browse/SOLR-140
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
>            Reporter: John Kleven
>         Attachments: split_sort.txt
>
>
> Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.
> For example,
> If  I want to search for the word ----   jam's   ---- 
> including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.
> Note: %27 is a single quote encoded for URI's
> Here's the examples....
> http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
> http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)
> Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).
> email rsp from Yonik:
> Hmmm, Solr tries to be smart about splitting the query from the sort
> specification.
> If it sees a semicolon inside quotes (single or double), or backslash
> escaped, then it will treat it as part of the query.
> An immediate workaround would be to query for "jam's" or jam\'s
> It would be helpful if you could open a JIRA issue for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-140) single quote in search query will break any sorts

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley resolved SOLR-140.
-------------------------------

    Resolution: Fixed

> single quote in search query will break any sorts
> -------------------------------------------------
>
>                 Key: SOLR-140
>                 URL: https://issues.apache.org/jira/browse/SOLR-140
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: SOLR nightly build 2007-02-01, but old builds as well.  Ubuntu 6.06 LTS server.  Tomcat 5.5.20
>            Reporter: John Kleven
>         Attachments: split_sort.txt
>
>
> Query strings that contain a single quote, properly escaped, break *as soon as you add a sort field*.
> For example,
> If  I want to search for the word ----   jam's   ---- 
> including the single quote, I can.  But as soon as I add a sort criteria to the URL, it breaks.
> Note: %27 is a single quote encoded for URI's
> Here's the examples....
> http://10.0.101.11:8080/forsale/select/?q=jam%27s    -- this works (i get ~20 hits back)
> http://10.0.101.11:8080/forsale/select/?q=jam%27s;score%20desc --- this doesn't (get 0 hits back)
> Seems that if the first query works, it shouldn't be breakable just by telling it explicitly to sort on score??  All other sorts break in this scenario as well ( i.e., price, etc).
> email rsp from Yonik:
> Hmmm, Solr tries to be smart about splitting the query from the sort
> specification.
> If it sees a semicolon inside quotes (single or double), or backslash
> escaped, then it will treat it as part of the query.
> An immediate workaround would be to query for "jam's" or jam\'s
> It would be helpful if you could open a JIRA issue for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.