Skip to content

Commit 0292b65

Browse files
committed
feat: saveRules
1 parent 8e7b1af commit 0292b65

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

tests/CTS/requests/search/saveRules.json

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,141 @@
220220
"clearExistingRules": "true"
221221
}
222222
}
223+
},
224+
{
225+
"testName": "dynamic filtering",
226+
"parameters": {
227+
"indexName": "<YOUR_INDEX_NAME>",
228+
"rules": [
229+
{
230+
"objectID": "toaster",
231+
"condition": {
232+
"pattern": "toaster",
233+
"anchoring": "contains"
234+
},
235+
"consequence": {
236+
"params": {
237+
"query": {
238+
"remove": "toaster"
239+
},
240+
"filters": "product_type:toaster"
241+
}
242+
}
243+
},
244+
{
245+
"objectID": "cheap",
246+
"condition": {
247+
"pattern": "cheap",
248+
"anchoring": "contains"
249+
},
250+
"consequence": {
251+
"params": {
252+
"query": {
253+
"remove": "cheap"
254+
},
255+
"filters": "price < 15"
256+
}
257+
}
258+
}
259+
]
260+
},
261+
"request": {
262+
"path": "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch",
263+
"method": "POST",
264+
"body": [
265+
{
266+
"objectID": "toaster",
267+
"condition": {
268+
"pattern": "toaster",
269+
"anchoring": "contains"
270+
},
271+
"consequence": {
272+
"params": {
273+
"query": {
274+
"remove": "toaster"
275+
},
276+
"filters": "product_type:toaster"
277+
}
278+
}
279+
},
280+
{
281+
"objectID": "cheap",
282+
"condition": {
283+
"pattern": "cheap",
284+
"anchoring": "contains"
285+
},
286+
"consequence": {
287+
"params": {
288+
"query": {
289+
"remove": "cheap"
290+
},
291+
"filters": "price < 15"
292+
}
293+
}
294+
}
295+
]
296+
}
297+
},
298+
{
299+
"testName": "enhance search results",
300+
"parameters": {
301+
"indexName": "<YOUR_INDEX_NAME>",
302+
"rules": [
303+
{
304+
"objectID": "country",
305+
"conditions": [{
306+
"pattern": "{facet:country}",
307+
"anchoring": "contains"
308+
}],
309+
"consequence": {
310+
"params": {
311+
"aroundLatLngViaIP": false
312+
}
313+
}
314+
},
315+
{
316+
"objectID": "city",
317+
"conditions": [{
318+
"pattern": "{facet:city}",
319+
"anchoring": "contains"
320+
}],
321+
"consequence": {
322+
"params": {
323+
"aroundLatLngViaIP": false
324+
}
325+
}
326+
}
327+
]
328+
},
329+
"request": {
330+
"path": "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch",
331+
"method": "POST",
332+
"body": [
333+
{
334+
"objectID": "country",
335+
"conditions": [{
336+
"pattern": "{facet:country}",
337+
"anchoring": "contains"
338+
}],
339+
"consequence": {
340+
"params": {
341+
"aroundLatLngViaIP": false
342+
}
343+
}
344+
},
345+
{
346+
"objectID": "city",
347+
"conditions": [{
348+
"pattern": "{facet:city}",
349+
"anchoring": "contains"
350+
}],
351+
"consequence": {
352+
"params": {
353+
"aroundLatLngViaIP": false
354+
}
355+
}
356+
}
357+
]
358+
}
223359
}
224360
]

0 commit comments

Comments
 (0)