diff --git a/backend/search.py b/backend/search.py index 6654b0b..6a98e05 100644 --- a/backend/search.py +++ b/backend/search.py @@ -361,6 +361,10 @@ class InvertedIndex: self._sorted_tokens: "SortedList" = SortedList() self._ready: bool = False # True after initial build + def is_stale(self) -> bool: + """Return True if the index has not been built yet.""" + return not self._ready + def rebuild(self) -> None: """Rebuild inverted index from the global ``index`` dict.