Closed tjvc closed 3 months ago
Hi @tjvc, I'd be open to this. Would you be keen to put together a PR with some documentation and tests? :)
Thanks @brendon! I'll see if I can put a PR together in the next couple of weeks for you to take a look at.
Sounds good! :D
@brendon let me know what you think of #203 when you have a moment to take a look? Thanks! 🙇♂️
That's a really nice PR :) One tweak and we'll be GTG :)
Addressed in #203 - thanks @brendon! 🙌
Thank you too! :D
We index a model with a
row_order
column in Elasticsearch, and use this field to sort query results. We re-index records by way of anafter_commit
callback on the model. ranked-model usesupdate_all
when rebalancing ranks, which skips callbacks. For us, this means that therow_order
in Elasticsearch can drift from that in the database.I'm sure there are good reasons to skip callbacks when rebalancing ranks. I took a look at the gem source to see if there might be a way to hook into rebalancing events that we could use to trigger a re-index of all records when needed (as opposed to whenever a single row order changes, just in case a rebalancing has occurred), but couldn't see one. Do you have any suggestions or thoughts on our use case? I wondered if something like instrumenting the gem with ActiveSupport notifications might provide a light touch way of enabling users to listen for rebalancing events and react to them if needed.