zope.index.text.OkapiIndex reindexing is broken
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.
[(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.
[(1, '0.4545')]
Test case (textindex.txt)
fixed _reindex_doc for OkapiIndex:
def _reindex_doc(self, docid, text):
old_docw = self._docweight
count = BaseIndex.
if count > -1:
return count
Fix applied (except for the part with weight checking), weights are calculated separately. And released as an egg.