Skip to content

Commit

Permalink
comment on correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongsun96 committed Oct 29, 2023
1 parent 31b509f commit 126f0e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions backend/danswer/document_index/vespa/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ def _index_vespa_chunks(
if chunk_already_existed:
already_existing_documents.add(chunk.source_document.id)

# In the logic below, we check if the chunk comes from a doc that has already been
# added to already_existing_document. This works because the chunks are ordered
# and because the Document chunks are not separated into different batches.
# The first chunk is processed first and if it exists, then its entire document
# is marked as already existing, so if the document length increases and new chunks
# are added, they must come last in processing and the doc would already be in
# already existing documents.
insertion_records.add(
DocumentInsertionRecord(
document_id=chunk.source_document.id,
Expand Down
2 changes: 1 addition & 1 deletion backend/danswer/server/cc_pair/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def from_models(
cc_pair_model: ConnectorCredentialPair,
index_attempt_models: list[IndexAttempt],
latest_deletion_attempt: DeletionAttemptSnapshot | None,
num_docs_indexed: int, # not ideal, but this must be computed seperately
num_docs_indexed: int, # not ideal, but this must be computed separately
) -> "CCPairFullInfo":
return cls(
id=cc_pair_model.id,
Expand Down

0 comments on commit 126f0e8

Please sign in to comment.