Reference
db.set_ef_search
Set HNSW’s search candidate list size.
db.set_ef_search(ef_search: int) -> NoneParameters
Section titled “Parameters”- ef_search : int
Candidate list size, at least 1. Higher finds more true neighbours but searches more slowly; typical values are 50 to 300. Searches always use at least
k.
Returns
Section titled “Returns”None.
Raises
Section titled “Raises”- ValueError
ef_searchis 0. Also raised for a negative value.
- Applies to the HNSW index and to every IVF partition, and is saved with the index by
save(). - Thread safety: a database object is safe to share between threads. This method releases the GIL; writes (
add,upsert,delete,save,compact, mode and IVF changes) take an exclusive lock and wait for each other and for running searches instead of failing. See Threads and processes.
Examples
Section titled “Examples”import srvdb
db = srvdb.create("./vectors", dimension=128, index="hnsw")db.set_ef_search(100)See also
Section titled “See also”srvdb.create: Create a new database with its index and options.db.search: Find the k nearest vectors to a query.
Was this page helpful? Tell us in Discussions.