Page MenuHomePhabricator

When updating a Ferret search index document, reuse existing rows where possible
Needs ReviewPublic

Authored by epriestley on Thu, Nov 19, 9:36 PM.
This revision needs review, but there are no reviewers specified.

Details

Summary

Ref T13587. Currently, when a document is reindexed by Ferret, the old document is completely discarded and a new version is inserted to replace it.

This approach is simple to implement, but can lead to exhaustion of the ngram AUTO_INCREMENT id column in reasonable circumstances.

Conceptually, this approach "should" be fine and this exhaustion is an awkard implementation detail. However, since it's easy to be less wasteful when performing document updates and all the other approaches are awkward or leaky in other ways that are probably worse, use a more complex implementation to avoid executing unnecessary INSERT statements.

Test Plan
  • Created and indexed a new document, searched for it.
  • Updated a document, indexed it with bin/search index ... --force --trace, saw only modifications updated in the index.
  • Searched for newly added terms (got hits) and removed terms (no longer got hits) to verify add/delete index behavior.

Diff Detail

Repository
rP Phabricator
Branch
defrag1
Lint
Lint OK
Unit
Unit Tests OK
Build Status
Buildable 24972
Build 34461: Run Core Tests
Build 34460: arc lint + arc unit