-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FieldIndex value of None should be unindexed, not just ignored #100
Comments
That comment is no longer valid with BTrees >= 4.4.0 (2017-01-11). Those versions again allow |
I was about to submit a PR but given your comment, perhaps this condition should just be removed entirely? |
Eric Wohnlich wrote at 2020-5-5 13:44 -0700:
Reported here first plone/Products.CMFPlone#3064
There is a note [here](https://github.com/zopefoundation/Products.ZCatalog/blob/5.1/src/Products/PluginIndexes/unindex.py#L253) from @hannosch that a value of None should not be indexed because of limitations in BTrees 4.0+.
This `BTrees` restriction has meanwhile be removed.
Nevertheless, I think it a good idea to interpret "None" as "no value"
(and do not index it in the normal way; @andbag has worked on
indexing it as a "special value").
That makes sense, but if the value has changed from _something_ to None I think it would make sense to also remove the old value if one exists.
I agree with you. This is a bug.
|
I will fix up that branch as submit as a PR along those lines then. Also, I would like to hear more about @andbag's work on that if someone could direct me to it. I have a use case where users need to be able to search for content that have a None value (or some other python False value like an empty string). To do that I am currently using Plone indexers that assign some magic value in those cases. It would be much better if the Index itself could handle this natively. But this need to be connected with a fix here by any means. |
* proposed fix for #100, case where index value is changed to None after previously being indexed * remove pycharm junk * remove old comment as no longer relevant in BTrees. But we still want to not index None values * use assertRaises instead of try/except for expected KeyError Co-authored-by: wohnlice <wohnlice@imsweb.com>
Fixed in: #103 |
Reported here first plone/Products.CMFPlone#3064
There is a note here from @hannosch that a value of None should not be indexed because of limitations in BTrees 4.0+. That makes sense, but if the value has changed from something to None I think it would make sense to also remove the old value if one exists.
My original case was on a Plone site:
The result is pub1 is still found for a query on pmid="1"
The text was updated successfully, but these errors were encountered: