Skill 3.2.8

Implement hybrid search

Key Concepts

A typical implementation uses two CTEs: one ranks full-text results with FREETEXTTABLE or CONTAINSTABLE and ROW_NUMBER() OVER (ORDER BY RANK DESC), the other ranks vector results by distance with ROW_NUMBER() OVER (ORDER BY distance). Each list is limited to its top candidates (for example 50), and a FULL OUTER JOIN on the key combines them so items found by only one method still appear.

Raw scores from the two methods are not comparable: full-text RANK values and cosine distances have different scales and directions. Hybrid search therefore fuses by position, most often with reciprocal rank fusion, and can weight one list more when evaluation shows it is more reliable for the data.