Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Add also the portal type on deletion of the index to make sure we hav…
Browse files Browse the repository at this point in the history
…e all needed info
  • Loading branch information
bloodbare committed Nov 28, 2016
1 parent 2b44d32 commit f7585d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/plone.server/plone/server/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ def __call__(self):
ident = schema.getName() + '-' + real_field.getName()
values[ident] = json_compatible(value)

# Look for plone.indexer
# TODO

# Global Roles

roles = {}
Expand Down
8 changes: 7 additions & 1 deletion src/plone.server/plone/server/catalog/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def remove_object(obj, event):
uid = getattr(obj, 'uuid', None)
if uid is None:
return
hook.remove.append(uid)
portal_type = getattr(obj, 'portal_type', None)
if portal_type is None:
return
hook.remove.append((uid, portal_type))
if uid in hook.index:
del hook.index[uid]

Expand All @@ -76,6 +79,9 @@ def add_object(obj, event):
uid = getattr(obj, 'uuid', None)
if uid is None:
return
portal_type = getattr(obj, 'portal_type', None)
if portal_type is None:
return
search = queryUtility(ICatalogUtility)
if search is not None:
hook.index[uid] = search.get_data(obj)
Expand Down

0 comments on commit f7585d8

Please sign in to comment.