Please sign in to comment.
Don't reindex stories if they don't have a translation.
Fixes #108 Story objects get saved before their translation is attached. The RealTimeSearchIndex was trying to reindex on the post_save signal, but this was raising an exception because it was trying to access fields that are fetched from the related translation object. The fix was really simple. In the RealTimeSearchIndex subclass, implement ``should_update()`` and return false if no translation exists. This causes the story instance to only be indexed when the translation exists. The story is saved again as soon as the translation is attached, so the signal handler is re-run, this time passing the ``should_update()`` test.
- Loading branch information...
Showing with 12 additions and 0 deletions.