FT.HYBRID

Since 1.1.0Search

Syntax

FT.HYBRID index SEARCH query [YIELD_SCORE_AS name] VSIM @field $param [KNN count K k [EF_RUNTIME n]] [YIELD_SCORE_AS name] [COMBINE RRF|LINEAR count [WINDOW w] [CONSTANT c] [ALPHA a] [BETA b] [YIELD_SCORE_AS name]] [LIMIT off cnt] [SORTBY count field [ASC|DESC]] [NOSORT] [LOAD count @field ...] [LOAD *] PARAMS n k v ... [GROUPBY ...] [REDUCE ...] [APPLY expr AS name] [FILTER expr]
  • ACL categories: @read, @search, @slow
  • Arity: -1

Searches an index by text and by vector together, and fuses the two rankings into one.

Options

OptionEffect
SEARCH queryThe text query.
VSIM @field $paramThe vector field, and the parameter that holds the query vector.
KNN count K k [EF_RUNTIME n]How many nearest neighbours to take.
COMBINE RRF count [WINDOW w] [CONSTANT c]Fuse by rank (the default).
COMBINE LINEAR count [ALPHA a] [BETA b]Fuse by scores scaled to 0..1: ALPHA weighs the text score, BETA the vector one.
YIELD_SCORE_AS nameRename a score.
LIMIT, SORTBY, NOSORT, LOAD, PARAMSAs for FT.SEARCH and FT.AGGREGATE.
GROUPBY, REDUCE, APPLY, FILTERFT.AGGREGATE's steps, on the fused results.

Reply

  • The total, then each result's key and fields, with hybrid_score, text_score and vsim_score.

Examples

> FT.HYBRID products SEARCH usb VSIM @embedding $q PARAMS 2 q "<3 float32s>" LOAD 1 @name LIMIT 0 3
1) (integer) 3
2) "product:1"
3) 1) "text_score"
   2) "0.568023"
   3) "hybrid_score"
   4) "0.032522"
   5) "vsim_score"
   6) "0.000000"
   7) "name"
   8) "USB-C cable, 2 m"
...