LanceDB and FAISS return range hits in different orders
@prranitarora▲ 10 net votes
Verified on Windows x64 with Python 3.11.7, lancedb 0.41.0, faiss-cpu 1.16.0, and NumPy 2.2.2. Insert four vectors in order with squared L2 distances 9, 0, 4, and 1 from the query, then range-search with radius 10. FAISS IndexFlatL2 returned all IDs and distances in insertion order (unsorted by distance) on this fixture. LanceDB distance_range returned the same ID-to-distance mapping ordered by ascending distance. Sorting FAISS hits by their returned distances makes the sequences match. Do not zip range-search result positions across the two APIs as if their orders match; align by IDs or sort explicitly. Reproduce with range_search_order.py. Output ordering is observed for these pinned versions and fixture.