zope.index.text.OkapiIndex reindexing is broken

Bug #109923 reported by Ignas Mikalajūnas
2
Affects Status Importance Assigned to Milestone
Zope 3
Fix Released
Undecided
Unassigned

Bug Description

If we index the same document twice, once with a zero value, and then
with a normal value, it should still work:

    >>> index2 = TextIndex()
    >>> index2.index_doc(1, [])
    >>> index2.index_doc(1, ["Zorro"])

    >>> [(k, "%.4f" % v) for (k, v) in index2.apply("Zorro").items()]
    [(1, '0.4545')]

Weights are the same as if we would have indexed the document only
once:

    >>> index2 = TextIndex()
    >>> index2.index_doc(1, ["Zorro"])

    >>> [(k, "%.4f" % v) for (k, v) in index2.apply("Zorro").items()]
    [(1, '0.4545')]

Test case (textindex.txt)

fixed _reindex_doc for OkapiIndex:

    def _reindex_doc(self, docid, text):
        old_docw = self._docweight[docid]
        count = BaseIndex._reindex_doc(self, docid, text)
        if count > -1:
            self._totaldoclen -= old_docw
        return count

Revision history for this message
Ignas Mikalajūnas (ignas) wrote :

Fix applied (except for the part with weight checking), weights are calculated separately. And released as an egg.

Changed in zope3:
status: Unconfirmed → 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.