fix(llm): fold fingerprint/hash skip counts into index_docs skipped (refs #615)
This commit is contained in:
@@ -238,4 +238,8 @@ def index_docs(
|
|||||||
stats = index_refs(
|
stats = index_refs(
|
||||||
refs, collection=collection, cfg=cfg, pool=pool, force=force, sealed=None
|
refs, collection=collection, cfg=cfg, pool=pool, force=force, sealed=None
|
||||||
)
|
)
|
||||||
return {k: stats[k] for k in ("indexed", "skipped", "chunks")}
|
# Fold the fingerprint/hash skip counters into "skipped" so the 3-key
|
||||||
|
# contract still means "not embedded" — index_refs itself keeps them
|
||||||
|
# separate; this is only a local projection.
|
||||||
|
skipped = stats["skipped"] + stats["fingerprint_skipped"] + stats["hash_skipped"]
|
||||||
|
return {"indexed": stats["indexed"], "skipped": skipped, "chunks": stats["chunks"]}
|
||||||
|
|||||||
@@ -56,12 +56,9 @@ class TestIndexDocs:
|
|||||||
assert kwargs["ids"][0].startswith("K1:")
|
assert kwargs["ids"][0].startswith("K1:")
|
||||||
|
|
||||||
def test_unchanged_doc_skipped(self):
|
def test_unchanged_doc_skipped(self):
|
||||||
"""A hash match lands in the internal ``hash_skipped`` bucket, which
|
|
||||||
index_docs (indexed/skipped/chunks only) doesn't surface — but it
|
|
||||||
must not be embedded or counted as indexed."""
|
|
||||||
h = content_hash(DOC.text)
|
h = content_hash(DOC.text)
|
||||||
stats, store, _, _ensure_hnsw = _run([DOC], state_rows=[("K1", h, "")])
|
stats, store, _, _ensure_hnsw = _run([DOC], state_rows=[("K1", h, "")])
|
||||||
assert stats["indexed"] == 0
|
assert stats["skipped"] == 1
|
||||||
store.add_embeddings.assert_not_called()
|
store.add_embeddings.assert_not_called()
|
||||||
|
|
||||||
def test_changed_doc_deletes_old_chunks_first(self):
|
def test_changed_doc_deletes_old_chunks_first(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user