Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion celery_haystack/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@


class CelerySearchIndex(indexes.SearchIndex):
pass

def update_object(self, instance, using=None, **kwargs):
"""Remove an object if it is no longer in the index_queryset"""

ids = self.index_queryset(**kwargs).values_list('id', flat=True)
if instance.id not in ids:
self.remove_object(instance)
else:
super(ProjectIndex, self).update_object(instance, using, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a project-specific subclass ProjectIndex