Automatic index updating

602 views
Skip to first unread message

gom

unread,
Feb 2, 2012, 2:29:06 AM2/2/12
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

gom

unread,
Feb 2, 2012, 2:25:12 AM2/2/12
to django-haystack

Phill Tornroth

unread,
Feb 6, 2012, 10:46:06 PM2/6/12
to django-...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.


Reply all
Reply to author
Forward
0 new messages