Real-time updates with celery-haystack when a model that's not indexed directly changed?

24 views
Skip to first unread message

Salvatore Iovene

unread,
Nov 4, 2017, 7:39:23 AM11/4/17
to django-haystack
Hi,
hopefully this question is not off-topic in this group, but I'm trying to setup quasi real-time updates using celery-haystack:


From what I understand, the HAYSTACK_SIGNAL_PROCESSOR thingy does it's magic when models that are indexed are saved.

However, in my index I also "prepare" virtual fields that depend on external models, so I would like to reindex my model X also when a certain other model Y changed.

For example, in pseudocode:

class MyModel():
 text = TextField()


class MyModelIndex(...):
  model = MyModel
  likes = IntegerField()

  prepare_likes():
    self.likes = do_query_against_other_model()

So, basically the "likes", in this example, are stored in another model that is not indexed, and I would like to connect an update to that model to the real-time index of "MyModel".

Can it be done?

TIA!
Salvatore


Reply all
Reply to author
Forward
0 new messages