collective / Products.PloneKeywordManager

Change, merge and delete keywords (AKA tags or subjects) in Plone.
https://pypi.org/project/Products.PloneKeywordManager/
4 stars 8 forks source link

Updating Searchable Text indexes after keyword action. #62

Closed flipmcf closed 2 years ago

flipmcf commented 2 years ago

I'd like this to go into https://github.com/collective/Products.PloneKeywordManager/pull/48 (potentially named 4.0.0) because it's coming from our customer and I think it's somewhere between extremely easy and relatively easy to implement.

I've been testing Keyword Manager and found that deleting a keyword or tag from Keyword Manager needs to reindex the SearchableText index for the search for the deleted keyword to work.

How to re-produce:

  • Go to an [object] and add a unique keyword (something not in the Subject index) say 'xxxxxxxx' on the Categorization tab and save the [object]
  • Search for 'xxxxxxxx' in Plone and you will get the [object] listed in the search result page

http://localhost:8080/@@search?SearchableText=xxxx

  • Go to Keyword Manager and find the 'xxxxxxxx' and delete it
  • Search for 'xxxxxxxx' in Plone and you will still get the [object] listed in the search result page (restarting the instance and doing the search makes no difference)
  • Reindex the SearchableText index
  • Serach for 'xxxxxxxx' again, the [object] will not show up
flipmcf commented 2 years ago

Sledgehammer attempt - just call reindexObject() and don't provide the index names.

Even better: https://docs.plone.org/develop/plone/content/manipulating.html

flipmcf commented 2 years ago

Well, it seems this request is in direct conflict with an opinion from ten years ago: https://github.com/collective/Products.PloneKeywordManager/commit/c7e3a478ca0f2a8bff7dd9aceac9ad18fc865be1

I'm tempted to go back an reindex everything, but obviously that bothered someone... maybe doing an intelligent search for SearchableText indexes that use the KeywordIndex in question is the right answer.

Editing a config.py and adding the searchable text index into config.ALWAYS_REINDEX is not an acceptable answer for modern Plone use. I guess we could use a configuration registry....

I'm still feeling that this (updating SearchableText Indexes) should be handled 'magically' by keyword manager.