@@ -25,6 +25,10 @@ class SearchQuery
25
25
private ?int $ limit ;
26
26
private ?int $ hitsPerPage ;
27
27
private ?int $ page ;
28
+ private ?array $ vector ;
29
+ private ?array $ attributesToSearchOn = null ;
30
+ private ?bool $ showRankingScore = null ;
31
+ private ?bool $ showRankingScoreDetails = null ;
28
32
29
33
public function setQuery (string $ q ): SearchQuery
30
34
{
@@ -103,6 +107,29 @@ public function setShowMatchesPosition(?bool $showMatchesPosition): SearchQuery
103
107
return $ this ;
104
108
}
105
109
110
+ public function setShowRankingScore (?bool $ showRankingScore ): SearchQuery
111
+ {
112
+ $ this ->showRankingScore = $ showRankingScore ;
113
+
114
+ return $ this ;
115
+ }
116
+
117
+ /**
118
+ * This is an EXPERIMENTAL feature, which may break without a major version.
119
+ * It's available after Meilisearch v1.3.
120
+ * To enable it properly and use ranking scoring details its required to opt-in through the /experimental-features route.
121
+ *
122
+ * More info: https://www.meilisearch.com/docs/reference/api/experimental-features
123
+ *
124
+ * @param bool $showRankingScoreDetails whether the feature is enabled or not
125
+ */
126
+ public function setShowRankingScoreDetails (?bool $ showRankingScoreDetails ): SearchQuery
127
+ {
128
+ $ this ->showRankingScoreDetails = $ showRankingScoreDetails ;
129
+
130
+ return $ this ;
131
+ }
132
+
106
133
public function setSort (array $ sort ): SearchQuery
107
134
{
108
135
$ this ->sort = $ sort ;
@@ -152,6 +179,32 @@ public function setIndexUid(string $uid): SearchQuery
152
179
return $ this ;
153
180
}
154
181
182
+ /**
183
+ * This is an EXPERIMENTAL feature, which may break without a major version.
184
+ * It's available from Meilisearch v1.3.
185
+ * To enable it properly and use vector store capabilities it's required to activate it through the /experimental-features route.
186
+ *
187
+ * More info: https://www.meilisearch.com/docs/reference/api/experimental-features
188
+ *
189
+ * @param list<float|list<float>> $vector a multi-level array floats
190
+ */
191
+ public function setVector (array $ vector ): SearchQuery
192
+ {
193
+ $ this ->vector = $ vector ;
194
+
195
+ return $ this ;
196
+ }
197
+
198
+ /**
199
+ * @param list<non-empty-string> $attributesToSearchOn
200
+ */
201
+ public function setAttributesToSearchOn (array $ attributesToSearchOn ): SearchQuery
202
+ {
203
+ $ this ->attributesToSearchOn = $ attributesToSearchOn ;
204
+
205
+ return $ this ;
206
+ }
207
+
155
208
public function toArray (): array
156
209
{
157
210
return array_filter ([
@@ -173,6 +226,10 @@ public function toArray(): array
173
226
'limit ' => $ this ->limit ?? null ,
174
227
'hitsPerPage ' => $ this ->hitsPerPage ?? null ,
175
228
'page ' => $ this ->page ?? null ,
229
+ 'vector ' => $ this ->vector ?? null ,
230
+ 'attributesToSearchOn ' => $ this ->attributesToSearchOn ,
231
+ 'showRankingScore ' => $ this ->showRankingScore ,
232
+ 'showRankingScoreDetails ' => $ this ->showRankingScoreDetails ,
176
233
], function ($ item ) { return null !== $ item ; });
177
234
}
178
235
}
0 commit comments