Freshness: re-indexing on events
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
keep the index current by re-embedding only what changed.
Planned topics
- Nightly full rebuilds are slow, costly, and leave answers stale for hours.
- Event-driven:
HelpArticleUpdated(via the outbox, see messaging modules) triggers re-chunking and re-embedding of that article. - Compare a content hash per chunk and skip unchanged chunks to save embedding calls.
- Replace chunks atomically (delete old, insert new in one transaction); handle
HelpArticleDeletedtoo. - Handlers must be idempotent: the same event twice gives the same index.
Draft outline details
Demonstration
event HelpArticleUpdated{articleId:42, version:7} → consumer → chunk → hash compare → embed 2 changed chunks → transaction replaces rows of article 42.
Check your understanding
Why make the re-index handler idempotent?
Show answer
Events can be delivered more than once.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.