When value used for a FieldIndex is None, the indexer will not index it because a value of None is not supported. However if it previously had a value, the result is that the index retains this old value.
Create a FieldIndex 'pmid'. Create this content and set some value for pmid, say "1". Edit the content to empty this field.
What I expect to happen:
The pmid index should have no entries.
What actually happened:
The pmid index still has an entry of "1" for my content. As a separate issue, Dexterity should probably be saving my content with a value for pmid of '' per the default, not a value of None.
This bug was initially reported here: https://community.plone.org/t/fieldindex-does-not-update-when-field-updated-to-be-empty-value/11929
When value used for a FieldIndex is None, the indexer will not index it because a value of None is not supported. However if it previously had a value, the result is that the index retains this old value.
I think that the logic here https://github.com/zopefoundation/Products.ZCatalog/blob/5.0.1/src/Products/PluginIndexes/unindex.py#L253 is probably not quite right in that if it yields a value of None (not supported) it simply returns. It should probably also unindex before returning, if applicable.
I've only tested this with FieldIndex, not other subclasses of UnIndex.
What I did:
Create a Dexterity content type with schema consisting of
Create a FieldIndex 'pmid'. Create this content and set some value for pmid, say "1". Edit the content to empty this field.
What I expect to happen:
The pmid index should have no entries.
What actually happened:
The pmid index still has an entry of "1" for my content. As a separate issue, Dexterity should probably be saving my content with a value for pmid of '' per the default, not a value of None.
What version of Plone/ Addons I am using:
5.2.1