Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions openviking/storage/vectordb/index/local_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,18 @@ def drop(self):
def need_rebuild(self) -> bool:
"""Determine if the index needs rebuilding.

For persistent indexes, rebuilding is typically not needed as
persistence handles compaction. Returns False to avoid unnecessary rebuilds.
When the index has no data entries but the store contains data,
a rebuild is needed to populate the index from the store.
This handles the case where upsert_to_index silently fails
for persistent indexes, leaving the store growing but the
index empty.

Returns:
bool: False (persistent indexes don't require periodic rebuilds)

Note:
Subclasses could override this to implement deletion-ratio-based
rebuild triggers if needed for space reclamation.
bool: True if index has 0 data entries, False otherwise.
"""
try:
if self.get_data_count() == 0:
return True
except Exception:
pass
return False
Loading