Exact phrase query problem

40 views
Skip to first unread message

Istvan Farkas

unread,
Sep 26, 2012, 1:07:52 PM9/26/12
to python-...@googlegroups.com
Hello,

I've run into a problem I cannot solve for some reason. For a project I needed a bunch of complicated forms to query and filter a large dataset. Everything is working perfectly, except if I try to do an exact phrase query. 

A small example - I would like to get all the documents where the title contains the word 'dog' and the except contains the exact phrase of "german sepherd". 

When I submit the form, my form handler prepares the following query dictionary:

{ 'title': u'dog', 'excerpt':u'"german sepherd"' } # Thats a ' followed by a "

So far so good. But the query string sent to the Solr instance looks like this:

[('q', 'title:dog AND excerpt:\\"german sepherd\\"'), ('sort', 'created_at desc')]

The quotes are escaped, and the query itself isn't working this way - it shows all the documents which have either "german" or "sepherd" in their excerpts. 

Any ideas what I am doing wrong? Just as a quick-and-dirty test I removed the quote from the lucene_special_chars list in strings.py, and that way it works perfectly, but I would like to avoid this solution for obvious reasons :-)

I would appreciate any help or ideas.

Thanks!

Istvan  



Reply all
Reply to author
Forward
0 new messages