@@ -27,6 +27,7 @@ class SearchQuery
27
27
private ?int $ hitsPerPage ;
28
28
private ?int $ page ;
29
29
private ?array $ vector ;
30
+ private ?HybridSearchOptions $ hybrid ;
30
31
private ?array $ attributesToSearchOn = null ;
31
32
private ?bool $ showRankingScore = null ;
32
33
private ?bool $ showRankingScoreDetails = null ;
@@ -237,6 +238,22 @@ public function setVector(array $vector): SearchQuery
237
238
return $ this ;
238
239
}
239
240
241
+ /**
242
+ * This is an EXPERIMENTAL feature, which may break without a major version.
243
+ *
244
+ * Set hybrid search options
245
+ * [
246
+ * 'semanticRatio'=> 0.8,
247
+ * 'embedder' => 'manual',
248
+ * ];
249
+ */
250
+ public function setHybrid (HybridSearchOptions $ hybridOptions ): SearchQuery
251
+ {
252
+ $ this ->hybrid = $ hybridOptions ;
253
+
254
+ return $ this ;
255
+ }
256
+
240
257
/**
241
258
* @param list<non-empty-string> $attributesToSearchOn
242
259
*/
@@ -270,6 +287,7 @@ public function toArray(): array
270
287
'hitsPerPage ' => $ this ->hitsPerPage ?? null ,
271
288
'page ' => $ this ->page ?? null ,
272
289
'vector ' => $ this ->vector ?? null ,
290
+ 'hybrid ' => null !== $ this ->hybrid ? $ this ->hybrid ->toArray () : null ,
273
291
'attributesToSearchOn ' => $ this ->attributesToSearchOn ,
274
292
'showRankingScore ' => $ this ->showRankingScore ,
275
293
'showRankingScoreDetails ' => $ this ->showRankingScoreDetails ,
0 commit comments