Tatoeba/tatoeba2 — pull request #488 by jiru (2014-11-03 13:24:31+00:00)
Title: Live-update Sphinx attributes

The Sphinx indexes contain attributes we use as criteria to perform searches. As [explained here](https://github.com/Tatoeba/tatoeba2/issues/233#issuecomment-58932768), the delta index isn’t updated properly when links are modified. This pull request solves this problem by live-updating the `trans_id` attribute (which contains the languages a sentence is directly and indirectly translated into) for every sentence that is impacted by a link change. In addition, it also live-updates the `user_id` and `ucorrectness` attributes, so that the ranking of search results is instantly updated regarding correctness and orphan status of indexed sentences.

Sphinx has a [technical limitation regarding MVA attributes](http://sphinxsearch.com/docs/current.html#conf-mva-updates-pool). `trans_id` is an MVA attribute, so updating it will fail at some point, but I really don’t know when. The documentation isn’t really clear, I suppose we may increase the Sphinx `mva_updates_pool` option to make it fail slower, but I really don’t know what value we should set. We want to make it stand until the next index rebuild, which is currently one week. Having the update failing isn’t a big deal though, it will just work like it is now and spam logs. So I suggest we test it is production, keep watching the logs for MVA attributes errors and adjust `mva_updates_pool` accordingly.