Skip to content

Commit

Permalink
Fixed changes for the new API release
Browse files Browse the repository at this point in the history
  • Loading branch information
randersenYB committed Jul 17, 2024
1 parent 005206e commit 7397c67
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"--logfile", "./hdfimport.log",
"--loglevel", "DEBUG"
],
"justMyCode": false,
"console": "integratedTerminal"
},
{
Expand Down
7 changes: 5 additions & 2 deletions aerospike/aerospikehdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,14 @@ async def create_index(self, adminClient: vectorASyncAdminClient) -> None:
global aerospikeIdxNames
self.print_log(f'Creating Index {self._idx_namespace}.{self._idx_name}')
s = time.time()
await adminClient.index_create(namespace=self._idx_namespace,
await adminClient.index_create(namespace=self._namespace,
name=self._idx_name,
sets=self._setName,
vector_field=self._idx_binName,
dimensions=self._dimensions,
index_params= self._idx_hnswparams,
vector_distance_metric=self._idx_distance
vector_distance_metric=self._idx_distance,
index_storage= vectorTypes.IndexStorage(namespace=self._idx_namespace)
)
t = time.time()
self.print_log(f'Index Creation Time (sec) = {t - s}')
Expand Down Expand Up @@ -373,6 +374,8 @@ async def index_exist(self, adminClient: vectorASyncAdminClient) -> Union[dict,
indexInfo = [(index if index["id"]["namespace"] == self._idx_namespace
and index["id"]["name"] == self._idx_name else None)
for index in existingIndexes]
if len(indexInfo) == 1 and indexInfo[0] is None:
return None
return next(i for i in indexInfo if i is not None)

async def populate(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion aerospike/baseaerospike.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def hnswstr(self) -> str:
if self._idx_hnswparams.batching_params is None:
batchingparams = ''
else:
batchingparams = f"maxrecs:{self._idx_hnswparams.batching_params.max_records}, interval:{self._idx_hnswparams.batching_params.interval}, disabled:{self._idx_hnswparams.batching_params.disabled}"
batchingparams = f"maxrecs:{self._idx_hnswparams.batching_params.max_records}, interval:{self._idx_hnswparams.batching_params.interval}"
return f"m:{self._idx_hnswparams.m}, efconst:{self._idx_hnswparams.ef_construction}, ef:{self._idx_hnswparams.ef}, batching:{{{batchingparams}}}"

def basestring(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion ann_benchmarks/algorithms/aerospike/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,6 @@ def query(self, q, n):
# return self.batch_latencies

def __str__(self):
batchingparams = f"maxrecs:{self._idx_hnswparams.batching_params.max_records}, interval:{self._idx_hnswparams.batching_params.interval}, disabled:{self._idx_hnswparams.batching_params.disabled}"
batchingparams = f"maxrecs:{self._idx_hnswparams.batching_params.max_records}, interval:{self._idx_hnswparams.batching_params.interval}"
hnswparams = f"m:{self._idx_hnswparams.m}, efconst:{self._idx_hnswparams.ef_construction}, ef:{self._idx_hnswparams.ef}, batching:{{{batchingparams}}}"
return f"Aerospike([{self._metric}, {self._host}:{self._port}, {self._isloadbalancer}, {self._namespace}.{self._setName}.{self._idx_name}, {self._idx_type}, {self._idx_value}, {self._dims}, {self._actions}, {self._idx_sleep}, {self._populateTasks}, {{{hnswparams}}}, {{{self._query_hnswsearchparams}}}])"

0 comments on commit 7397c67

Please sign in to comment.