Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sicheng Pan committed Dec 10, 2024
1 parent ba52dd6 commit b6d727f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chromadb/api/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,12 +895,15 @@ def _get_collection(self, collection_id: UUID) -> t.Collection:
@trace_method("SegmentAPI._scan", OpenTelemetryGranularity.ALL)
def _scan(self, collection_id: UUID) -> Scan:
collection_segments = self._sysdb.get_collection_with_segments(collection_id)
# For now collection should have exactly one segment per scope:
# - Local scopes: vector, metadata
# - Distributed scopes: vector, metadata, record
scope_to_segment = {segment["scope"]: segment for segment in collection_segments["segments"]}
return Scan(
collection=collection_segments["collection"],
knn=scope_to_segment[t.SegmentScope.VECTOR],
metadata=scope_to_segment[t.SegmentScope.METADATA],
# Local chroma do not have record segment
# Local chroma do not have record segment, and this is not used by the local executor
record=scope_to_segment.get(t.SegmentScope.RECORD, None), # type: ignore[arg-type]
)

Expand Down

0 comments on commit b6d727f

Please sign in to comment.