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:
parent
e9fc99ddc6
commit
c47c5e5c4f
2 changed files with 5 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -23,6 +23,7 @@ data
|
|||
|
||||
# Secrets
|
||||
.env
|
||||
API_key_temp
|
||||
|
||||
# Query log
|
||||
query.log
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue