search5 / solrpy

Automatically exported from code.google.com/p/solrpy
Other
40 stars 17 forks source link

More flexible sort in queries #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

solr_conn = solr.SolrConnection('http://localhost:8080/solr')

solr_conn.query('test query', sort='field1 asc, field2 desc')

This doesn't work. I get a "400 Bad Request" response.

According to the docstrings, the sort param could be a string in the format
that SOLR expects, or a python list/tuple of field names.

I've attached a diff with a proposed fix for this.

Original issue reported on code.google.com by augusto%...@gtempaccount.com on 26 May 2009 at 8:35

Attachments:

GoogleCodeExporter commented 9 years ago
I've attached a new diff including the fix for the paginator.

Original comment by augusto%...@gtempaccount.com on 26 May 2009 at 9:35

Attachments:

GoogleCodeExporter commented 9 years ago
I did encounter the same problem, however I came up with a slightly different 
solution 
that should preserve backwards compatibility (or, atleast, makes all tests 
pass).

Original comment by shywolf9...@gmail.com on 4 Feb 2010 at 9:54

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm, so it looks like we've got two potential patches to choose from. Can you 
both 
perhaps work together on a common approach, and add a unittest for the new 
functionality? Perhaps it would help if you both could work off of trunk w/ svn 
commit 
bits?

Original comment by ed.summers on 4 Feb 2010 at 11:43

GoogleCodeExporter commented 9 years ago
Well, my approach does not differ greatly. It does not break backwards 
compatibility 
(which I think is very needed) although it lacks the paginator fix, which 
should be 
definitely incorporated, along with unit tests.

So yes, I am available to work with whoever is interested or by submitting 
another 
"mixed" patch (meaning with a reasonable mix of the two approaches plus unit 
tests) 
against trunk.

Original comment by shywolf9...@gmail.com on 4 Feb 2010 at 11:59

GoogleCodeExporter commented 9 years ago
Attached a patch against trunk, revision 52 (most recent rev at time of 
writing) that 
incorporates the best of both approaches and adds a test.

Original comment by shywolf9...@gmail.com on 6 Feb 2010 at 4:42

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r53

Original comment by ed.summers on 7 Feb 2010 at 9:13