Reference
db.count
Return the number of searchable vectors.
db.count() -> intParameters
Section titled “Parameters”None.
Returns
Section titled “Returns”int: the number of vectors that are not deleted.
Raises
Section titled “Raises”Nothing in normal use.
- Never raises for valid use; a
RuntimeErroris possible only after an earlier internal fault. - Thread safety: releases the GIL and takes a shared lock, so calls from several threads run in parallel; they wait while a write is running. See Threads and processes.
Examples
Section titled “Examples”import srvdb
db = srvdb.create("./vectors", dimension=128)v = [1.0] + [0.0] * 127 # tiny 128-dimension vectorsw = [0.0, 1.0] + [0.0] * 126db.add(["a", "b"], [v, w], ["{}", "{}"])db.delete(["a"])print(db.count())# 1See also
Section titled “See also”db.get_all_ids: Return every live id.db.info: Return a one-line summary of the database.
Was this page helpful? Tell us in Discussions.