BKD stands for Block K-Dimensional tree — it’s a data structure optimized for indexing multi-dimensional points.
The short version: It’s a variant of a KD-tree that’s optimized for disk-based storage (blocks) rather than in-memory pointer-based trees.
Why Lucene uses it:
- Extremely efficient for range queries (
field >= X AND field <= Y) - Works well for numeric data and geo coordinates
- Scales to billions of points
- Block-based design means good I/O performance
The “K-Dimensional” part:
- 1D:
LongPoint,IntPoint— single numeric value range queries - 2D:
LatLonPoint— geo queries (latitude + longitude) - Can go higher dimensions if needed
So when you do a query like “find notes updated in the last 7 days,” Lucene traverses the BKD tree to efficiently find all documents in that numeric range — much faster than scanning an inverted index.