I observed that whoosh was getting into infinite loop for certain queries. I traced the issue and determined that it is in the skip_to_quality function in matching\combo.py
In that code, the variable skipped can incremented infinitely. It looks like the search is continuing even when the maximum number of docs is reached. The following patch seem to have fixed the problem but since I have don't know the code-base or the algorithm used in whoosh, I am not sure if it is the right solution.
I hope this helps fixing the problem. If it does not, I can send code and the whoosh index where the problem is happening.
def skip_to_quality(self, minquality): skipped = 0 # REMOVED # while self.block_quality() <= minquality: while self.block_quality() <= minquality and skipped <= self._partsize: #ADDED print "skipped: ", skipped skipped += 1 self._docnum = self._limit self._read_part() self._find_next() return skipped