toastdriven/django-haystack — Issue #502: Result of 1 hmmm
Author: rh0dium
Created: 2012-02-08 05:41:14+00:00
State: open

Hi guys,

Love the tool. I am seeing an odd behavior when I get a result of 1 item and then iterating over it shows seeminly random exist/doesn't exit behavior. Take the following sequence which I literally just up-arrowed so there was very little time or db changes.

>>> s = all_results.filter(content="helios").models(Variant)
>>> s.count()
1
>>> s
[]
>>> s = s[0]
>>> s = all_results.filter(content="helios").models(Variant)
>>> s
[]
>>> s = s[0]
>>> s = all_results.filter(content="helios").models(Variant)
>>> s = s[0]
Traceback (most recent call last):
File "", line 1, in
File "/Users/sklass/Documents/Projects/IC_Manage/Sponsor/icm_django/src/haystack/haystack/query.py", line 270, in __getitem__
return self._result_cache[start]
IndexError: list index out of range

So.. Why id the second assignment give me an index error when clearly there was an item there??

How do I even begin to track this down?