Page MenuHomePhabricator

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

Authored by epriestley on Nov 19 2020, 9:36 PM.
Tags
None
Referenced Files
F14394707: D21495.id.diff
Sun, Dec 22, 2:25 AM
Unknown Object (File)
Sat, Dec 21, 7:47 AM
Unknown Object (File)
Fri, Dec 20, 8:53 PM
Unknown Object (File)
Wed, Dec 18, 4:20 AM
Unknown Object (File)
Mon, Dec 16, 6:27 AM
Unknown Object (File)
Sat, Dec 14, 7:17 AM
Unknown Object (File)
Wed, Dec 11, 12:36 PM
Unknown Object (File)
Thu, Nov 28, 9:23 AM
Subscribers
None

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable