Skip to content

Reference

db.set_rabitq_rerank

Change the rerank factor of a RaBitQ database.

db.set_rabitq_rerank(rerank: int) -> None
  • rerank : int Candidates per result rescored against the full vectors. 0 turns rerank off and returns estimated scores.

None. Later searches use the new factor.

  • ValueError The database is not in RaBitQ mode, or rerank is above 1 000 000.
  • Higher values give higher recall and slower searches. The setting is recorded by the next save().
  • Thread safety: a database object is safe to share between threads. This method releases the GIL and takes the write lock, so it waits for running searches.
import srvdb
db = srvdb.create("./vectors", dimension=128, index="rabitq", bits=1)
db.set_rabitq_rerank(80)
db.set_rabitq_rerank(0)
print("ok")
# ok
  • srvdb.create: Create a new database with its index and options.