From 19b9337215643c8438b7bbe798aa1ccdf9342a83 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 24 Jan 2025 16:18:43 +0100 Subject: [PATCH] guides: add snippets for parameters --- .../requests/search/searchSingleIndex.json | 1938 ++++++++++++++++- tests/CTS/requests/search/setSettings.json | 241 +- 2 files changed, 2075 insertions(+), 104 deletions(-) diff --git a/tests/CTS/requests/search/searchSingleIndex.json b/tests/CTS/requests/search/searchSingleIndex.json index 549146d08d..7551fe4b3f 100644 --- a/tests/CTS/requests/search/searchSingleIndex.json +++ b/tests/CTS/requests/search/searchSingleIndex.json @@ -302,6 +302,114 @@ } } }, + { + "testName": "facetFiltersBook", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facetFilters": [ + "category:Book" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facetFilters": [ + "category:Book" + ] + } + } + }, + { + "testName": "facetFiltersAND", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facetFilters": [ + "category:Book", + "author:John Doe" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facetFilters": [ + "category:Book", + "author:John Doe" + ] + } + } + }, + { + "testName": "facetFiltersOR", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facetFilters": [ + [ + "category:Book", + "author:John Doe" + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facetFilters": [ + [ + "category:Book", + "author:John Doe" + ] + ] + } + } + }, + { + "testName": "facetFiltersCombined", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facetFilters": [ + "author:John Doe", + [ + "category:Book", + "category:Movie" + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facetFilters": [ + "author:John Doe", + [ + "category:Book", + "category:Movie" + ] + ] + } + } + }, { "testName": "facetFiltersNeg", "parameters": { @@ -345,14 +453,20 @@ "parameters": { "indexName": "indexName", "searchParams": { - "facets":["author","genre"] + "facets": [ + "author", + "genre" + ] } }, "request": { "path": "/1/indexes/indexName/query", "method": "POST", "body": { - "facets":["author","genre"] + "facets": [ + "author", + "genre" + ] } } }, @@ -361,14 +475,18 @@ "parameters": { "indexName": "indexName", "searchParams": { - "facets":["*"] + "facets": [ + "*" + ] } }, "request": { "path": "/1/indexes/indexName/query", "method": "POST", "body": { - "facets":["*"] + "facets": [ + "*" + ] } } }, @@ -377,14 +495,14 @@ "parameters": { "indexName": "indexName", "searchParams": { - "maxValuesPerFacet":1000 + "maxValuesPerFacet": 1000 } }, "request": { "path": "/1/indexes/indexName/query", "method": "POST", "body": { - "maxValuesPerFacet":1000 + "maxValuesPerFacet": 1000 } } }, @@ -730,6 +848,25 @@ } } }, + { + "testName": "userToken1234", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "userToken": "user-1234" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "userToken": "user-1234" + } + } + }, { "testName": "analyticsTag", "parameters": { @@ -795,5 +932,1794 @@ ] } } + }, + { + "testName": "attributesToHighlightOverride", + "isSnippet": true, + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "attributesToHighlight": [ + "title", + "content" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "attributesToHighlight": [ + "title", + "content" + ] + } + } + }, + { + "testName": "disableTypoToleranceOnAttributes", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "disableTypoToleranceOnAttributes": [ + "serial_number" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "disableTypoToleranceOnAttributes": [ + "serial_number" + ] + } + } + }, + { + "testName": "search_a_query", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "shirt" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "shirt" + } + } + }, + { + "testName": "search_everything", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "" + } + } + }, + { + "testName": "search_a_query", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "", + "similarQuery": "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + "filters": "year:1991 TO 2001" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "", + "similarQuery": "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + "filters": "year:1991 TO 2001" + } + } + }, + { + "testName": "override_retrievable_attributes", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "attributesToRetrieve": [ + "title", + "content" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "attributesToRetrieve": [ + "title", + "content" + ] + } + } + }, + { + "testName": "restrict_searchable_attributes", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "restrictSearchableAttributes": [ + "title", + "author" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "restrictSearchableAttributes": [ + "title", + "author" + ] + } + } + }, + { + "testName": "override_default_relevancy", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "relevancyStrictness": 70 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "relevancyStrictness": 70 + } + } + }, + { + "testName": "apply_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "(category:Book OR category:Ebook) AND _tags:published" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "(category:Book OR category:Ebook) AND _tags:published" + } + } + }, + { + "testName": "apply_all_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "available = 1 AND (category:Book OR NOT category:Ebook) AND _tags:published AND publication_date:1441745506 TO 1441755506 AND inStock > 0 AND author:\"John Doe\"" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "available = 1 AND (category:Book OR NOT category:Ebook) AND _tags:published AND publication_date:1441745506 TO 1441755506 AND inStock > 0 AND author:\"John Doe\"" + } + } + }, + { + "testName": "escape_spaces", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "category:\"Books and Comics\"" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "category:\"Books and Comics\"" + } + } + }, + { + "testName": "escape_keywords", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "keyword:\"OR\"" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "keyword:\"OR\"" + } + } + }, + { + "testName": "escape_single_quotes", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "content:\"It's a wonderful day\"" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "content:\"It's a wonderful day\"" + } + } + }, + { + "testName": "escape_double_quotes", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "filters": "content:\"She said \"Hello World\"" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "filters": "content:\"She said \"Hello World\"" + } + } + }, + { + "testName": "apply_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "optionalFilters": [ + "category:Book", + "author:John Doe" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "optionalFilters": [ + "category:Book", + "author:John Doe" + ] + } + } + }, + { + "testName": "apply_negative_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "optionalFilters": [ + "category:Book", + "author:-John Doe" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "optionalFilters": [ + "category:Book", + "author:-John Doe" + ] + } + } + }, + { + "testName": "apply_numeric_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "numericFilters": [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506" + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "numericFilters": [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506" + ] + ] + } + } + }, + { + "testName": "apply_tag_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "tagFilters": [ + "SciFi", + [ + "Book", + "Movie" + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "tagFilters": [ + "SciFi", + [ + "Book", + "Movie" + ] + ] + } + } + }, + { + "testName": "apply_filters", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "sumOrFiltersScores": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "sumOrFiltersScores": true + } + } + }, + { + "testName": "facets_all", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facets": [ + "*" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facets": [ + "*" + ] + } + } + }, + { + "testName": "retrieve_only_some_facets", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facets": [ + "category", + "author" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facets": [ + "category", + "author" + ] + } + } + }, + { + "testName": "override_default_max_values_per_facet", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "maxValuesPerFacet": 20 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "maxValuesPerFacet": 20 + } + } + }, + { + "testName": "enable_faceting_after_distinct", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "facetingAfterDistinct": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "facetingAfterDistinct": true + } + } + }, + { + "testName": "sort_facet_values_alphabetically", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "sortFacetValuesBy": "count" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "sortFacetValuesBy": "count" + } + } + }, + { + "testName": "override_attributes_to_snippet", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "attributesToSnippet": [ + "title", + "content:80" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "attributesToSnippet": [ + "title", + "content:80" + ] + } + } + }, + { + "testName": "override_default_highlight_pre_tag", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "highlightPreTag": "" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "highlightPreTag": "" + } + } + }, + { + "testName": "override_default_highlight_post_tag", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "highlightPostTag": "" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "highlightPostTag": "" + } + } + }, + { + "testName": "override_default_snippet_ellipsis_text", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "snippetEllipsisText": "" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "snippetEllipsisText": "" + } + } + }, + { + "testName": "enable_restrict_highlight_and_snippet_arrays", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "restrictHighlightAndSnippetArrays": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "restrictHighlightAndSnippetArrays": false + } + } + }, + { + "testName": "access_page", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "page": 0 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "page": 0 + } + } + }, + { + "testName": "override_default_hits_per_page", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "hitsPerPage": 10 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "hitsPerPage": 10 + } + } + }, + { + "testName": "get_nth_hit", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "offset": 4 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "offset": 4 + } + } + }, + { + "testName": "get_n_results", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "length": 4 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "length": 4 + } + } + }, + { + "testName": "override_default_min_word_size_for_one_typo", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "minWordSizefor1Typo": 2 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "minWordSizefor1Typo": 2 + } + } + }, + { + "testName": "override_default_min_word_size_for_two_typos", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "minWordSizefor2Typos": 2 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "minWordSizefor2Typos": 2 + } + } + }, + { + "testName": "override_default_typo_tolerance_mode", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "typoTolerance": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "typoTolerance": false + } + } + }, + { + "testName": "disable_typos_on_numeric_tokens_at_search_time", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "allowTyposOnNumericTokens": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "allowTyposOnNumericTokens": false + } + } + }, + { + "testName": "search_around_a_position", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundLatLng": "40.71, -74.01" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundLatLng": "40.71, -74.01" + } + } + }, + { + "testName": "search_around_server_ip", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundLatLngViaIP": true + } + }, + "requestOptions": { + "headers": { + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundLatLngViaIP": true + }, + "headers": { + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around" + } + } + }, + { + "testName": "set_around_radius", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundRadius": 1000 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundRadius": 1000 + } + } + }, + { + "testName": "disable_automatic_radius", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundRadius": "all" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundRadius": "all" + } + } + }, + { + "testName": "set_geo_search_precision", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundPrecision": 100 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundPrecision": 100 + } + } + }, + { + "testName": "set_geo_search_precision_non_linear", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "aroundPrecision": [ + { + "from": 0, + "value": 25 + }, + { + "from": 2000, + "value": 1000 + } + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "aroundPrecision": [ + { + "from": 0, + "value": 25 + }, + { + "from": 2000, + "value": 1000 + } + ] + } + } + }, + { + "testName": "set_minimum_geo_search_radius", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "minimumAroundRadius": 1000 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "minimumAroundRadius": 1000 + } + } + }, + { + "testName": "search_inside_rectangular_area", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625 + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625 + ] + ] + } + } + }, + { + "testName": "search_inside_multiple_rectangular_areas", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625 + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875 + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625 + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875 + ] + ] + } + } + }, + { + "testName": "search_inside_polygon_area", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625 + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625 + ] + ] + } + } + }, + { + "testName": "search_inside_multiple_polygon_areas", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625 + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625 + ] + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625 + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625 + ] + ] + } + } + }, + { + "testName": "set_querylanguages_override", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "ignorePlurals": [ + "ca", + "es" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "ignorePlurals": [ + "ca", + "es" + ] + } + } + }, + { + "testName": "set_querylanguages_override", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "removeStopWords": [ + "ca", + "es" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "removeStopWords": [ + "ca", + "es" + ] + } + } + }, + { + "testName": "set_querylanguages_override", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "removeStopWords": [ + "ca", + "es" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "removeStopWords": [ + "ca", + "es" + ] + } + } + }, + { + "testName": "set_querylanguages_with_japanese_query", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "queryLanguages": [ + "ja", + "en" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "queryLanguages": [ + "ja", + "en" + ] + } + } + }, + { + "testName": "set_natural_languages", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "", + "naturalLanguages": [ + "fr" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "", + "naturalLanguages": [ + "fr" + ] + } + } + }, + { + "testName": "override_natural_languages_with_query", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "", + "naturalLanguages": [ + "fr" + ], + "removeWordsIfNoResults": "firstWords" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "", + "naturalLanguages": [ + "fr" + ], + "removeWordsIfNoResults": "firstWords" + } + } + }, + { + "testName": "enable_decompound_query_search_time", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "decompoundQuery": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "decompoundQuery": true + } + } + }, + { + "testName": "enable_rules_search_time", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enableRules": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enableRules": true + } + } + }, + { + "testName": "set_rule_contexts", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "ruleContexts": [ + "front_end", + "website2" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "ruleContexts": [ + "front_end", + "website2" + ] + } + } + }, + { + "testName": "enable_personalization", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enablePersonalization": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enablePersonalization": true + } + } + }, + { + "testName": "enable_personalization_with_user_token", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enablePersonalization": true, + "userToken": "123456" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enablePersonalization": true, + "userToken": "123456" + } + } + }, + { + "testName": "personalization_impact", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "personalizationImpact": 20 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "personalizationImpact": 20 + } + } + }, + { + "testName": "set_user_token", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "userToken": "123456" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "userToken": "123456" + } + } + }, + { + "testName": "set_user_token_with_personalization", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enablePersonalization": true, + "userToken": "123456" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enablePersonalization": true, + "userToken": "123456" + } + } + }, + { + "testName": "override_default_query_type", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "queryType": "prefixAll" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "queryType": "prefixAll" + } + } + }, + { + "testName": "override_default_remove_words_if_no_results", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "removeWordsIfNoResults": "lastWords" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "removeWordsIfNoResults": "lastWords" + } + } + }, + { + "testName": "enable_advanced_syntax_search_time", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "advancedSyntax": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "advancedSyntax": true + } + } + }, + { + "testName": "overide_default_optional_words", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "optionalWords": [ + "toyota", + "2020 2021" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "optionalWords": [ + "toyota", + "2020 2021" + ] + } + } + }, + { + "testName": "disabling_exact_for_some_attributes_search_time", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "disableExactOnAttributes": [ + "description" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "disableExactOnAttributes": [ + "description" + ] + } + } + }, + { + "testName": "override_default_exact_single_word_query", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "exactOnSingleWordQuery": "none" + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "exactOnSingleWordQuery": "none" + } + } + }, + { + "testName": "override_default_aternative_as_exact", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "alternativesAsExact": [ + "multiWordsSynonym" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "alternativesAsExact": [ + "multiWordsSynonym" + ] + } + } + }, + { + "testName": "enable_advanced_syntax_exact_phrase", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "advancedSyntax": true, + "advancedSyntaxFeatures": [ + "exactPhrase" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "advancedSyntax": true, + "advancedSyntaxFeatures": [ + "exactPhrase" + ] + } + } + }, + { + "testName": "enable_advanced_syntax_exclude_words", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "advancedSyntax": true, + "advancedSyntaxFeatures": [ + "excludeWords" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "advancedSyntax": true, + "advancedSyntaxFeatures": [ + "excludeWords" + ] + } + } + }, + { + "testName": "override_distinct", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "distinct": 0 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "distinct": 0 + } + } + }, + { + "testName": "get_ranking_info", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "getRankingInfo": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "getRankingInfo": true + } + } + }, + { + "testName": "disable_click_analytics", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "clickAnalytics": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "clickAnalytics": false + } + } + }, + { + "testName": "enable_click_analytics", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "clickAnalytics": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "clickAnalytics": true + } + } + }, + { + "testName": "disable_analytics", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "analytics": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "analytics": false + } + } + }, + { + "testName": "add_analytics_tags", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "analyticsTags": [ + "front_end", + "website2" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "analyticsTags": [ + "front_end", + "website2" + ] + } + } + }, + { + "testName": "disable_synonyms", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "synonyms": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "synonyms": false + } + } + }, + { + "testName": "override_replace_synonyms_in_highlights", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "replaceSynonymsInHighlight": true + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "replaceSynonymsInHighlight": true + } + } + }, + { + "testName": "override_min_proximity", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "minProximity": 2 + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "minProximity": 2 + } + } + }, + { + "testName": "override_default_field", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "responseFields": [ + "hits", + "facets" + ] + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "responseFields": [ + "hits", + "facets" + ] + } + } + }, + { + "testName": "override_percentile_computation", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "percentileComputation": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "percentileComputation": false + } + } + }, + { + "testName": "set_ab_test", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enableABTest": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enableABTest": false + } + } + }, + { + "testName": "set_enable_re_ranking", + "parameters": { + "indexName": "indexName", + "searchParams": { + "query": "query", + "enableReRanking": false + } + }, + "request": { + "path": "/1/indexes/indexName/query", + "method": "POST", + "body": { + "query": "query", + "enableReRanking": false + } + } } ] diff --git a/tests/CTS/requests/search/setSettings.json b/tests/CTS/requests/search/setSettings.json index 64e32daa5b..a6310f0026 100644 --- a/tests/CTS/requests/search/setSettings.json +++ b/tests/CTS/requests/search/setSettings.json @@ -231,7 +231,7 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "distinct": true + "distinct": true } }, "request": { @@ -525,14 +525,18 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "customRanking": [ "desc(boosted)" ] + "customRanking": [ + "desc(boosted)" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "customRanking": [ "desc(boosted)" ] + "customRanking": [ + "desc(boosted)" + ] } } }, @@ -541,7 +545,7 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "customRanking": [ + "customRanking": [ "desc(pageviews)", "desc(comments)" ] @@ -551,7 +555,7 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "customRanking": [ + "customRanking": [ "desc(pageviews)", "desc(comments)" ] @@ -564,9 +568,11 @@ "indexName": "theIndexName", "indexSettings": { "customRanking": [ - "desc(nb_airline_liaisons)" - ], - "attributesForFaceting": ["city, country"] + "desc(nb_airline_liaisons)" + ], + "attributesForFaceting": [ + "city, country" + ] } }, "request": { @@ -574,9 +580,11 @@ "method": "PUT", "body": { "customRanking": [ - "desc(nb_airline_liaisons)" - ], - "attributesForFaceting": ["city, country"] + "desc(nb_airline_liaisons)" + ], + "attributesForFaceting": [ + "city, country" + ] } } }, @@ -585,7 +593,7 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "customRanking": [ + "customRanking": [ "desc(rounded_pageviews)", "desc(comments)" ] @@ -595,7 +603,7 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "customRanking": [ + "customRanking": [ "desc(rounded_pageviews)", "desc(comments)" ] @@ -607,7 +615,7 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "customRanking": [ + "customRanking": [ "desc(price)" ] } @@ -616,7 +624,7 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "customRanking": [ + "customRanking": [ "desc(price)" ] } @@ -704,7 +712,7 @@ "indexName": "theIndexName", "indexSettings": { "customRanking": [ - "asc(textual_attribute)" + "asc(textual_attribute)" ], "ranking": [ "custom", @@ -723,7 +731,7 @@ "method": "PUT", "body": { "customRanking": [ - "asc(textual_attribute)" + "asc(textual_attribute)" ], "ranking": [ "custom", @@ -744,7 +752,7 @@ "indexName": "theIndexName", "indexSettings": { "customRanking": [ - "asc(textual_attribute)" + "asc(textual_attribute)" ], "relevancyStrictness": 0 } @@ -754,7 +762,7 @@ "method": "PUT", "body": { "customRanking": [ - "asc(textual_attribute)" + "asc(textual_attribute)" ], "relevancyStrictness": 0 } @@ -766,7 +774,7 @@ "indexName": "theIndexName", "indexSettings": { "replicas": [ - "products_price_desc" + "products_price_desc" ] } }, @@ -775,7 +783,7 @@ "method": "PUT", "body": { "replicas": [ - "products_price_desc" + "products_price_desc" ] } } @@ -786,7 +794,7 @@ "indexName": "theIndexName", "indexSettings": { "replicas": [ - "virtual(products_price_desc)" + "virtual(products_price_desc)" ] } }, @@ -795,7 +803,7 @@ "method": "PUT", "body": { "replicas": [ - "virtual(products_price_desc)" + "virtual(products_price_desc)" ] } } @@ -805,14 +813,18 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "replicas": [""] + "replicas": [ + "" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "replicas": [""] + "replicas": [ + "" + ] } } }, @@ -821,7 +833,10 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "searchableAttributes": ["name", "description"] + "searchableAttributes": [ + "name", + "description" + ] }, "forwardToReplicas": true }, @@ -829,11 +844,14 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": ["name", "description"] + "searchableAttributes": [ + "name", + "description" + ] }, - "queryParameters": { - "forwardToReplicas": "true" - } + "queryParameters": { + "forwardToReplicas": "true" + } } }, { @@ -933,22 +951,22 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "searchableAttributes": [ - "design", - "type", - "color" - ] + "searchableAttributes": [ + "design", + "type", + "color" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": [ - "design", - "type", - "color" - ] + "searchableAttributes": [ + "design", + "type", + "color" + ] } } }, @@ -957,74 +975,74 @@ "parameters": { "indexName": "theIndexName", "indexSettings": { - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code" - ], - "customRanking": ["desc(links_count)"] + "searchableAttributes": [ + "name", + "country", + "code", + "iata_code" + ], + "customRanking": [ + "desc(links_count)" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code" - ], - "customRanking": ["desc(links_count)"] + "searchableAttributes": [ + "name", + "country", + "code", + "iata_code" + ], + "customRanking": [ + "desc(links_count)" + ] } } }, { - "testName": "searchableAttributes around location", + "testName": "attributesToHighlight", "parameters": { "indexName": "theIndexName", "indexSettings": { - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code" - ], - "customRanking": ["desc(links_count)"] + "attributesToHighlight": [ + "author", + "title", + "content" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code" - ], - "customRanking": ["desc(links_count)"] + "attributesToHighlight": [ + "author", + "title", + "content" + ] } } }, { - "testName": "disableTypoToleranceOnAttributes", + "testName": "attributesToHighlightStar", "parameters": { "indexName": "theIndexName", "indexSettings": { - "disableTypoToleranceOnAttributes": [ - "serial_number" - ] + "attributesToHighlight": [ + "*" + ] } }, "request": { "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "disableTypoToleranceOnAttributes": [ - "serial_number" - ] + "attributesToHighlight": [ + "*" + ] } } }, @@ -1336,21 +1354,44 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": [ - "brand", - "name", - "categories", - "unordered(description)" - ], - "customRanking": [ - "desc(popularity)" - ], - "attributesForFaceting": [ - "searchable(brand)", - "type", - "categories", - "price" - ] + "searchableAttributes": [ + "brand", + "name", + "categories", + "unordered(description)" + ], + "customRanking": [ + "desc(popularity)" + ], + "attributesForFaceting": [ + "searchable(brand)", + "type", + "categories", + "price" + ] + } + } + }, + { + "testName": "searchableAttributesOrdering", + "isSnippet": true, + "parameters": { + "indexName": "theIndexName", + "indexSettings": { + "searchableAttributes": [ + "unordered(title)", + "cast" + ] + } + }, + "request": { + "path": "/1/indexes/theIndexName/settings", + "method": "PUT", + "body": { + "searchableAttributes": [ + "unordered(title)", + "cast" + ] } } }, @@ -1370,11 +1411,11 @@ "path": "/1/indexes/theIndexName/settings", "method": "PUT", "body": { - "searchableAttributes": [ - "name", - "product_reference", - "product_reference_suffixes" - ] + "searchableAttributes": [ + "name", + "product_reference", + "product_reference_suffixes" + ] } } }, @@ -1406,7 +1447,9 @@ "indexName": "movies", "indexSettings": { "searchableAttributes": [ - "title_eng", "title_fr", "title_es" + "title_eng", + "title_fr", + "title_es" ] } }, @@ -1415,7 +1458,9 @@ "method": "PUT", "body": { "searchableAttributes": [ - "title_eng", "title_fr", "title_es" + "title_eng", + "title_fr", + "title_es" ] } }