solrpy icon indicating copy to clipboard operation
solrpy copied to clipboard

params not included in next_batch

Open GoogleCodeExporter opened this issue 10 years ago • 6 comments

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 [email protected] on 6 Apr 2011 at 9:44

GoogleCodeExporter avatar Mar 13 '15 21:03 GoogleCodeExporter

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 [email protected] on 28 Oct 2012 at 5:46

GoogleCodeExporter avatar Mar 13 '15 21:03 GoogleCodeExporter

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 [email protected] on 1 Nov 2012 at 6:43

GoogleCodeExporter avatar Mar 13 '15 21:03 GoogleCodeExporter

minus the print statement obviously...

Original comment by [email protected] on 1 Nov 2012 at 6:44

GoogleCodeExporter avatar Mar 13 '15 21:03 GoogleCodeExporter

I'm having this problem too.

next_batch() also loses the "score" parameter from the original search, so it ends up defaulting to "True". The monkey-patch kinda works for me, but I had to add

score=False

dwoo avatar Feb 04 '16 23:02 dwoo

Is this related at all to #36? If someone has time to send a pull request I can merge it in and release it.

edsu avatar Feb 05 '16 01:02 edsu

If it means anything, I had this same issue in both versions for python 2 and 3. I actually ran a performance test on my data to show the difference it made and verify the problem. The monkey patch worked perfectly.

solr_call_fix

spanishgum avatar Mar 24 '17 22:03 spanishgum