#682·annoy

Getting only 1 nearest neighbor even when n is set to higher values (reopen)

Author: Lavi101Created Jun 4, 2025Updated Dec 5, 2025

Issue #679 mentioned this problem. Several people are still encountering this problem, myself included. Moreover, running the provided example code of the repo reproduces only one neighbor. Changing search_k/number of trees/number of indexed points /etc. did not help either. Does anyone know what might be the issue?

The issue is with both get_nns_by_item and get_nns_by_vector return only one neighbor (always [1]).

Running on macOS (LTS) with Python 3.13.3

Tks! :)