BooleanIndex index becomes wrong when index value is inverted during a RE-indexation

Bug #1236354 reported by Thomas Desvenain
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Medium
Tres Seaver

Bug Description

This test (for now in tdesvenain fork) fails :
self.assertEqual(list(res), [1, 3, 4]) is wrong because '1' document is always indexed with False value

    def test_reindexation_when_index_reversed(self):
        index = self._makeOne()
        obj1 = Dummy(1, False)
        index._index_object(obj1.id, obj1, attr='truth')
        obj2 = Dummy(2, False)
        self.assertTrue(index._index_value)
        index._index_object(obj2.id, obj2, attr='truth')
        obj3 = Dummy(3, True)
        index._index_object(obj3.id, obj3, attr='truth')
        obj4 = Dummy(4, True)
        index._index_object(obj4.id, obj4, attr='truth')
        obj1.truth = True
        index._index_object(obj1.id, obj1, attr='truth')
        self.assertFalse(index._index_value)

        res = index._apply_index({'truth': True})[0]
        self.assertEqual(list(res), [1, 3, 4])

Revision history for this message
Thomas Desvenain (thomas-desvenain) wrote :

AssertionError: Lists differ: [3, 4] != [1, 3, 4]

First differing element 0:
3
1

Second list contains 1 additional elements.
First extra element 2:
4

- [3, 4]
+ [1, 3, 4]
? +++

Revision history for this message
Thomas Desvenain (thomas-desvenain) wrote :

I work on this bug there :
https://github.com/tdesvenain/Products.ZCatalog

But i need some help... :)

Revision history for this message
Thomas Desvenain (thomas-desvenain) wrote :

I submited a pull request

Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in zope2:
status: New → Incomplete
assignee: nobody → Tres Seaver (tseaver)
importance: Undecided → Medium
status: Incomplete → Fix Committed
Revision history for this message
Thomas Desvenain (thomas-desvenain) wrote :

Fixed in master

Revision history for this message
Hanno Schlichting (hannosch) wrote :

Released in 3.0.1 / 2.13.25.

Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.