mfares / solrpy

Automatically exported from code.google.com/p/solrpy
0 stars 0 forks source link

params not included in next_batch #27

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. res = s.select(keyword, fields='id,pubDate')
2. res = res.next_batch()

What is the expected output? What do you see instead?
1. solr => path=/select params={fl=id,pubDate,score ...
2. solr => path=/select params={fl=*,score ...

(2) missing field list param

What version of the product are you using? On what operating system?
solrpy-0.9.4, Windows

Please provide any additional information below.

Original issue reported on code.google.com by otor...@gmail.com on 6 Apr 2011 at 9:44

GoogleCodeExporter commented 8 years ago
The problem is that the 'fields' argument to SearchHandler.__call__ gets 
renamed to 'fl'. So this would be fixed by inserting the following into that 
method:

fields = params.pop('fl', fields)

Original comment by joel.nothman@gmail.com on 28 Oct 2012 at 5:46

GoogleCodeExporter commented 8 years ago
This monkey-patch works:

import solr
old_call = solr.core.SearchHandler.__call__
def new_call(self, q=None, fields=None, *args, **params):
    print 'in new_call'
    fields = params.pop('fl', fields)
    return old_call(self, q, fields, *args, **params)

solr.core.SearchHandler.__call__ = new_call

Original comment by joel.nothman@gmail.com on 1 Nov 2012 at 6:43

GoogleCodeExporter commented 8 years ago
minus the print statement obviously...

Original comment by joel.nothman@gmail.com on 1 Nov 2012 at 6:44