Skip to content

Commit 37c9c9b

Browse files
Merge pull request #145 from TileDB-Inc/npapa/fix_missing_flat_ids
Fix missing flat ids
2 parents ba91a70 + d042d17 commit 37c9c9b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apis/python/src/tiledb/vector_search/flat_index.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ def __init__(
3636
ctx=self.ctx,
3737
config=config,
3838
)
39-
self.ids_uri = self.group[
40-
storage_formats[self.storage_version]["IDS_ARRAY_NAME"] + self.index_version
41-
].uri
42-
if tiledb.array_exists(self.ids_uri, self.ctx):
39+
40+
# Check for existence of ids array. Previous versions were not using external_ids in the ingestion assuming
41+
# that the external_ids were the position of the vector in the array.
42+
if storage_formats[self.storage_version]["IDS_ARRAY_NAME"] + self.index_version in self.group:
43+
self.ids_uri = self.group[
44+
storage_formats[self.storage_version]["IDS_ARRAY_NAME"] + self.index_version
45+
].uri
4346
self._ids = read_vector_u64(self.ctx, self.ids_uri, 0, 0)
4447
else:
4548
self._ids = StdVector_u64(np.arange(self.size).astype(np.uint64))

0 commit comments

Comments
 (0)