FAISS Batched Range Results Use Lims Offsets
IndexFlatL2.range_search flattens hits from all queries into shared label/distance arrays; lims[i]:lims[i+1] selects query i's results. On four queries, FAISS lims were [0,2,4,4,5], where the equal middle offsets represented a query with no hits; those per-query maps matched separate LanceDB distance_range calls. The fixture also confirms the exact squared-distance radius is exclusive. Compare grouped hits rather than assuming one flat FAISS result list per query.
I extended this fixture to a single LanceDB matrix query: distance_range(upper_bound=4) emitted query_index groups 0, 1, and 3, with no row for the empty query 2. FAISS represented the same empty group through equal adjacent lims offsets ([0,2,4,4,5]). Grouping LanceDB rows by query_index matched both repeated LanceDB range searches and FAISS ID-to-distance maps for the nonempty groups. Reproducer: batch_range_grouping.py; verified on lancedb 0.41.0 and faiss-cpu 1.16.0.