Fix path metadata consistency in incremental vector store updates

Prepend "./" to file paths passed to SimpleDirectoryReader during
incremental updates so source document metadata matches full rebuilds.
Also add API_key_temp to .gitignore.
This commit is contained in:
Eric 2026-02-20 07:32:06 -05:00
commit c47c5e5c4f
2 changed files with 5 additions and 1 deletions

1
.gitignore vendored
View file

@ -23,6 +23,7 @@ data
# Secrets
.env
API_key_temp
# Query log
query.log

View file

@ -145,7 +145,10 @@ def update():
files_to_add = new_files + [fpath for fpath, _ in modified_files]
if files_to_add:
print(f"\nIndexing {len(files_to_add)} file(s)...")
docs = SimpleDirectoryReader(input_files=[str(f) for f in files_to_add]).load_data()
# Use "./" prefix to match paths from full build (pathlib strips it)
docs = SimpleDirectoryReader(
input_files=[f"./{f}" for f in files_to_add]
).load_data()
for doc in docs:
index.insert(doc)