4teamwork / ftw.solr

Solr integration for Plone
5 stars 5 forks source link

Fix indexing of SearchableText only for objects with primary field. #179

Closed njohner closed 3 years ago

njohner commented 3 years ago

Two problems surfaced that hinder reindexing only SearchableText and UID in opengever.core. UID is of course used only to avoid reindexing everything in Gever catalog, so we really only want to reindex the SearchableText in solr. When indexes are specified, collective.indexing will actually pass the attributes as a tuple. The handler in ftw.solr, tries to remove SearchableText from that tuple, which fails.

Moreover the add_atomic_update_modifier will return None whenever the attributes list contains only the unique_key, i.e. UID in our case. In such cases, the call of the extract method would fail, because it tries to retrieve the unique_key from that empty dictionary.

For https://4teamwork.atlassian.net/browse/CA-1361

njohner commented 3 years ago

Yes you're right it returns None in that case (🙈), the end result is the same. And yes, it does not get called when the attributes list is empty, but it would also return None in that case 😅

njohner commented 3 years ago

I've updated the description for clearer future reference.