mitodl / lore

Learning Object Repository for Education
https://goo.gl/nDVx4D
GNU Affero General Public License v3.0
16 stars 6 forks source link

Update search index when taxonomy items are changed. #155

Closed ShawnMilo closed 9 years ago

ShawnMilo commented 9 years ago

Changes made to taxonomy items for a LearningResource should take effect in the search immediately.

Ferdi commented 9 years ago

@ShawnMilo now sure what you have in mind here. When you add/edit a term for a learningresource, that would trigger a post_save (?) signal on the learningresrouce, so it will get reindexed -- based on what you did in #147.

ShawnMilo commented 9 years ago

If a LearningResource object has terms added or removed, we will need to add an m2m-changed signal, because the actual LearningResource doesn't get re-saved -- the save happens in the hidden intermediate table automatically created by the use of the ManyToManyField

Just to make sure, I threw together a little Django project with a post-save signal and checked when the model was saved versus the many-to-many field getting a new item. Adding a many-to-many item doesn't trigger the original model's post-save.

Ferdi commented 9 years ago

Got it, thanks!

ShawnMilo commented 9 years ago

Closing; will be handled as a detail in #159.