![[assets/str_idx_hnsw.png|256]] - **Description**: "Hierarchical Navigable Small World". It builds a multi-layered graph where the top layers are coarse (long-distance jumps) and the bottom layers are dense (fine-grained search). - **Data Structure**: - **Layers**: Each layer is a proximity graph. A node is added to layer $L$ with probability $1/\ln(M)$. If a node exists in layer $L$, it also exists in all layers below it. - **Connections ($M$)**: Each node maintains up to $M$ bidirectional links to its nearest neighbors in that layer. - **Search Accuracy (`ef_search`)**: A dynamic candidate list used during query time. Increasing `ef_search` improves recall (accuracy) but slows down the search. - **Extension**: Requires `pgvector`. - **Supported Operators**: `<->` (L2), `<#>` (Inner Product), `<=>` (Cosine). - **Metaphor**: A multi-layered high-speed rail network. The top layers let you zoom across the "map" to the right region (Express), while the lower layers provide fine-grained navigation to the exact station (Local). You jump between layers at the same "coordinates" to refine your search.