Hybrid retrieval combines semantic dense similarity with lexical sparse matching. QQL exposes a shorthand and an explicit multi-stage form.
Shorthand
Section titled “Shorthand”QUERY TEXT 'zero downtime deployment' FROM runbooksUSING HYBRID DENSE dense SPARSE sparse FUSION RRFWHERE service = 'gateway'LIMIT 10;If the collection has exactly one dense and one sparse vector, omit the names:
QUERY 'zero downtime deployment' FROM runbooksUSING HYBRIDLIMIT 10;Explicit candidate stages
Section titled “Explicit candidate stages”WITH semantic AS ( QUERY TEXT 'zero downtime deployment' USING dense WHERE service = 'gateway' LIMIT 120 ), lexical AS ( QUERY TEXT 'zero downtime deployment' USING sparse WHERE service = 'gateway' LIMIT 180 )QUERY FUSION RRFFROM runbooksPREFETCH (semantic, lexical)PARAMS (rrf_k = 40, rrf_weights = [0.7, 0.3])LIMIT 10;Use the explicit form when candidate limits, filters, or weights differ by stage. rrf_weights length must equal the prefetch count.
RRF or DBSF?
Section titled “RRF or DBSF?”| Fusion | Prefer when |
|---|---|
| RRF | Ranking positions are reliable but score scales differ |
| DBSF | Normalized score magnitude carries useful information |