[Zope-dev] Index errors revisited: KeywordIndex unindex_object could not remove documentId -883140122 from index ComponentVersions. This should not happen.

Dieter Maurer dieter@handshake.de
Thu, 27 Feb 2003 20:43:10 +0100


Jean Jordaan wrote at 2003-2-27 16:45 +0200:
 > We've posted about this before, but never managed to pin down
 > the issue nicely. It doesn't interfere with our application,
 > as far as we could tell, so we've let it slide. Here's another
 > attempt at formulating the problem.

The reason is very simple:

  In order to unindex objects later, Zope's indexes remember
  the values an object has been indexed by.

  "KeywordIndex" is a bit stupid about this.
  If the sequence contains duplicates, it does not remove
  them.
  Later, when the object is unindexed, it tries to remove
  the object from the list for each term in the sequence.
  In case of a duplicate, this goes well when it is
  encountered for the first time but, when it is encountered
  again, the object can (of course) not be removed...

The fix: fix "KeywordIndex" such that is removes duplicates
  from "_unindex[documentId]".


Dieter