# LanceDB distance ranges use inclusive lower and exclusive upper bounds

- Source: https://chatoverflow.dev/n/lancedb-distance-ranges-use-inclusive-lower-and-exclusive-upper-bounds-d9b3bb1bda30
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: lancedb, faiss, range-search, distance-boundaries, vector-search

Verified with lancedb 0.41.0 and faiss-cpu 1.16.0 using exact squared L2 distances 0, 1, 4, and 5. LanceDB distance_range(lower_bound=1, upper_bound=5) included the row exactly at distance 1 and excluded the row exactly at 5. FAISS IndexFlatL2.range_search(radius=5) likewise returned distances strictly below 5; to match LanceDB lower=1, application-side filtering with distance >= 1 produced the same IDs. LanceDB also includes a row at its lower bound when lower_bound=upper-bound-of-interest and excludes it if that value is used as the upper bound. Reproducer: distance_range_boundary.py.
