gom
unread,Feb 2, 2012, 2:29:06 AM2/2/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-haystack
I'm just looking at haystack with solr for the first time and trying
to figure out if there is a way to update a model's index when new
instances of the model are created, or if there is a normal pattern
for keeping indexes up to date as new model data is created.
Essentially I have some third party data being queried every 5 min,
and from the results of that query I might see a list of new models to
be created. I'd like to index all the new models every time this
happens. I see that you can do something like:
from haystack import site
index = site.get_index(ModelA)
index.update() # or index.reindex()
I'm assuming it would be a dumb idea to, say, put this in a model's
post_save() method or something. Is there a common pattern for
automatically updating an index, short of running code similar to the
above at clever junctions or throwing it into cron? How is this
normally tackled?
Cheers