Issue #267 resolved

sorting does not work, sometimes

Thomas Waldmann
created an issue

sorting does not work sometimes, see the attached code.

for AMOUNT < 8, the tests work.

for AMOUNT >= 8, they fail. it looks like it completely "forgets" to sort, the results are in same order as they were added to the index.

obviously, sorting should work for any amount. :)

Thanks to Pavel Sviderski for discovering this bug and working on the tests.

Comments (2)

  1. Matt Chaput repo owner

    Fixed a bug in MultiReader._merge_terms() with empty iterators. Fixes issue #267.

    This took a long time to realize, but I was calling next() without catching StopIterator when getting the first terms from each iterator. If the iterator was empty, it would raise StopIterator. Since it wasn't caught, the exception propagated upwards, and then since the method itself is a generator, the StopIterator would be silently swallowed and the generator would exit, making it seem like the method would just return for no reason.

    cfbe6573adb0

  2. Log in to comment