search including single quote fails in SOLR, only when sorting!?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

search including single quote fails in SOLR, only when sorting!?

John Kleven-3
Search for the word jam's -- including the single quote. (%27 is a single
quote encoded for URL)

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).

Also, if i just search jam (and ditch the 's) then I AM able to sort.  I'm
using the standard tokenizer/filter, and stemming, so it always comes down
to just jam anyways.  But w/ the quote, it cannot be sorted.  Strange.

Ideas?  Sorry if this is too vague or has already been posted.

j
Reply | Threaded
Open this post in threaded view
|

Re: search including single quote fails in SOLR, only when sorting!?

Yonik Seeley-2
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.

-Yonik

On 2/2/07, John Kleven <[hidden email]> wrote:

> Search for the word jam's -- including the single quote. (%27 is a single
> quote encoded for URL)
>
> 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).
>
> Also, if i just search jam (and ditch the 's) then I AM able to sort.  I'm
> using the standard tokenizer/filter, and stemming, so it always comes down
> to just jam anyways.  But w/ the quote, it cannot be sorted.  Strange.
>
> Ideas?  Sorry if this is too vague or has already been posted.
>
> j
Reply | Threaded
Open this post in threaded view
|

Re: search including single quote fails in SOLR, only when sorting!?

John Kleven-3
Thanks for the response.  JIRA issue opened.

http://issues.apache.org/jira/browse/SOLR-140

J

On 2/2/07, Yonik Seeley <[hidden email]> wrote:

>
> 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.
>
> -Yonik
>
> On 2/2/07, John Kleven <[hidden email]> wrote:
> > Search for the word jam's -- including the single quote. (%27 is a
> single
> > quote encoded for URL)
> >
> > 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).
> >
> > Also, if i just search jam (and ditch the 's) then I AM able to
> sort.  I'm
> > using the standard tokenizer/filter, and stemming, so it always comes
> down
> > to just jam anyways.  But w/ the quote, it cannot be sorted.  Strange.
> >
> > Ideas?  Sorry if this is too vague or has already been posted.
> >
> > j
>
Reply | Threaded
Open this post in threaded view
|

Re: search including single quote fails in SOLR, only when sorting!?

John Kleven-3
I applied the patch here (split_sort.txt)

https://issues.apache.org/jira/browse/SOLR-140

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.

Thx
J

On 2/4/07, John Kleven <[hidden email]> wrote:

>
> Thanks for the response.  JIRA issue opened.
>
> http://issues.apache.org/jira/browse/SOLR-140
>
> J
>
> On 2/2/07, Yonik Seeley <[hidden email]> wrote:
> >
> > 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.
> >
> > -Yonik
> >
> > On 2/2/07, John Kleven < [hidden email]> wrote:
> > > Search for the word jam's -- including the single quote. (%27 is a
> > single
> > > quote encoded for URL)
> > >
> > > 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).
> > >
> > > Also, if i just search jam (and ditch the 's) then I AM able to
> > sort.  I'm
> > > using the standard tokenizer/filter, and stemming, so it always comes
> > down
> > > to just jam anyways.  But w/ the quote, it cannot be sorted.  Strange.
> > >
> > > Ideas?  Sorry if this is too vague or has already been posted.
> > >
> > > j
> >
>
>