From 51624840f2c516d8e866ae24788e6cb7bcb6cd96 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Mon, 6 Apr 2026 14:33:45 -0700 Subject: [PATCH] docs: note autocomplete as candidate for Redis caching Co-Authored-By: Claude Opus 4.6 --- src/documents/search/_backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/documents/search/_backend.py b/src/documents/search/_backend.py index eb38fe58b..df2b73f7d 100644 --- a/src/documents/search/_backend.py +++ b/src/documents/search/_backend.py @@ -670,6 +670,10 @@ class TantivyBackend: frequency (how many documents contain each word). Optionally filters results to only words from documents visible to the specified user. + NOTE: This is the hottest search path (called per keystroke). + A future improvement would be to cache results in Redis, keyed by + (prefix, user_id), and invalidate on index writes. + Args: term: Prefix to match against autocomplete words limit: Maximum number of suggestions to return