diff --git a/docs/bundled/search-snippets.json b/docs/bundled/search-snippets.json index da9978bf2c..a51aab2aaf 100644 --- a/docs/bundled/search-snippets.json +++ b/docs/bundled/search-snippets.json @@ -294,6 +294,10 @@ "filtersStephenKing": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Filters = \"author:\\\"Stephen King\\\"\" })\n);", "filtersNotTags": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Filters = \"NOT _tags:non-fiction\" })\n);", "facetFiltersList": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n FacetFilters = new FacetFilters(\n new List\n {\n new FacetFilters(\"publisher:Penguin\"),\n new FacetFilters(\n new List\n {\n new FacetFilters(\"author:Stephen King\"),\n new FacetFilters(\"genre:Horror\"),\n }\n ),\n }\n ),\n }\n )\n);", + "facetFiltersBook": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n FacetFilters = new FacetFilters(\n new List { new FacetFilters(\"category:Book\") }\n ),\n }\n )\n);", + "facetFiltersAND": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n FacetFilters = new FacetFilters(\n new List\n {\n new FacetFilters(\"category:Book\"),\n new FacetFilters(\"author:John Doe\"),\n }\n ),\n }\n )\n);", + "facetFiltersOR": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n FacetFilters = new FacetFilters(\n new List\n {\n new FacetFilters(\n new List\n {\n new FacetFilters(\"category:Book\"),\n new FacetFilters(\"author:John Doe\"),\n }\n ),\n }\n ),\n }\n )\n);", + "facetFiltersCombined": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n FacetFilters = new FacetFilters(\n new List\n {\n new FacetFilters(\"author:John Doe\"),\n new FacetFilters(\n new List\n {\n new FacetFilters(\"category:Book\"),\n new FacetFilters(\"category:Movie\"),\n }\n ),\n }\n ),\n }\n )\n);", "facetFiltersNeg": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { FacetFilters = new FacetFilters(\"category:-Ebook\") }\n )\n);", "filtersAndFacetFilters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Filters = \"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\",\n FacetFilters = new FacetFilters(\n new List { new FacetFilters(\"publisher:Penguin\") }\n ),\n }\n )\n);", "facet author genre": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Facets = new List { \"author\", \"genre\" },\n }\n )\n);", @@ -313,9 +317,90 @@ "clickAnalyticsUserToken": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { ClickAnalytics = true, UserToken = \"user-1\" })\n);", "enablePersonalization": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { EnablePersonalization = true, UserToken = \"user-1\" }\n )\n);", "userToken": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { UserToken = \"user-1\" })\n);", + "userToken1234": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", UserToken = \"user-1234\" })\n);", "analyticsTag": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { AnalyticsTags = new List { \"YOUR_ANALYTICS_TAG\" } }\n )\n);", "facetFiltersUsers": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n FacetFilters = new FacetFilters(\n new List\n {\n new FacetFilters(\"user:user42\"),\n new FacetFilters(\"user:public\"),\n }\n ),\n }\n )\n);", - "buildTheQuery": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Filters = \"categoryPageId: Men's Clothing\",\n HitsPerPage = 50,\n AnalyticsTags = new List { \"mens-clothing\" },\n }\n )\n);" + "buildTheQuery": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Filters = \"categoryPageId: Men's Clothing\",\n HitsPerPage = 50,\n AnalyticsTags = new List { \"mens-clothing\" },\n }\n )\n);", + "attributesToHighlightOverride": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AttributesToHighlight = new List { \"title\", \"content\" },\n }\n )\n);", + "disableTypoToleranceOnAttributes": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n DisableTypoToleranceOnAttributes = new List { \"serial_number\" },\n }\n )\n);", + "search_a_query": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"\",\n SimilarQuery = \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n Filters = \"year:1991 TO 2001\",\n }\n )\n);", + "search_everything": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"\" })\n);", + "api_filtering_range_example": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"books\", Filters = \"price:10 TO 20\" })\n);", + "override_retrievable_attributes": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AttributesToRetrieve = new List { \"title\", \"content\" },\n }\n )\n);", + "restrict_searchable_attributes": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n RestrictSearchableAttributes = new List { \"title\", \"author\" },\n }\n )\n);", + "override_default_relevancy": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", RelevancyStrictness = 70 })\n);", + "apply_filters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", SumOrFiltersScores = true })\n);", + "apply_all_filters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n Filters =\n \"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\\\"\",\n }\n )\n);", + "escape_spaces": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", Filters = \"category:\\\"Books and Comics\\\"\" }\n )\n);", + "escape_keywords": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Filters = \"keyword:\\\"OR\\\"\" })\n);", + "escape_single_quotes": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", Filters = \"content:\\\"It's a wonderful day\\\"\" }\n )\n);", + "escape_double_quotes": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", Filters = \"content:\\\"She said \\\"Hello World\\\"\" }\n )\n);", + "apply_negative_filters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n OptionalFilters = new OptionalFilters(\n new List\n {\n new OptionalFilters(\"category:Book\"),\n new OptionalFilters(\"author:-John Doe\"),\n }\n ),\n }\n )\n);", + "apply_numeric_filters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n NumericFilters = new NumericFilters(\n new List\n {\n new NumericFilters(\"price < 1000\"),\n new NumericFilters(\n new List\n {\n new NumericFilters(\"inStock = 1\"),\n new NumericFilters(\"deliveryDate < 1441755506\"),\n }\n ),\n }\n ),\n }\n )\n);", + "apply_tag_filters": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n TagFilters = new TagFilters(\n new List\n {\n new TagFilters(\"SciFi\"),\n new TagFilters(\n new List { new TagFilters(\"Book\"), new TagFilters(\"Movie\") }\n ),\n }\n ),\n }\n )\n);", + "facets_all": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n Facets = new List { \"*\" },\n }\n )\n);", + "retrieve_only_some_facets": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n Facets = new List { \"category\", \"author\" },\n }\n )\n);", + "override_default_max_values_per_facet": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", MaxValuesPerFacet = 20 })\n);", + "enable_faceting_after_distinct": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", FacetingAfterDistinct = true })\n);", + "sort_facet_values_alphabetically": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", SortFacetValuesBy = \"count\" })\n);", + "override_attributes_to_snippet": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AttributesToSnippet = new List { \"title\", \"content:80\" },\n }\n )\n);", + "override_default_highlight_pre_tag": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", HighlightPreTag = \"\" })\n);", + "override_default_highlight_post_tag": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", HighlightPostTag = \"\" })\n);", + "override_default_snippet_ellipsis_text": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", SnippetEllipsisText = \"\" })\n);", + "enable_restrict_highlight_and_snippet_arrays": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", RestrictHighlightAndSnippetArrays = false }\n )\n);", + "access_page": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Page = 0 })\n);", + "override_default_hits_per_page": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", HitsPerPage = 10 })\n);", + "get_nth_hit": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Offset = 4 })\n);", + "get_n_results": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Length = 4 })\n);", + "override_default_min_word_size_for_one_typo": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", MinWordSizefor1Typo = 2 })\n);", + "override_default_min_word_size_for_two_typos": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", MinWordSizefor2Typos = 2 })\n);", + "override_default_typo_tolerance_mode": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", TypoTolerance = new TypoTolerance(false) }\n )\n);", + "disable_typos_on_numeric_tokens_at_search_time": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", AllowTyposOnNumericTokens = false }\n )\n);", + "search_around_a_position": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", AroundLatLng = \"40.71, -74.01\" })\n);", + "search_around_server_ip": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", AroundLatLngViaIP = true }),\n new RequestOptionBuilder()\n .AddExtraHeader(\n \"x-forwarded-for\",\n \"94.228.178.246 // should be replaced with the actual IP you would like to search around\"\n )\n .Build()\n);", + "set_around_radius": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", AroundRadius = new AroundRadius(1000) }\n )\n);", + "disable_automatic_radius": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AroundRadius = new AroundRadius(Enum.Parse(\"All\")),\n }\n )\n);", + "set_geo_search_precision": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", AroundPrecision = new AroundPrecision(100) }\n )\n);", + "set_geo_search_precision_non_linear": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AroundPrecision = new AroundPrecision(\n new List\n {\n new Range { From = 0, Value = 25 },\n new Range { From = 2000, Value = 1000 },\n }\n ),\n }\n )\n);", + "set_minimum_geo_search_radius": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", MinimumAroundRadius = 1000 })\n);", + "search_inside_rectangular_area": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n InsideBoundingBox = new InsideBoundingBox(\n new List>\n {\n new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 },\n }\n ),\n }\n )\n);", + "search_inside_multiple_rectangular_areas": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n InsideBoundingBox = new InsideBoundingBox(\n new List>\n {\n new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 },\n new List { 49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875 },\n }\n ),\n }\n )\n);", + "search_inside_polygon_area": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n InsidePolygon = new List>\n {\n new List\n {\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n },\n },\n }\n )\n);", + "search_inside_multiple_polygon_areas": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n InsidePolygon = new List>\n {\n new List\n {\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n },\n new List\n {\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625,\n },\n },\n }\n )\n);", + "set_querylanguages_override": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n RemoveStopWords = new RemoveStopWords(\n new List\n {\n Enum.Parse(\"Ca\"),\n Enum.Parse(\"Es\"),\n }\n ),\n }\n )\n);", + "set_querylanguages_with_japanese_query": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n QueryLanguages = new List\n {\n Enum.Parse(\"Ja\"),\n Enum.Parse(\"En\"),\n },\n }\n )\n);", + "set_natural_languages": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"\",\n NaturalLanguages = new List { Enum.Parse(\"Fr\") },\n }\n )\n);", + "override_natural_languages_with_query": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"\",\n NaturalLanguages = new List { Enum.Parse(\"Fr\") },\n RemoveWordsIfNoResults = Enum.Parse(\"FirstWords\"),\n }\n )\n);", + "enable_decompound_query_search_time": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", DecompoundQuery = true })\n);", + "enable_rules_search_time": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", EnableRules = true })\n);", + "set_rule_contexts": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n RuleContexts = new List { \"front_end\", \"website2\" },\n }\n )\n);", + "enable_personalization": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", EnablePersonalization = true })\n);", + "enable_personalization_with_user_token": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n EnablePersonalization = true,\n UserToken = \"123456\",\n }\n )\n);", + "personalization_impact": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", PersonalizationImpact = 20 })\n);", + "set_user_token": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", UserToken = \"123456\" })\n);", + "set_user_token_with_personalization": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n EnablePersonalization = true,\n UserToken = \"123456\",\n }\n )\n);", + "override_default_query_type": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", QueryType = Enum.Parse(\"PrefixAll\") }\n )\n);", + "override_default_remove_words_if_no_results": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n RemoveWordsIfNoResults = Enum.Parse(\"LastWords\"),\n }\n )\n);", + "enable_advanced_syntax_search_time": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", AdvancedSyntax = true })\n);", + "overide_default_optional_words": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n OptionalWords = new OptionalWords(new List { \"toyota\", \"2020 2021\" }),\n }\n )\n);", + "disabling_exact_for_some_attributes_search_time": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n DisableExactOnAttributes = new List { \"description\" },\n }\n )\n);", + "override_default_exact_single_word_query": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n ExactOnSingleWordQuery = Enum.Parse(\"None\"),\n }\n )\n);", + "override_default_aternative_as_exact": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AlternativesAsExact = new List\n {\n Enum.Parse(\"MultiWordsSynonym\"),\n },\n }\n )\n);", + "enable_advanced_syntax_exact_phrase": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AdvancedSyntax = true,\n AdvancedSyntaxFeatures = new List\n {\n Enum.Parse(\"ExactPhrase\"),\n },\n }\n )\n);", + "enable_advanced_syntax_exclude_words": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AdvancedSyntax = true,\n AdvancedSyntaxFeatures = new List\n {\n Enum.Parse(\"ExcludeWords\"),\n },\n }\n )\n);", + "override_distinct": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Distinct = new Distinct(0) })\n);", + "get_ranking_info": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", GetRankingInfo = true })\n);", + "disable_click_analytics": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", ClickAnalytics = false })\n);", + "enable_click_analytics": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", ClickAnalytics = true })\n);", + "disable_analytics": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Analytics = false })\n);", + "add_analytics_tags": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n AnalyticsTags = new List { \"front_end\", \"website2\" },\n }\n )\n);", + "disable_synonyms": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", Synonyms = false })\n);", + "override_replace_synonyms_in_highlights": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject { Query = \"query\", ReplaceSynonymsInHighlight = true }\n )\n);", + "override_min_proximity": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", MinProximity = 2 })\n);", + "override_default_field": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(\n new SearchParamsObject\n {\n Query = \"query\",\n ResponseFields = new List { \"hits\", \"facets\" },\n }\n )\n);", + "override_percentile_computation": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", PercentileComputation = false })\n);", + "set_ab_test": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", EnableABTest = false })\n);", + "set_enable_re_ranking": "var response = await client.SearchSingleIndexAsync(\n \"\",\n new SearchParams(new SearchParamsObject { Query = \"query\", EnableReRanking = false })\n);" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "var response = await client.SearchSynonymsAsync(\"\");", @@ -346,6 +431,9 @@ "distinct true": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Distinct = new Distinct(true) }\n);", "distinct section": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributeForDistinct = \"section\", Distinct = new Distinct(true) }\n);", "attributesForFaceting allergens": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributesForFaceting = new List { \"allergens\" } }\n);", + "api_attributes_for_faceting": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesForFaceting = new List { \"genre\", \"author\" },\n }\n);", + "api_attributes_for_faceting_searchable": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesForFaceting = new List { \"genre\", \"searchable(author)\" },\n }\n);", + "api_attributes_for_filter_only": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesForFaceting = new List { \"filterOnly(genre)\", \"author\" },\n }\n);", "attributesForFaceting categoryPageId": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesForFaceting = new List { \"searchable(categoryPageId)\" },\n }\n);", "unretrievableAttributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { UnretrievableAttributes = new List { \"visible_by\" } }\n);", "attributesForFaceting user restricted data": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributesForFaceting = new List { \"filterOnly(visible_by)\" } }\n);", @@ -369,6 +457,7 @@ "customRanking and ranking sort alphabetically": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n CustomRanking = new List { \"asc(textual_attribute)\" },\n Ranking = new List\n {\n \"custom\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n },\n }\n);", "relevancyStrictness": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n CustomRanking = new List { \"asc(textual_attribute)\" },\n RelevancyStrictness = 0,\n }\n);", "create replica index": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Replicas = new List { \"products_price_desc\" } }\n);", + "create replica index articles": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Replicas = new List { \"articles_date_desc\" } }\n);", "create virtual replica index": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Replicas = new List { \"virtual(products_price_desc)\" } }\n);", "unlink replica index": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Replicas = new List { \"\" } }\n);", "forwardToReplicas": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"name\", \"description\" },\n },\n true\n);", @@ -378,15 +467,77 @@ "ranking closest dates": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n Ranking = new List\n {\n \"asc(date_timestamp)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n },\n }\n);", "searchableAttributes item variation": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"design\", \"type\", \"color\" },\n }\n);", "searchableAttributes around location": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"name\", \"country\", \"code\", \"iata_code\" },\n CustomRanking = new List { \"desc(links_count)\" },\n }\n);", - "disableTypoToleranceOnAttributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DisableTypoToleranceOnAttributes = new List { \"serial_number\" } }\n);", + "attributesToHighlight": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesToHighlight = new List { \"author\", \"title\", \"content\" },\n }\n);", + "attributesToHighlightStar": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributesToHighlight = new List { \"*\" } }\n);", "everything": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AdvancedSyntax = true,\n AdvancedSyntaxFeatures = new List\n {\n Enum.Parse(\"ExactPhrase\"),\n },\n AllowCompressionOfIntegerArray = true,\n AllowTyposOnNumericTokens = true,\n AlternativesAsExact = new List\n {\n Enum.Parse(\"SingleWordSynonym\"),\n },\n AttributeCriteriaComputedByMinProximity = true,\n AttributeForDistinct = \"test\",\n AttributesForFaceting = new List { \"algolia\" },\n AttributesToHighlight = new List { \"algolia\" },\n AttributesToRetrieve = new List { \"algolia\" },\n AttributesToSnippet = new List { \"algolia\" },\n AttributesToTransliterate = new List { \"algolia\" },\n CamelCaseAttributes = new List { \"algolia\" },\n CustomNormalization = new Dictionary>\n {\n {\n \"algolia\",\n new Dictionary { { \"aloglia\", \"aglolia\" } }\n },\n },\n CustomRanking = new List { \"algolia\" },\n DecompoundQuery = false,\n DecompoundedAttributes = new Dictionary { { \"algolia\", \"aloglia\" } },\n DisableExactOnAttributes = new List { \"algolia\" },\n DisablePrefixOnAttributes = new List { \"algolia\" },\n DisableTypoToleranceOnAttributes = new List { \"algolia\" },\n DisableTypoToleranceOnWords = new List { \"algolia\" },\n Distinct = new Distinct(3),\n EnablePersonalization = true,\n EnableReRanking = false,\n EnableRules = true,\n ExactOnSingleWordQuery = Enum.Parse(\"Attribute\"),\n HighlightPreTag = \"\",\n HighlightPostTag = \"\",\n HitsPerPage = 10,\n IgnorePlurals = new IgnorePlurals(false),\n IndexLanguages = new List { Enum.Parse(\"Fr\") },\n KeepDiacriticsOnCharacters = \"abc\",\n MaxFacetHits = 20,\n MaxValuesPerFacet = 30,\n MinProximity = 6,\n MinWordSizefor1Typo = 5,\n MinWordSizefor2Typos = 11,\n Mode = Enum.Parse(\"NeuralSearch\"),\n NumericAttributesForFiltering = new List { \"algolia\" },\n OptionalWords = new OptionalWords(new List { \"myspace\" }),\n PaginationLimitedTo = 0,\n QueryLanguages = new List { Enum.Parse(\"Fr\") },\n QueryType = Enum.Parse(\"PrefixLast\"),\n Ranking = new List { \"geo\" },\n ReRankingApplyFilter = new ReRankingApplyFilter(\"mySearch:filters\"),\n RelevancyStrictness = 10,\n RemoveStopWords = new RemoveStopWords(false),\n RemoveWordsIfNoResults = Enum.Parse(\"LastWords\"),\n RenderingContent = new RenderingContent\n {\n FacetOrdering = new FacetOrdering\n {\n Facets = new Facets\n {\n Order = new List { \"a\", \"b\" },\n },\n Values = new Dictionary\n {\n {\n \"a\",\n new Value\n {\n Order = new List { \"b\" },\n SortRemainingBy = Enum.Parse(\"Count\"),\n }\n },\n },\n },\n },\n ReplaceSynonymsInHighlight = true,\n Replicas = new List { \"\" },\n ResponseFields = new List { \"algolia\" },\n RestrictHighlightAndSnippetArrays = true,\n SearchableAttributes = new List { \"foo\" },\n SemanticSearch = new SemanticSearch { EventSources = new List { \"foo\" } },\n SeparatorsToIndex = \"bar\",\n SnippetEllipsisText = \"---\",\n SortFacetValuesBy = \"date\",\n TypoTolerance = new TypoTolerance(false),\n UnretrievableAttributes = new List { \"foo\" },\n UserData = new Dictionary { { \"user\", \"data\" } },\n }\n);", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List\n {\n \"brand\",\n \"name\",\n \"categories\",\n \"unordered(description)\",\n },\n CustomRanking = new List { \"desc(popularity)\" },\n AttributesForFaceting = new List\n {\n \"searchable(brand)\",\n \"type\",\n \"categories\",\n \"price\",\n },\n }\n);", + "searchableAttributesOrdering": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"unordered(title)\", \"cast\" },\n }\n);", "searchableAttributesProductReferenceSuffixes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List\n {\n \"name\",\n \"product_reference\",\n \"product_reference_suffixes\",\n },\n }\n);", "queryLanguageAndIgnorePlurals": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n QueryLanguages = new List { Enum.Parse(\"En\") },\n IgnorePlurals = new IgnorePlurals(true),\n }\n);", "searchableAttributesInMovies": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"title_eng\", \"title_fr\", \"title_es\" },\n }\n);", "disablePrefixOnAttributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DisablePrefixOnAttributes = new List { \"serial_number\" } }\n);", + "disableTypoToleranceOnAttributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DisableTypoToleranceOnAttributes = new List { \"serial_number\" } }\n);", "searchableAttributesSimpleExample": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { SearchableAttributes = new List { \"serial_number\" } }\n);", - "searchableAttributesSimpleExampleAlt": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"serial_number\", \"serial_number_suffixes\" },\n }\n);" + "searchableAttributesSimpleExampleAlt": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n SearchableAttributes = new List { \"serial_number\", \"serial_number_suffixes\" },\n }\n);", + "set_searchable_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesForFaceting = new List\n {\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\",\n },\n }\n);", + "unretrievable_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { UnretrievableAttributes = new List { \"total_number_of_sales\" } }\n);", + "set_retrievable_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesToRetrieve = new List { \"author\", \"title\", \"content\" },\n }\n);", + "set_all_attributes_as_retrievable": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributesToRetrieve = new List { \"*\" } }\n);", + "specify_attributes_not_to_retrieve": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesToRetrieve = new List { \"*\", \"-SKU\", \"-internal_desc\" },\n }\n);", + "neural_search": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Mode = Enum.Parse(\"NeuralSearch\") }\n);", + "keyword_search": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Mode = Enum.Parse(\"KeywordSearch\") }\n);", + "set_default_ranking": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n Ranking = new List\n {\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"attribute\",\n \"proximity\",\n \"exact\",\n \"custom\",\n },\n }\n);", + "set_ranking_by_attribute_asc": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n Ranking = new List\n {\n \"asc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n },\n }\n);", + "set_ranking_by_attribute_desc": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n Ranking = new List\n {\n \"desc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n },\n }\n);", + "restrict_searchable_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n CustomRanking = new List { \"desc(popularity)\", \"asc(price)\" },\n }\n);", + "set_default_relevancy": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { RelevancyStrictness = 90 }\n);", + "set_replicas": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n Replicas = new List { \"name_of_replica_index1\", \"name_of_replica_index2\" },\n }\n);", + "set_default_max_values_per_facet": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { MaxValuesPerFacet = 100 }\n);", + "set_default_sort_facet_values_by": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { SortFacetValuesBy = \"alpha\" }\n);", + "set_attributes_to_snippet": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AttributesToSnippet = new List { \"content:80\", \"description\" },\n }\n);", + "set_all_attributes_to_snippet": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributesToSnippet = new List { \"*:80\" } }\n);", + "set_default_highlight_pre_tag": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { HighlightPreTag = \"\" }\n);", + "set_default_highlight_post_tag": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { HighlightPostTag = \"\" }\n);", + "set_default_snippet_ellipsis_text": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { SnippetEllipsisText = \"…\" }\n);", + "enable_restrict_highlight_and_snippet_arrays_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { RestrictHighlightAndSnippetArrays = true }\n);", + "set_default_hits_per_page": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { HitsPerPage = 20 }\n);", + "set_pagination_limit": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { PaginationLimitedTo = 1000 }\n);", + "set_default_min_word_size_for_one_typo": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { MinWordSizefor1Typo = 4 }\n);", + "set_default_min_word_size_for_two_typos": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { MinWordSizefor2Typos = 4 }\n);", + "set_default_typo_tolerance_mode": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { TypoTolerance = new TypoTolerance(true) }\n);", + "disable_typos_on_numeric_tokens_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AllowTyposOnNumericTokens = false }\n);", + "disable_typo_tolerance_for_words": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n DisableTypoToleranceOnWords = new List { \"wheel\", \"1X2BCD\" },\n }\n);", + "set_separators_to_index": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { SeparatorsToIndex = \"+#\" }\n);", + "set_languages_using_querylanguages": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n QueryLanguages = new List { Enum.Parse(\"Es\") },\n RemoveStopWords = new RemoveStopWords(true),\n IgnorePlurals = new IgnorePlurals(true),\n }\n);", + "set_attributes_to_transliterate": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n IndexLanguages = new List { Enum.Parse(\"Ja\") },\n AttributesToTransliterate = new List { \"name\", \"description\" },\n }\n);", + "set_camel_case_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { CamelCaseAttributes = new List { \"description\" } }\n);", + "set_decompounded_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n DecompoundedAttributes = new Dictionary>\n {\n {\n \"de\",\n new List { \"name\" }\n },\n },\n }\n);", + "set_decompounded_multiple_attributes": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n DecompoundedAttributes = new Dictionary>\n {\n {\n \"de\",\n new List { \"name_de\", \"description_de\" }\n },\n {\n \"fi\",\n new List { \"name_fi\", \"description_fi\" }\n },\n },\n }\n);", + "set_keep_diacritics_on_characters": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { KeepDiacriticsOnCharacters = \"øé\" }\n);", + "set_custom_normalization": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n CustomNormalization = new Dictionary>\n {\n {\n \"default\",\n new Dictionary { { \"ä\", \"ae\" } }\n },\n },\n }\n);", + "set_indexlanguages": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n IndexLanguages = new List { Enum.Parse(\"Ja\") },\n }\n);", + "enable_decompound_query_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DecompoundQuery = true }\n);", + "enable_rules_syntax_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { EnableRules = true }\n);", + "enable_personalization_settings": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { EnablePersonalization = true }\n);", + "set_default_query_type": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { QueryType = Enum.Parse(\"PrefixLast\") }\n);", + "set_default_remove_words_if_no_result": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { RemoveWordsIfNoResults = Enum.Parse(\"None\") }\n);", + "enable_advanced_syntax_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AdvancedSyntax = true }\n);", + "set_default_optional_words": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n OptionalWords = new OptionalWords(new List { \"blue\", \"iphone case\" }),\n }\n);", + "disabling_prefix_search_for_some_attributes_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DisablePrefixOnAttributes = new List { \"sku\" } }\n);", + "disabling_exact_for_some_attributes_by_default": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { DisableExactOnAttributes = new List { \"description\" } }\n);", + "set_default_exact_single_word_query": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { ExactOnSingleWordQuery = Enum.Parse(\"Attribute\") }\n);", + "set_default_aternative_as_exact": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n AlternativesAsExact = new List\n {\n Enum.Parse(\"IgnorePlurals\"),\n Enum.Parse(\"SingleWordSynonym\"),\n },\n }\n);", + "set_numeric_attributes_for_filtering": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n NumericAttributesForFiltering = new List { \"quantity\", \"popularity\" },\n }\n);", + "enable_compression_of_integer_array": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AllowCompressionOfIntegerArray = true }\n);", + "set_attributes_for_distinct": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributeForDistinct = \"url\" }\n);", + "set_distinct": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { Distinct = new Distinct(1), AttributeForDistinct = \"url\" }\n);", + "set_replace_synonyms_in_highlights": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { ReplaceSynonymsInHighlight = false }\n);", + "set_min_proximity": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { MinProximity = 1 }\n);", + "set_default_field": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n ResponseFields = new List { \"hits\", \"hitsPerPage\", \"nbPages\", \"page\" },\n }\n);", + "set_max_facet_hits": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { MaxFacetHits = 10 }\n);", + "set_attribute_criteria_computed_by_min_proximity": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings { AttributeCriteriaComputedByMinProximity = true }\n);", + "set_user_data": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n UserData = new Dictionary\n {\n { \"extraData\", \"This is the custom data that you want to store in your index\" },\n },\n }\n);", + "set_rendering_content": "var response = await client.SetSettingsAsync(\n \"\",\n new IndexSettings\n {\n RenderingContent = new RenderingContent\n {\n FacetOrdering = new FacetOrdering\n {\n Facets = new Facets\n {\n Order = new List { \"size\", \"brand\" },\n },\n Values = new Dictionary\n {\n {\n \"brand\",\n new Value\n {\n Order = new List { \"uniqlo\" },\n Hide = new List { \"muji\" },\n SortRemainingBy = Enum.Parse(\"Count\"),\n }\n },\n {\n \"size\",\n new Value\n {\n Order = new List { \"S\", \"M\", \"L\" },\n SortRemainingBy = Enum.Parse(\"Hidden\"),\n }\n },\n },\n },\n },\n }\n);" }, "updateApiKey": { "default": "var response = await client.UpdateApiKeyAsync(\n \"ALGOLIA_API_KEY\",\n new ApiKey\n {\n Acl = new List { Enum.Parse(\"Search\"), Enum.Parse(\"AddObject\") },\n Validity = 300,\n MaxQueriesPerIPPerHour = 100,\n MaxHitsPerQuery = 20,\n }\n);" @@ -701,6 +852,10 @@ "filtersStephenKing": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n filters: \"author:\\\"Stephen King\\\"\",\n ),\n);", "filtersNotTags": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n filters: \"NOT _tags:non-fiction\",\n ),\n);", "facetFiltersList": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n facetFilters: [\n \"publisher:Penguin\",\n [\n \"author:Stephen King\",\n \"genre:Horror\",\n ],\n ],\n ),\n);", + "facetFiltersBook": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facetFilters: [\n \"category:Book\",\n ],\n ),\n);", + "facetFiltersAND": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facetFilters: [\n \"category:Book\",\n \"author:John Doe\",\n ],\n ),\n);", + "facetFiltersOR": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facetFilters: [\n [\n \"category:Book\",\n \"author:John Doe\",\n ],\n ],\n ),\n);", + "facetFiltersCombined": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facetFilters: [\n \"author:John Doe\",\n [\n \"category:Book\",\n \"category:Movie\",\n ],\n ],\n ),\n);", "facetFiltersNeg": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n facetFilters: \"category:-Ebook\",\n ),\n);", "filtersAndFacetFilters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n filters: \"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\",\n facetFilters: [\n \"publisher:Penguin\",\n ],\n ),\n);", "facet author genre": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n facets: [\n \"author\",\n \"genre\",\n ],\n ),\n);", @@ -720,9 +875,90 @@ "clickAnalyticsUserToken": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n clickAnalytics: true,\n userToken: \"user-1\",\n ),\n);", "enablePersonalization": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n enablePersonalization: true,\n userToken: \"user-1\",\n ),\n);", "userToken": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n userToken: \"user-1\",\n ),\n);", + "userToken1234": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n userToken: \"user-1234\",\n ),\n);", "analyticsTag": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n analyticsTags: [\n \"YOUR_ANALYTICS_TAG\",\n ],\n ),\n);", "facetFiltersUsers": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n facetFilters: [\n \"user:user42\",\n \"user:public\",\n ],\n ),\n);", - "buildTheQuery": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n filters: \"categoryPageId: Men's Clothing\",\n hitsPerPage: 50,\n analyticsTags: [\n \"mens-clothing\",\n ],\n ),\n);" + "buildTheQuery": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n filters: \"categoryPageId: Men's Clothing\",\n hitsPerPage: 50,\n analyticsTags: [\n \"mens-clothing\",\n ],\n ),\n);", + "attributesToHighlightOverride": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n attributesToHighlight: [\n \"title\",\n \"content\",\n ],\n ),\n);", + "disableTypoToleranceOnAttributes": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n disableTypoToleranceOnAttributes: [\n \"serial_number\",\n ],\n ),\n);", + "search_a_query": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"\",\n similarQuery:\n \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n filters: \"year:1991 TO 2001\",\n ),\n);", + "search_everything": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"\",\n ),\n);", + "api_filtering_range_example": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"books\",\n filters: \"price:10 TO 20\",\n ),\n);", + "override_retrievable_attributes": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n attributesToRetrieve: [\n \"title\",\n \"content\",\n ],\n ),\n);", + "restrict_searchable_attributes": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n restrictSearchableAttributes: [\n \"title\",\n \"author\",\n ],\n ),\n);", + "override_default_relevancy": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n relevancyStrictness: 70,\n ),\n);", + "apply_filters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n sumOrFiltersScores: true,\n ),\n);", + "apply_all_filters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n filters:\n \"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\\\"\",\n ),\n);", + "escape_spaces": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n filters: \"category:\\\"Books and Comics\\\"\",\n ),\n);", + "escape_keywords": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n filters: \"keyword:\\\"OR\\\"\",\n ),\n);", + "escape_single_quotes": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n filters: \"content:\\\"It's a wonderful day\\\"\",\n ),\n);", + "escape_double_quotes": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n filters: \"content:\\\"She said \\\"Hello World\\\"\",\n ),\n);", + "apply_negative_filters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n optionalFilters: [\n \"category:Book\",\n \"author:-John Doe\",\n ],\n ),\n);", + "apply_numeric_filters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n numericFilters: [\n \"price < 1000\",\n [\n \"inStock = 1\",\n \"deliveryDate < 1441755506\",\n ],\n ],\n ),\n);", + "apply_tag_filters": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n tagFilters: [\n \"SciFi\",\n [\n \"Book\",\n \"Movie\",\n ],\n ],\n ),\n);", + "facets_all": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facets: [\n \"*\",\n ],\n ),\n);", + "retrieve_only_some_facets": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facets: [\n \"category\",\n \"author\",\n ],\n ),\n);", + "override_default_max_values_per_facet": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n maxValuesPerFacet: 20,\n ),\n);", + "enable_faceting_after_distinct": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n facetingAfterDistinct: true,\n ),\n);", + "sort_facet_values_alphabetically": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n sortFacetValuesBy: \"count\",\n ),\n);", + "override_attributes_to_snippet": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n attributesToSnippet: [\n \"title\",\n \"content:80\",\n ],\n ),\n);", + "override_default_highlight_pre_tag": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n highlightPreTag: \"\",\n ),\n);", + "override_default_highlight_post_tag": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n highlightPostTag: \"\",\n ),\n);", + "override_default_snippet_ellipsis_text": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n snippetEllipsisText: \"\",\n ),\n);", + "enable_restrict_highlight_and_snippet_arrays": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n restrictHighlightAndSnippetArrays: false,\n ),\n);", + "access_page": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n page: 0,\n ),\n);", + "override_default_hits_per_page": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n hitsPerPage: 10,\n ),\n);", + "get_nth_hit": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n offset: 4,\n ),\n);", + "get_n_results": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n length: 4,\n ),\n);", + "override_default_min_word_size_for_one_typo": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n minWordSizefor1Typo: 2,\n ),\n);", + "override_default_min_word_size_for_two_typos": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n minWordSizefor2Typos: 2,\n ),\n);", + "override_default_typo_tolerance_mode": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n typoTolerance: false,\n ),\n);", + "disable_typos_on_numeric_tokens_at_search_time": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n allowTyposOnNumericTokens: false,\n ),\n);", + "search_around_a_position": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundLatLng: \"40.71, -74.01\",\n ),\n);", + "search_around_server_ip": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundLatLngViaIP: true,\n ),\n requestOptions: RequestOptions(\n headers: {\n 'x-forwarded-for':\n '94.228.178.246 // should be replaced with the actual IP you would like to search around',\n },\n ),\n);", + "set_around_radius": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundRadius: 1000,\n ),\n);", + "disable_automatic_radius": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundRadius: AroundRadiusAll.fromJson(\"all\"),\n ),\n);", + "set_geo_search_precision": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundPrecision: 100,\n ),\n);", + "set_geo_search_precision_non_linear": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n aroundPrecision: [\n Range(\n from: 0,\n value: 25,\n ),\n Range(\n from: 2000,\n value: 1000,\n ),\n ],\n ),\n);", + "set_minimum_geo_search_radius": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n minimumAroundRadius: 1000,\n ),\n);", + "search_inside_rectangular_area": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n insideBoundingBox: [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n ],\n ],\n ),\n);", + "search_inside_multiple_rectangular_areas": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n insideBoundingBox: [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n ],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n ],\n ],\n ),\n);", + "search_inside_polygon_area": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n insidePolygon: [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n ],\n ],\n ),\n);", + "search_inside_multiple_polygon_areas": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n insidePolygon: [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n ],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625,\n ],\n ],\n ),\n);", + "set_querylanguages_override": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n removeStopWords: [\n SupportedLanguage.fromJson(\"ca\"),\n SupportedLanguage.fromJson(\"es\"),\n ],\n ),\n);", + "set_querylanguages_with_japanese_query": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n queryLanguages: [\n SupportedLanguage.fromJson(\"ja\"),\n SupportedLanguage.fromJson(\"en\"),\n ],\n ),\n);", + "set_natural_languages": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"\",\n naturalLanguages: [\n SupportedLanguage.fromJson(\"fr\"),\n ],\n ),\n);", + "override_natural_languages_with_query": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"\",\n naturalLanguages: [\n SupportedLanguage.fromJson(\"fr\"),\n ],\n removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson(\"firstWords\"),\n ),\n);", + "enable_decompound_query_search_time": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n decompoundQuery: true,\n ),\n);", + "enable_rules_search_time": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enableRules: true,\n ),\n);", + "set_rule_contexts": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n ruleContexts: [\n \"front_end\",\n \"website2\",\n ],\n ),\n);", + "enable_personalization": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enablePersonalization: true,\n ),\n);", + "enable_personalization_with_user_token": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enablePersonalization: true,\n userToken: \"123456\",\n ),\n);", + "personalization_impact": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n personalizationImpact: 20,\n ),\n);", + "set_user_token": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n userToken: \"123456\",\n ),\n);", + "set_user_token_with_personalization": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enablePersonalization: true,\n userToken: \"123456\",\n ),\n);", + "override_default_query_type": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n queryType: QueryType.fromJson(\"prefixAll\"),\n ),\n);", + "override_default_remove_words_if_no_results": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson(\"lastWords\"),\n ),\n);", + "enable_advanced_syntax_search_time": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n advancedSyntax: true,\n ),\n);", + "overide_default_optional_words": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n optionalWords: [\n \"toyota\",\n \"2020 2021\",\n ],\n ),\n);", + "disabling_exact_for_some_attributes_search_time": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n disableExactOnAttributes: [\n \"description\",\n ],\n ),\n);", + "override_default_exact_single_word_query": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson(\"none\"),\n ),\n);", + "override_default_aternative_as_exact": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n alternativesAsExact: [\n AlternativesAsExact.fromJson(\"multiWordsSynonym\"),\n ],\n ),\n);", + "enable_advanced_syntax_exact_phrase": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n advancedSyntax: true,\n advancedSyntaxFeatures: [\n AdvancedSyntaxFeatures.fromJson(\"exactPhrase\"),\n ],\n ),\n);", + "enable_advanced_syntax_exclude_words": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n advancedSyntax: true,\n advancedSyntaxFeatures: [\n AdvancedSyntaxFeatures.fromJson(\"excludeWords\"),\n ],\n ),\n);", + "override_distinct": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n distinct: 0,\n ),\n);", + "get_ranking_info": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n getRankingInfo: true,\n ),\n);", + "disable_click_analytics": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n clickAnalytics: false,\n ),\n);", + "enable_click_analytics": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n clickAnalytics: true,\n ),\n);", + "disable_analytics": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n analytics: false,\n ),\n);", + "add_analytics_tags": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n analyticsTags: [\n \"front_end\",\n \"website2\",\n ],\n ),\n);", + "disable_synonyms": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n synonyms: false,\n ),\n);", + "override_replace_synonyms_in_highlights": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n replaceSynonymsInHighlight: true,\n ),\n);", + "override_min_proximity": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n minProximity: 2,\n ),\n);", + "override_default_field": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n responseFields: [\n \"hits\",\n \"facets\",\n ],\n ),\n);", + "override_percentile_computation": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n percentileComputation: false,\n ),\n);", + "set_ab_test": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enableABTest: false,\n ),\n);", + "set_enable_re_ranking": "final response = await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchParamsObject(\n query: \"query\",\n enableReRanking: false,\n ),\n);" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "final response = await client.searchSynonyms(\n indexName: \"\",\n);", @@ -753,6 +989,9 @@ "distinct true": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n distinct: true,\n ),\n);", "distinct section": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributeForDistinct: \"section\",\n distinct: true,\n ),\n);", "attributesForFaceting allergens": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"allergens\",\n ],\n ),\n);", + "api_attributes_for_faceting": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"genre\",\n \"author\",\n ],\n ),\n);", + "api_attributes_for_faceting_searchable": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"genre\",\n \"searchable(author)\",\n ],\n ),\n);", + "api_attributes_for_filter_only": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"filterOnly(genre)\",\n \"author\",\n ],\n ),\n);", "attributesForFaceting categoryPageId": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"searchable(categoryPageId)\",\n ],\n ),\n);", "unretrievableAttributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n unretrievableAttributes: [\n \"visible_by\",\n ],\n ),\n);", "attributesForFaceting user restricted data": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"filterOnly(visible_by)\",\n ],\n ),\n);", @@ -776,6 +1015,7 @@ "customRanking and ranking sort alphabetically": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n customRanking: [\n \"asc(textual_attribute)\",\n ],\n ranking: [\n \"custom\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n ],\n ),\n);", "relevancyStrictness": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n customRanking: [\n \"asc(textual_attribute)\",\n ],\n relevancyStrictness: 0,\n ),\n);", "create replica index": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replicas: [\n \"products_price_desc\",\n ],\n ),\n);", + "create replica index articles": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replicas: [\n \"articles_date_desc\",\n ],\n ),\n);", "create virtual replica index": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replicas: [\n \"virtual(products_price_desc)\",\n ],\n ),\n);", "unlink replica index": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replicas: [\n \"\",\n ],\n ),\n);", "forwardToReplicas": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"name\",\n \"description\",\n ],\n ),\n forwardToReplicas: true,\n);", @@ -785,15 +1025,77 @@ "ranking closest dates": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ranking: [\n \"asc(date_timestamp)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n ),\n);", "searchableAttributes item variation": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"design\",\n \"type\",\n \"color\",\n ],\n ),\n);", "searchableAttributes around location": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"name\",\n \"country\",\n \"code\",\n \"iata_code\",\n ],\n customRanking: [\n \"desc(links_count)\",\n ],\n ),\n);", - "disableTypoToleranceOnAttributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disableTypoToleranceOnAttributes: [\n \"serial_number\",\n ],\n ),\n);", + "attributesToHighlight": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToHighlight: [\n \"author\",\n \"title\",\n \"content\",\n ],\n ),\n);", + "attributesToHighlightStar": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToHighlight: [\n \"*\",\n ],\n ),\n);", "everything": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n advancedSyntax: true,\n advancedSyntaxFeatures: [\n AdvancedSyntaxFeatures.fromJson(\"exactPhrase\"),\n ],\n allowCompressionOfIntegerArray: true,\n allowTyposOnNumericTokens: true,\n alternativesAsExact: [\n AlternativesAsExact.fromJson(\"singleWordSynonym\"),\n ],\n attributeCriteriaComputedByMinProximity: true,\n attributeForDistinct: \"test\",\n attributesForFaceting: [\n \"algolia\",\n ],\n attributesToHighlight: [\n \"algolia\",\n ],\n attributesToRetrieve: [\n \"algolia\",\n ],\n attributesToSnippet: [\n \"algolia\",\n ],\n attributesToTransliterate: [\n \"algolia\",\n ],\n camelCaseAttributes: [\n \"algolia\",\n ],\n customNormalization: {\n 'algolia': {\n 'aloglia': \"aglolia\",\n },\n },\n customRanking: [\n \"algolia\",\n ],\n decompoundQuery: false,\n decompoundedAttributes: {\n 'algolia': \"aloglia\",\n },\n disableExactOnAttributes: [\n \"algolia\",\n ],\n disablePrefixOnAttributes: [\n \"algolia\",\n ],\n disableTypoToleranceOnAttributes: [\n \"algolia\",\n ],\n disableTypoToleranceOnWords: [\n \"algolia\",\n ],\n distinct: 3,\n enablePersonalization: true,\n enableReRanking: false,\n enableRules: true,\n exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson(\"attribute\"),\n highlightPreTag: \"\",\n highlightPostTag: \"\",\n hitsPerPage: 10,\n ignorePlurals: false,\n indexLanguages: [\n SupportedLanguage.fromJson(\"fr\"),\n ],\n keepDiacriticsOnCharacters: \"abc\",\n maxFacetHits: 20,\n maxValuesPerFacet: 30,\n minProximity: 6,\n minWordSizefor1Typo: 5,\n minWordSizefor2Typos: 11,\n mode: Mode.fromJson(\"neuralSearch\"),\n numericAttributesForFiltering: [\n \"algolia\",\n ],\n optionalWords: [\n \"myspace\",\n ],\n paginationLimitedTo: 0,\n queryLanguages: [\n SupportedLanguage.fromJson(\"fr\"),\n ],\n queryType: QueryType.fromJson(\"prefixLast\"),\n ranking: [\n \"geo\",\n ],\n reRankingApplyFilter: \"mySearch:filters\",\n relevancyStrictness: 10,\n removeStopWords: false,\n removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson(\"lastWords\"),\n renderingContent: RenderingContent(\n facetOrdering: FacetOrdering(\n facets: Facets(\n order: [\n \"a\",\n \"b\",\n ],\n ),\n values: {\n 'a': Value(\n order: [\n \"b\",\n ],\n sortRemainingBy: SortRemainingBy.fromJson(\"count\"),\n ),\n },\n ),\n ),\n replaceSynonymsInHighlight: true,\n replicas: [\n \"\",\n ],\n responseFields: [\n \"algolia\",\n ],\n restrictHighlightAndSnippetArrays: true,\n searchableAttributes: [\n \"foo\",\n ],\n semanticSearch: SemanticSearch(\n eventSources: [\n \"foo\",\n ],\n ),\n separatorsToIndex: \"bar\",\n snippetEllipsisText: \"---\",\n sortFacetValuesBy: \"date\",\n typoTolerance: false,\n unretrievableAttributes: [\n \"foo\",\n ],\n userData: {\n 'user': \"data\",\n },\n ),\n);", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"brand\",\n \"name\",\n \"categories\",\n \"unordered(description)\",\n ],\n customRanking: [\n \"desc(popularity)\",\n ],\n attributesForFaceting: [\n \"searchable(brand)\",\n \"type\",\n \"categories\",\n \"price\",\n ],\n ),\n);", + "searchableAttributesOrdering": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"unordered(title)\",\n \"cast\",\n ],\n ),\n);", "searchableAttributesProductReferenceSuffixes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"name\",\n \"product_reference\",\n \"product_reference_suffixes\",\n ],\n ),\n);", "queryLanguageAndIgnorePlurals": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n queryLanguages: [\n SupportedLanguage.fromJson(\"en\"),\n ],\n ignorePlurals: true,\n ),\n);", "searchableAttributesInMovies": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"title_eng\",\n \"title_fr\",\n \"title_es\",\n ],\n ),\n);", "disablePrefixOnAttributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disablePrefixOnAttributes: [\n \"serial_number\",\n ],\n ),\n);", + "disableTypoToleranceOnAttributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disableTypoToleranceOnAttributes: [\n \"serial_number\",\n ],\n ),\n);", "searchableAttributesSimpleExample": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"serial_number\",\n ],\n ),\n);", - "searchableAttributesSimpleExampleAlt": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"serial_number\",\n \"serial_number_suffixes\",\n ],\n ),\n);" + "searchableAttributesSimpleExampleAlt": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\n \"serial_number\",\n \"serial_number_suffixes\",\n ],\n ),\n);", + "set_searchable_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\",\n ],\n ),\n);", + "unretrievable_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n unretrievableAttributes: [\n \"total_number_of_sales\",\n ],\n ),\n);", + "set_retrievable_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToRetrieve: [\n \"author\",\n \"title\",\n \"content\",\n ],\n ),\n);", + "set_all_attributes_as_retrievable": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToRetrieve: [\n \"*\",\n ],\n ),\n);", + "specify_attributes_not_to_retrieve": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToRetrieve: [\n \"*\",\n \"-SKU\",\n \"-internal_desc\",\n ],\n ),\n);", + "neural_search": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n mode: Mode.fromJson(\"neuralSearch\"),\n ),\n);", + "keyword_search": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n mode: Mode.fromJson(\"keywordSearch\"),\n ),\n);", + "set_default_ranking": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ranking: [\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"attribute\",\n \"proximity\",\n \"exact\",\n \"custom\",\n ],\n ),\n);", + "set_ranking_by_attribute_asc": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ranking: [\n \"asc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n ),\n);", + "set_ranking_by_attribute_desc": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ranking: [\n \"desc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n ),\n);", + "restrict_searchable_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n customRanking: [\n \"desc(popularity)\",\n \"asc(price)\",\n ],\n ),\n);", + "set_default_relevancy": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n relevancyStrictness: 90,\n ),\n);", + "set_replicas": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replicas: [\n \"name_of_replica_index1\",\n \"name_of_replica_index2\",\n ],\n ),\n);", + "set_default_max_values_per_facet": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n maxValuesPerFacet: 100,\n ),\n);", + "set_default_sort_facet_values_by": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n sortFacetValuesBy: \"alpha\",\n ),\n);", + "set_attributes_to_snippet": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToSnippet: [\n \"content:80\",\n \"description\",\n ],\n ),\n);", + "set_all_attributes_to_snippet": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToSnippet: [\n \"*:80\",\n ],\n ),\n);", + "set_default_highlight_pre_tag": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n highlightPreTag: \"\",\n ),\n);", + "set_default_highlight_post_tag": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n highlightPostTag: \"\",\n ),\n);", + "set_default_snippet_ellipsis_text": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n snippetEllipsisText: \"…\",\n ),\n);", + "enable_restrict_highlight_and_snippet_arrays_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n restrictHighlightAndSnippetArrays: true,\n ),\n);", + "set_default_hits_per_page": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n hitsPerPage: 20,\n ),\n);", + "set_pagination_limit": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n paginationLimitedTo: 1000,\n ),\n);", + "set_default_min_word_size_for_one_typo": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n minWordSizefor1Typo: 4,\n ),\n);", + "set_default_min_word_size_for_two_typos": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n minWordSizefor2Typos: 4,\n ),\n);", + "set_default_typo_tolerance_mode": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n typoTolerance: true,\n ),\n);", + "disable_typos_on_numeric_tokens_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n allowTyposOnNumericTokens: false,\n ),\n);", + "disable_typo_tolerance_for_words": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disableTypoToleranceOnWords: [\n \"wheel\",\n \"1X2BCD\",\n ],\n ),\n);", + "set_separators_to_index": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n separatorsToIndex: \"+#\",\n ),\n);", + "set_languages_using_querylanguages": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n queryLanguages: [\n SupportedLanguage.fromJson(\"es\"),\n ],\n removeStopWords: true,\n ignorePlurals: true,\n ),\n);", + "set_attributes_to_transliterate": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n indexLanguages: [\n SupportedLanguage.fromJson(\"ja\"),\n ],\n attributesToTransliterate: [\n \"name\",\n \"description\",\n ],\n ),\n);", + "set_camel_case_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n camelCaseAttributes: [\n \"description\",\n ],\n ),\n);", + "set_decompounded_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n decompoundedAttributes: {\n 'de': [\n \"name\",\n ],\n },\n ),\n);", + "set_decompounded_multiple_attributes": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n decompoundedAttributes: {\n 'de': [\n \"name_de\",\n \"description_de\",\n ],\n 'fi': [\n \"name_fi\",\n \"description_fi\",\n ],\n },\n ),\n);", + "set_keep_diacritics_on_characters": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n keepDiacriticsOnCharacters: \"øé\",\n ),\n);", + "set_custom_normalization": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n customNormalization: {\n 'default': {\n 'ä': \"ae\",\n },\n },\n ),\n);", + "set_indexlanguages": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n indexLanguages: [\n SupportedLanguage.fromJson(\"ja\"),\n ],\n ),\n);", + "enable_decompound_query_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n decompoundQuery: true,\n ),\n);", + "enable_rules_syntax_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n enableRules: true,\n ),\n);", + "enable_personalization_settings": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n enablePersonalization: true,\n ),\n);", + "set_default_query_type": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n queryType: QueryType.fromJson(\"prefixLast\"),\n ),\n);", + "set_default_remove_words_if_no_result": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson(\"none\"),\n ),\n);", + "enable_advanced_syntax_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n advancedSyntax: true,\n ),\n);", + "set_default_optional_words": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n optionalWords: [\n \"blue\",\n \"iphone case\",\n ],\n ),\n);", + "disabling_prefix_search_for_some_attributes_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disablePrefixOnAttributes: [\n \"sku\",\n ],\n ),\n);", + "disabling_exact_for_some_attributes_by_default": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n disableExactOnAttributes: [\n \"description\",\n ],\n ),\n);", + "set_default_exact_single_word_query": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson(\"attribute\"),\n ),\n);", + "set_default_aternative_as_exact": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n alternativesAsExact: [\n AlternativesAsExact.fromJson(\"ignorePlurals\"),\n AlternativesAsExact.fromJson(\"singleWordSynonym\"),\n ],\n ),\n);", + "set_numeric_attributes_for_filtering": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n numericAttributesForFiltering: [\n \"quantity\",\n \"popularity\",\n ],\n ),\n);", + "enable_compression_of_integer_array": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n allowCompressionOfIntegerArray: true,\n ),\n);", + "set_attributes_for_distinct": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributeForDistinct: \"url\",\n ),\n);", + "set_distinct": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n distinct: 1,\n attributeForDistinct: \"url\",\n ),\n);", + "set_replace_synonyms_in_highlights": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n replaceSynonymsInHighlight: false,\n ),\n);", + "set_min_proximity": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n minProximity: 1,\n ),\n);", + "set_default_field": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n responseFields: [\n \"hits\",\n \"hitsPerPage\",\n \"nbPages\",\n \"page\",\n ],\n ),\n);", + "set_max_facet_hits": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n maxFacetHits: 10,\n ),\n);", + "set_attribute_criteria_computed_by_min_proximity": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributeCriteriaComputedByMinProximity: true,\n ),\n);", + "set_user_data": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n userData: {\n 'extraData':\n \"This is the custom data that you want to store in your index\",\n },\n ),\n);", + "set_rendering_content": "final response = await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n renderingContent: RenderingContent(\n facetOrdering: FacetOrdering(\n facets: Facets(\n order: [\n \"size\",\n \"brand\",\n ],\n ),\n values: {\n 'brand': Value(\n order: [\n \"uniqlo\",\n ],\n hide: [\n \"muji\",\n ],\n sortRemainingBy: SortRemainingBy.fromJson(\"count\"),\n ),\n 'size': Value(\n order: [\n \"S\",\n \"M\",\n \"L\",\n ],\n sortRemainingBy: SortRemainingBy.fromJson(\"hidden\"),\n ),\n },\n ),\n ),\n ),\n);" }, "updateApiKey": { "default": "final response = await client.updateApiKey(\n key: \"ALGOLIA_API_KEY\",\n apiKey: ApiKey(\n acl: [\n Acl.fromJson(\"search\"),\n Acl.fromJson(\"addObject\"),\n ],\n validity: 300,\n maxQueriesPerIPPerHour: 100,\n maxHitsPerQuery: 20,\n ),\n);" @@ -1108,6 +1410,10 @@ "filtersStephenKing": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFilters(\"author:\\\"Stephen King\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "filtersNotTags": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFilters(\"NOT _tags:non-fiction\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "facetFiltersList": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"publisher:Penguin\"), *search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"author:Stephen King\"), *search.StringAsFacetFilters(\"genre:Horror\")})})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "facetFiltersBook": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"category:Book\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "facetFiltersAND": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"category:Book\"), *search.StringAsFacetFilters(\"author:John Doe\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "facetFiltersOR": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"category:Book\"), *search.StringAsFacetFilters(\"author:John Doe\")})})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "facetFiltersCombined": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"author:John Doe\"), *search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"category:Book\"), *search.StringAsFacetFilters(\"category:Movie\")})})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "facetFiltersNeg": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFacetFilters(search.StringAsFacetFilters(\"category:-Ebook\")))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "filtersAndFacetFilters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFilters(\"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"publisher:Penguin\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "facet author genre": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFacets(\n []string{\"author\", \"genre\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", @@ -1127,9 +1433,90 @@ "clickAnalyticsUserToken": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetClickAnalytics(true).SetUserToken(\"user-1\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "enablePersonalization": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetEnablePersonalization(true).SetUserToken(\"user-1\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "userToken": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetUserToken(\"user-1\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "userToken1234": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetUserToken(\"user-1234\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "analyticsTag": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetAnalyticsTags(\n []string{\"YOUR_ANALYTICS_TAG\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "facetFiltersUsers": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters(\n []search.FacetFilters{*search.StringAsFacetFilters(\"user:user42\"), *search.StringAsFacetFilters(\"user:public\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", - "buildTheQuery": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFilters(\"categoryPageId: Men's Clothing\").SetHitsPerPage(50).SetAnalyticsTags(\n []string{\"mens-clothing\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}" + "buildTheQuery": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetFilters(\"categoryPageId: Men's Clothing\").SetHitsPerPage(50).SetAnalyticsTags(\n []string{\"mens-clothing\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "attributesToHighlightOverride": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAttributesToHighlight(\n []string{\"title\", \"content\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disableTypoToleranceOnAttributes": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetDisableTypoToleranceOnAttributes(\n []string{\"serial_number\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_a_query": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"\").SetSimilarQuery(\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\").SetFilters(\"year:1991 TO 2001\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_everything": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "api_filtering_range_example": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"books\").SetFilters(\"price:10 TO 20\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_retrievable_attributes": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAttributesToRetrieve(\n []string{\"title\", \"content\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "restrict_searchable_attributes": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRestrictSearchableAttributes(\n []string{\"title\", \"author\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_relevancy": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRelevancyStrictness(70))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "apply_filters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetSumOrFiltersScores(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "apply_all_filters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFilters(\"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\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "escape_spaces": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFilters(\"category:\\\"Books and Comics\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "escape_keywords": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFilters(\"keyword:\\\"OR\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "escape_single_quotes": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFilters(\"content:\\\"It's a wonderful day\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "escape_double_quotes": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFilters(\"content:\\\"She said \\\"Hello World\\\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "apply_negative_filters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetOptionalFilters(search.ArrayOfOptionalFiltersAsOptionalFilters(\n []search.OptionalFilters{*search.StringAsOptionalFilters(\"category:Book\"), *search.StringAsOptionalFilters(\"author:-John Doe\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "apply_numeric_filters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetNumericFilters(search.ArrayOfNumericFiltersAsNumericFilters(\n []search.NumericFilters{*search.StringAsNumericFilters(\"price < 1000\"), *search.ArrayOfNumericFiltersAsNumericFilters(\n []search.NumericFilters{*search.StringAsNumericFilters(\"inStock = 1\"), *search.StringAsNumericFilters(\"deliveryDate < 1441755506\")})})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "apply_tag_filters": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetTagFilters(search.ArrayOfTagFiltersAsTagFilters(\n []search.TagFilters{*search.StringAsTagFilters(\"SciFi\"), *search.ArrayOfTagFiltersAsTagFilters(\n []search.TagFilters{*search.StringAsTagFilters(\"Book\"), *search.StringAsTagFilters(\"Movie\")})})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "facets_all": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacets(\n []string{\"*\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "retrieve_only_some_facets": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacets(\n []string{\"category\", \"author\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_max_values_per_facet": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetMaxValuesPerFacet(20))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_faceting_after_distinct": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetFacetingAfterDistinct(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "sort_facet_values_alphabetically": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetSortFacetValuesBy(\"count\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_attributes_to_snippet": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAttributesToSnippet(\n []string{\"title\", \"content:80\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_highlight_pre_tag": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetHighlightPreTag(\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_highlight_post_tag": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetHighlightPostTag(\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_snippet_ellipsis_text": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetSnippetEllipsisText(\"\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_restrict_highlight_and_snippet_arrays": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRestrictHighlightAndSnippetArrays(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "access_page": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetPage(0))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_hits_per_page": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetHitsPerPage(10))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "get_nth_hit": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetOffset(4))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "get_n_results": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetLength(4))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_min_word_size_for_one_typo": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetMinWordSizefor1Typo(2))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_min_word_size_for_two_typos": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetMinWordSizefor2Typos(2))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_typo_tolerance_mode": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetTypoTolerance(search.BoolAsTypoTolerance(false)))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_typos_on_numeric_tokens_at_search_time": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAllowTyposOnNumericTokens(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_around_a_position": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundLatLng(\"40.71, -74.01\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_around_server_ip": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundLatLngViaIP(true))), search.WithHeaderParam(\"x-forwarded-for\", \"94.228.178.246 // should be replaced with the actual IP you would like to search around\"))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_around_radius": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundRadius(search.Int32AsAroundRadius(1000)))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_automatic_radius": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundRadius(search.AroundRadiusAllAsAroundRadius(search.AroundRadiusAll(\"all\"))))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_geo_search_precision": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundPrecision(search.Int32AsAroundPrecision(100)))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_geo_search_precision_non_linear": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAroundPrecision(search.ArrayOfModelRangeAsAroundPrecision(\n []search.ModelRange{*search.NewEmptyModelRange().SetFrom(0).SetValue(25), *search.NewEmptyModelRange().SetFrom(2000).SetValue(1000)})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_minimum_geo_search_radius": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetMinimumAroundRadius(1000))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_inside_rectangular_area": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox(\n [][]float64{\n []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625}})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_inside_multiple_rectangular_areas": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox(\n [][]float64{\n []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625},\n []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875}})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_inside_polygon_area": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetInsidePolygon(\n [][]float64{\n []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625}}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "search_inside_multiple_polygon_areas": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetInsidePolygon(\n [][]float64{\n []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625},\n []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625}}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_querylanguages_override": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords(\n []search.SupportedLanguage{search.SupportedLanguage(\"ca\"), search.SupportedLanguage(\"es\")})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_querylanguages_with_japanese_query": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetQueryLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"ja\"), search.SupportedLanguage(\"en\")}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_natural_languages": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"\").SetNaturalLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"fr\")}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_natural_languages_with_query": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"\").SetNaturalLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"fr\")}).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults(\"firstWords\")))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_decompound_query_search_time": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetDecompoundQuery(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_rules_search_time": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnableRules(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_rule_contexts": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRuleContexts(\n []string{\"front_end\", \"website2\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_personalization": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnablePersonalization(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_personalization_with_user_token": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnablePersonalization(true).SetUserToken(\"123456\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "personalization_impact": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetPersonalizationImpact(20))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_user_token": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetUserToken(\"123456\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_user_token_with_personalization": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnablePersonalization(true).SetUserToken(\"123456\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_query_type": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetQueryType(search.QueryType(\"prefixAll\")))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_remove_words_if_no_results": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults(\"lastWords\")))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_advanced_syntax_search_time": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAdvancedSyntax(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "overide_default_optional_words": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetOptionalWords(search.ArrayOfStringAsOptionalWords(\n []string{\"toyota\", \"2020 2021\"})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disabling_exact_for_some_attributes_search_time": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetDisableExactOnAttributes(\n []string{\"description\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_exact_single_word_query": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery(\"none\")))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_aternative_as_exact": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAlternativesAsExact(\n []search.AlternativesAsExact{search.AlternativesAsExact(\"multiWordsSynonym\")}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_advanced_syntax_exact_phrase": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures(\n []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures(\"exactPhrase\")}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_advanced_syntax_exclude_words": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures(\n []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures(\"excludeWords\")}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_distinct": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetDistinct(search.Int32AsDistinct(0)))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "get_ranking_info": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetGetRankingInfo(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_click_analytics": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetClickAnalytics(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_click_analytics": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetClickAnalytics(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_analytics": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAnalytics(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "add_analytics_tags": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetAnalyticsTags(\n []string{\"front_end\", \"website2\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_synonyms": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetSynonyms(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_replace_synonyms_in_highlights": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetReplaceSynonymsInHighlight(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_min_proximity": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetMinProximity(2))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_default_field": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetResponseFields(\n []string{\"hits\", \"facets\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "override_percentile_computation": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetPercentileComputation(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_ab_test": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnableABTest(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_enable_re_ranking": "response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(\n \"\").WithSearchParams(search.SearchParamsObjectAsSearchParams(\n search.NewEmptySearchParamsObject().SetQuery(\"query\").SetEnableReRanking(false))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "response, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest(\n \"\"))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", @@ -1160,6 +1547,9 @@ "distinct true": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "distinct section": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributeForDistinct(\"section\").SetDistinct(search.BoolAsDistinct(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "attributesForFaceting allergens": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"allergens\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "api_attributes_for_faceting": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"genre\", \"author\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "api_attributes_for_faceting_searchable": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"genre\", \"searchable(author)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "api_attributes_for_filter_only": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"filterOnly(genre)\", \"author\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "attributesForFaceting categoryPageId": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"searchable(categoryPageId)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "unretrievableAttributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetUnretrievableAttributes(\n []string{\"visible_by\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "attributesForFaceting user restricted data": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"filterOnly(visible_by)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", @@ -1183,6 +1573,7 @@ "customRanking and ranking sort alphabetically": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetCustomRanking(\n []string{\"asc(textual_attribute)\"}).SetRanking(\n []string{\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "relevancyStrictness": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetCustomRanking(\n []string{\"asc(textual_attribute)\"}).SetRelevancyStrictness(0)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "create replica index": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplicas(\n []string{\"products_price_desc\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "create replica index articles": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplicas(\n []string{\"articles_date_desc\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "create virtual replica index": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplicas(\n []string{\"virtual(products_price_desc)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "unlink replica index": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplicas(\n []string{\"\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "forwardToReplicas": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"name\", \"description\"})).WithForwardToReplicas(true))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", @@ -1192,15 +1583,77 @@ "ranking closest dates": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRanking(\n []string{\"asc(date_timestamp)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributes item variation": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"design\", \"type\", \"color\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributes around location": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"name\", \"country\", \"code\", \"iata_code\"}).SetCustomRanking(\n []string{\"desc(links_count)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", - "disableTypoToleranceOnAttributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes(\n []string{\"serial_number\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "attributesToHighlight": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToHighlight(\n []string{\"author\", \"title\", \"content\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "attributesToHighlightStar": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToHighlight(\n []string{\"*\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "everything": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures(\n []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures(\"exactPhrase\")}).SetAllowCompressionOfIntegerArray(true).SetAllowTyposOnNumericTokens(true).SetAlternativesAsExact(\n []search.AlternativesAsExact{search.AlternativesAsExact(\"singleWordSynonym\")}).SetAttributeCriteriaComputedByMinProximity(true).SetAttributeForDistinct(\"test\").SetAttributesForFaceting(\n []string{\"algolia\"}).SetAttributesToHighlight(\n []string{\"algolia\"}).SetAttributesToRetrieve(\n []string{\"algolia\"}).SetAttributesToSnippet(\n []string{\"algolia\"}).SetAttributesToTransliterate(\n []string{\"algolia\"}).SetCamelCaseAttributes(\n []string{\"algolia\"}).SetCustomNormalization(map[string]map[string]string{\"algolia\": map[string]string{\"aloglia\": \"aglolia\"}}).SetCustomRanking(\n []string{\"algolia\"}).SetDecompoundQuery(false).SetDecompoundedAttributes(map[string]any{\"algolia\": \"aloglia\"}).SetDisableExactOnAttributes(\n []string{\"algolia\"}).SetDisablePrefixOnAttributes(\n []string{\"algolia\"}).SetDisableTypoToleranceOnAttributes(\n []string{\"algolia\"}).SetDisableTypoToleranceOnWords(\n []string{\"algolia\"}).SetDistinct(search.Int32AsDistinct(3)).SetEnablePersonalization(true).SetEnableReRanking(false).SetEnableRules(true).SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery(\"attribute\")).SetHighlightPreTag(\"\").SetHighlightPostTag(\"\").SetHitsPerPage(10).SetIgnorePlurals(search.BoolAsIgnorePlurals(false)).SetIndexLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"fr\")}).SetKeepDiacriticsOnCharacters(\"abc\").SetMaxFacetHits(20).SetMaxValuesPerFacet(30).SetMinProximity(6).SetMinWordSizefor1Typo(5).SetMinWordSizefor2Typos(11).SetMode(search.Mode(\"neuralSearch\")).SetNumericAttributesForFiltering(\n []string{\"algolia\"}).SetOptionalWords(search.ArrayOfStringAsOptionalWords(\n []string{\"myspace\"})).SetPaginationLimitedTo(0).SetQueryLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"fr\")}).SetQueryType(search.QueryType(\"prefixLast\")).SetRanking(\n []string{\"geo\"}).SetReRankingApplyFilter(search.StringAsReRankingApplyFilter(\"mySearch:filters\")).SetRelevancyStrictness(10).SetRemoveStopWords(search.BoolAsRemoveStopWords(false)).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults(\"lastWords\")).SetRenderingContent(\n search.NewEmptyRenderingContent().SetFacetOrdering(\n search.NewEmptyFacetOrdering().SetFacets(\n search.NewEmptyFacets().SetOrder(\n []string{\"a\", \"b\"})).SetValues(map[string]search.Value{\"a\": *search.NewEmptyValue().SetOrder(\n []string{\"b\"}).SetSortRemainingBy(search.SortRemainingBy(\"count\"))}))).SetReplaceSynonymsInHighlight(true).SetReplicas(\n []string{\"\"}).SetResponseFields(\n []string{\"algolia\"}).SetRestrictHighlightAndSnippetArrays(true).SetSearchableAttributes(\n []string{\"foo\"}).SetSemanticSearch(\n search.NewEmptySemanticSearch().SetEventSources(\n []string{\"foo\"})).SetSeparatorsToIndex(\"bar\").SetSnippetEllipsisText(\"---\").SetSortFacetValuesBy(\"date\").SetTypoTolerance(search.BoolAsTypoTolerance(false)).SetUnretrievableAttributes(\n []string{\"foo\"}).SetUserData(map[string]any{\"user\": \"data\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"brand\", \"name\", \"categories\", \"unordered(description)\"}).SetCustomRanking(\n []string{\"desc(popularity)\"}).SetAttributesForFaceting(\n []string{\"searchable(brand)\", \"type\", \"categories\", \"price\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "searchableAttributesOrdering": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"unordered(title)\", \"cast\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributesProductReferenceSuffixes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"name\", \"product_reference\", \"product_reference_suffixes\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "queryLanguageAndIgnorePlurals": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetQueryLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"en\")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributesInMovies": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"title_eng\", \"title_fr\", \"title_es\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "disablePrefixOnAttributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes(\n []string{\"serial_number\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disableTypoToleranceOnAttributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes(\n []string{\"serial_number\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", "searchableAttributesSimpleExample": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"serial_number\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", - "searchableAttributesSimpleExampleAlt": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"serial_number\", \"serial_number_suffixes\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}" + "searchableAttributesSimpleExampleAlt": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSearchableAttributes(\n []string{\"serial_number\", \"serial_number_suffixes\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_searchable_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesForFaceting(\n []string{\"author\", \"filterOnly(isbn)\", \"searchable(edition)\", \"afterDistinct(category)\", \"afterDistinct(searchable(publisher))\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "unretrievable_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetUnretrievableAttributes(\n []string{\"total_number_of_sales\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_retrievable_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToRetrieve(\n []string{\"author\", \"title\", \"content\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_all_attributes_as_retrievable": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToRetrieve(\n []string{\"*\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "specify_attributes_not_to_retrieve": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToRetrieve(\n []string{\"*\", \"-SKU\", \"-internal_desc\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "neural_search": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMode(search.Mode(\"neuralSearch\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "keyword_search": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMode(search.Mode(\"keywordSearch\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_ranking": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRanking(\n []string{\"typo\", \"geo\", \"words\", \"filters\", \"attribute\", \"proximity\", \"exact\", \"custom\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_ranking_by_attribute_asc": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRanking(\n []string{\"asc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_ranking_by_attribute_desc": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRanking(\n []string{\"desc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "restrict_searchable_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetCustomRanking(\n []string{\"desc(popularity)\", \"asc(price)\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_relevancy": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRelevancyStrictness(90)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_replicas": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplicas(\n []string{\"name_of_replica_index1\", \"name_of_replica_index2\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_max_values_per_facet": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMaxValuesPerFacet(100)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_sort_facet_values_by": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSortFacetValuesBy(\"alpha\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_attributes_to_snippet": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToSnippet(\n []string{\"content:80\", \"description\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_all_attributes_to_snippet": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributesToSnippet(\n []string{\"*:80\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_highlight_pre_tag": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetHighlightPreTag(\"\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_highlight_post_tag": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetHighlightPostTag(\"\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_snippet_ellipsis_text": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSnippetEllipsisText(\"…\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_restrict_highlight_and_snippet_arrays_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRestrictHighlightAndSnippetArrays(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_hits_per_page": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetHitsPerPage(20)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_pagination_limit": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetPaginationLimitedTo(1000)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_min_word_size_for_one_typo": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMinWordSizefor1Typo(4)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_min_word_size_for_two_typos": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMinWordSizefor2Typos(4)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_typo_tolerance_mode": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_typos_on_numeric_tokens_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAllowTyposOnNumericTokens(false)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disable_typo_tolerance_for_words": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisableTypoToleranceOnWords(\n []string{\"wheel\", \"1X2BCD\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_separators_to_index": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetSeparatorsToIndex(\"+#\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_languages_using_querylanguages": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetQueryLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"es\")}).SetRemoveStopWords(search.BoolAsRemoveStopWords(true)).SetIgnorePlurals(search.BoolAsIgnorePlurals(true))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_attributes_to_transliterate": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetIndexLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"ja\")}).SetAttributesToTransliterate(\n []string{\"name\", \"description\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_camel_case_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetCamelCaseAttributes(\n []string{\"description\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_decompounded_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{\"de\": []string{\"name\"}})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_decompounded_multiple_attributes": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{\"de\": []string{\"name_de\", \"description_de\"}, \"fi\": []string{\"name_fi\", \"description_fi\"}})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_keep_diacritics_on_characters": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetKeepDiacriticsOnCharacters(\"øé\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_custom_normalization": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetCustomNormalization(map[string]map[string]string{\"default\": map[string]string{\"ä\": \"ae\"}})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_indexlanguages": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetIndexLanguages(\n []search.SupportedLanguage{search.SupportedLanguage(\"ja\")})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_decompound_query_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDecompoundQuery(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_rules_syntax_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetEnableRules(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_personalization_settings": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetEnablePersonalization(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_query_type": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetQueryType(search.QueryType(\"prefixLast\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_remove_words_if_no_result": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults(\"none\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_advanced_syntax_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAdvancedSyntax(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_optional_words": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetOptionalWords(search.ArrayOfStringAsOptionalWords(\n []string{\"blue\", \"iphone case\"}))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disabling_prefix_search_for_some_attributes_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes(\n []string{\"sku\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "disabling_exact_for_some_attributes_by_default": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDisableExactOnAttributes(\n []string{\"description\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_exact_single_word_query": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery(\"attribute\"))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_aternative_as_exact": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAlternativesAsExact(\n []search.AlternativesAsExact{search.AlternativesAsExact(\"ignorePlurals\"), search.AlternativesAsExact(\"singleWordSynonym\")})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_numeric_attributes_for_filtering": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetNumericAttributesForFiltering(\n []string{\"quantity\", \"popularity\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "enable_compression_of_integer_array": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAllowCompressionOfIntegerArray(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_attributes_for_distinct": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributeForDistinct(\"url\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_distinct": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1)).SetAttributeForDistinct(\"url\")))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_replace_synonyms_in_highlights": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetReplaceSynonymsInHighlight(false)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_min_proximity": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMinProximity(1)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_default_field": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetResponseFields(\n []string{\"hits\", \"hitsPerPage\", \"nbPages\", \"page\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_max_facet_hits": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetMaxFacetHits(10)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_attribute_criteria_computed_by_min_proximity": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetAttributeCriteriaComputedByMinProximity(true)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_user_data": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetUserData(map[string]any{\"extraData\": \"This is the custom data that you want to store in your index\"})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}", + "set_rendering_content": "response, err := client.SetSettings(client.NewApiSetSettingsRequest(\n \"\",\n search.NewEmptyIndexSettings().SetRenderingContent(\n search.NewEmptyRenderingContent().SetFacetOrdering(\n search.NewEmptyFacetOrdering().SetFacets(\n search.NewEmptyFacets().SetOrder(\n []string{\"size\", \"brand\"})).SetValues(map[string]search.Value{\"brand\": *search.NewEmptyValue().SetOrder(\n []string{\"uniqlo\"}).SetHide(\n []string{\"muji\"}).SetSortRemainingBy(search.SortRemainingBy(\"count\")), \"size\": *search.NewEmptyValue().SetOrder(\n []string{\"S\", \"M\", \"L\"}).SetSortRemainingBy(search.SortRemainingBy(\"hidden\"))})))))\nif err != nil {\n // handle the eventual error\n panic(err)\n}" }, "updateApiKey": { "default": "response, err := client.UpdateApiKey(client.NewApiUpdateApiKeyRequest(\n \"ALGOLIA_API_KEY\",\n search.NewEmptyApiKey().SetAcl(\n []search.Acl{search.Acl(\"search\"), search.Acl(\"addObject\")}).SetValidity(300).SetMaxQueriesPerIPPerHour(100).SetMaxHitsPerQuery(20)))\nif err != nil {\n // handle the eventual error\n panic(err)\n}" @@ -1515,6 +1968,10 @@ "filtersStephenKing": "client.searchSingleIndex(\"\", new SearchParamsObject().setFilters(\"author:\\\"Stephen King\\\"\"), Hit.class);", "filtersNotTags": "client.searchSingleIndex(\"\", new SearchParamsObject().setFilters(\"NOT _tags:non-fiction\"), Hit.class);", "facetFiltersList": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setFacetFilters(\n FacetFilters.of(\n Arrays.asList(\n FacetFilters.of(\"publisher:Penguin\"),\n FacetFilters.of(Arrays.asList(FacetFilters.of(\"author:Stephen King\"), FacetFilters.of(\"genre:Horror\")))\n )\n )\n ),\n Hit.class\n);", + "facetFiltersBook": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of(\"category:Book\")))),\n Hit.class\n);", + "facetFiltersAND": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"author:John Doe\")))),\n Hit.class\n);", + "facetFiltersOR": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setFacetFilters(\n FacetFilters.of(\n Arrays.asList(FacetFilters.of(Arrays.asList(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"author:John Doe\"))))\n )\n ),\n Hit.class\n);", + "facetFiltersCombined": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setFacetFilters(\n FacetFilters.of(\n Arrays.asList(\n FacetFilters.of(\"author:John Doe\"),\n FacetFilters.of(Arrays.asList(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"category:Movie\")))\n )\n )\n ),\n Hit.class\n);", "facetFiltersNeg": "client.searchSingleIndex(\"\", new SearchParamsObject().setFacetFilters(FacetFilters.of(\"category:-Ebook\")), Hit.class);", "filtersAndFacetFilters": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setFilters(\"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\")\n .setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of(\"publisher:Penguin\")))),\n Hit.class\n);", "facet author genre": "client.searchSingleIndex(\"\", new SearchParamsObject().setFacets(Arrays.asList(\"author\", \"genre\")), Hit.class);", @@ -1534,9 +1991,90 @@ "clickAnalyticsUserToken": "client.searchSingleIndex(\"\", new SearchParamsObject().setClickAnalytics(true).setUserToken(\"user-1\"), Hit.class);", "enablePersonalization": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setEnablePersonalization(true).setUserToken(\"user-1\"),\n Hit.class\n);", "userToken": "client.searchSingleIndex(\"\", new SearchParamsObject().setUserToken(\"user-1\"), Hit.class);", + "userToken1234": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setUserToken(\"user-1234\"), Hit.class);", "analyticsTag": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setAnalyticsTags(Arrays.asList(\"YOUR_ANALYTICS_TAG\")),\n Hit.class\n);", "facetFiltersUsers": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of(\"user:user42\"), FacetFilters.of(\"user:public\")))),\n Hit.class\n);", - "buildTheQuery": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setFilters(\"categoryPageId: Men's Clothing\")\n .setHitsPerPage(50)\n .setAnalyticsTags(Arrays.asList(\"mens-clothing\")),\n Hit.class\n);" + "buildTheQuery": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setFilters(\"categoryPageId: Men's Clothing\")\n .setHitsPerPage(50)\n .setAnalyticsTags(Arrays.asList(\"mens-clothing\")),\n Hit.class\n);", + "attributesToHighlightOverride": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAttributesToHighlight(Arrays.asList(\"title\", \"content\")),\n Hit.class\n);", + "disableTypoToleranceOnAttributes": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setDisableTypoToleranceOnAttributes(Arrays.asList(\"serial_number\")),\n Hit.class\n);", + "search_a_query": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"\")\n .setSimilarQuery(\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\")\n .setFilters(\"year:1991 TO 2001\"),\n Hit.class\n);", + "search_everything": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"\"), Hit.class);", + "api_filtering_range_example": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"books\").setFilters(\"price:10 TO 20\"), Hit.class);", + "override_retrievable_attributes": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAttributesToRetrieve(Arrays.asList(\"title\", \"content\")),\n Hit.class\n);", + "restrict_searchable_attributes": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setRestrictSearchableAttributes(Arrays.asList(\"title\", \"author\")),\n Hit.class\n);", + "override_default_relevancy": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setRelevancyStrictness(70), Hit.class);", + "apply_filters": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setSumOrFiltersScores(true), Hit.class);", + "apply_all_filters": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setFilters(\n \"available = 1 AND (category:Book OR NOT category:Ebook) AND _tags:published AND\" +\n \" publication_date:1441745506 TO 1441755506 AND inStock > 0 AND author:\\\"John\" +\n \" Doe\\\"\"\n ),\n Hit.class\n);", + "escape_spaces": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setFilters(\"category:\\\"Books and Comics\\\"\"),\n Hit.class\n);", + "escape_keywords": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setFilters(\"keyword:\\\"OR\\\"\"), Hit.class);", + "escape_single_quotes": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setFilters(\"content:\\\"It's a wonderful day\\\"\"),\n Hit.class\n);", + "escape_double_quotes": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setFilters(\"content:\\\"She said \\\"Hello World\\\"\"),\n Hit.class\n);", + "apply_negative_filters": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setOptionalFilters(OptionalFilters.of(Arrays.asList(OptionalFilters.of(\"category:Book\"), OptionalFilters.of(\"author:-John Doe\")))),\n Hit.class\n);", + "apply_numeric_filters": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setNumericFilters(\n NumericFilters.of(\n Arrays.asList(\n NumericFilters.of(\"price < 1000\"),\n NumericFilters.of(Arrays.asList(NumericFilters.of(\"inStock = 1\"), NumericFilters.of(\"deliveryDate < 1441755506\")))\n )\n )\n ),\n Hit.class\n);", + "apply_tag_filters": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setTagFilters(\n TagFilters.of(Arrays.asList(TagFilters.of(\"SciFi\"), TagFilters.of(Arrays.asList(TagFilters.of(\"Book\"), TagFilters.of(\"Movie\")))))\n ),\n Hit.class\n);", + "facets_all": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setFacets(Arrays.asList(\"*\")), Hit.class);", + "retrieve_only_some_facets": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setFacets(Arrays.asList(\"category\", \"author\")),\n Hit.class\n);", + "override_default_max_values_per_facet": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setMaxValuesPerFacet(20), Hit.class);", + "enable_faceting_after_distinct": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setFacetingAfterDistinct(true), Hit.class);", + "sort_facet_values_alphabetically": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setSortFacetValuesBy(\"count\"), Hit.class);", + "override_attributes_to_snippet": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAttributesToSnippet(Arrays.asList(\"title\", \"content:80\")),\n Hit.class\n);", + "override_default_highlight_pre_tag": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setHighlightPreTag(\"\"), Hit.class);", + "override_default_highlight_post_tag": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setHighlightPostTag(\"\"), Hit.class);", + "override_default_snippet_ellipsis_text": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setSnippetEllipsisText(\"\"), Hit.class);", + "enable_restrict_highlight_and_snippet_arrays": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setRestrictHighlightAndSnippetArrays(false),\n Hit.class\n);", + "access_page": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setPage(0), Hit.class);", + "override_default_hits_per_page": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setHitsPerPage(10), Hit.class);", + "get_nth_hit": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setOffset(4), Hit.class);", + "get_n_results": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setLength(4), Hit.class);", + "override_default_min_word_size_for_one_typo": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setMinWordSizefor1Typo(2), Hit.class);", + "override_default_min_word_size_for_two_typos": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setMinWordSizefor2Typos(2), Hit.class);", + "override_default_typo_tolerance_mode": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setTypoTolerance(TypoTolerance.of(false)),\n Hit.class\n);", + "disable_typos_on_numeric_tokens_at_search_time": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAllowTyposOnNumericTokens(false),\n Hit.class\n);", + "search_around_a_position": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setAroundLatLng(\"40.71, -74.01\"), Hit.class);", + "search_around_server_ip": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAroundLatLngViaIP(true),\n Hit.class,\n new RequestOptions()\n .addExtraHeader(\"x-forwarded-for\", \"94.228.178.246 // should be replaced with the actual IP you would like to search\" + \" around\")\n);", + "set_around_radius": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAroundRadius(AroundRadius.of(1000)),\n Hit.class\n);", + "disable_automatic_radius": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAroundRadius(AroundRadiusAll.ALL),\n Hit.class\n);", + "set_geo_search_precision": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAroundPrecision(AroundPrecision.of(100)),\n Hit.class\n);", + "set_geo_search_precision_non_linear": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setAroundPrecision(\n AroundPrecision.of(Arrays.asList(new Range().setFrom(0).setValue(25), new Range().setFrom(2000).setValue(1000)))\n ),\n Hit.class\n);", + "set_minimum_geo_search_radius": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setMinimumAroundRadius(1000), Hit.class);", + "search_inside_rectangular_area": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setInsideBoundingBox(\n InsideBoundingBox.of(Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625)))\n ),\n Hit.class\n);", + "search_inside_multiple_rectangular_areas": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setInsideBoundingBox(\n InsideBoundingBox.of(\n Arrays.asList(\n Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625),\n Arrays.asList(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875)\n )\n )\n ),\n Hit.class\n);", + "search_inside_polygon_area": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setInsidePolygon(\n Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625))\n ),\n Hit.class\n);", + "search_inside_multiple_polygon_areas": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setInsidePolygon(\n Arrays.asList(\n Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625),\n Arrays.asList(\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625\n )\n )\n ),\n Hit.class\n);", + "set_querylanguages_override": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))),\n Hit.class\n);", + "set_querylanguages_with_japanese_query": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setQueryLanguages(Arrays.asList(SupportedLanguage.JA, SupportedLanguage.EN)),\n Hit.class\n);", + "set_natural_languages": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"\").setNaturalLanguages(Arrays.asList(SupportedLanguage.FR)),\n Hit.class\n);", + "override_natural_languages_with_query": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"\")\n .setNaturalLanguages(Arrays.asList(SupportedLanguage.FR))\n .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.FIRST_WORDS),\n Hit.class\n);", + "enable_decompound_query_search_time": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setDecompoundQuery(true), Hit.class);", + "enable_rules_search_time": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setEnableRules(true), Hit.class);", + "set_rule_contexts": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setRuleContexts(Arrays.asList(\"front_end\", \"website2\")),\n Hit.class\n);", + "enable_personalization": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setEnablePersonalization(true), Hit.class);", + "enable_personalization_with_user_token": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setEnablePersonalization(true).setUserToken(\"123456\"),\n Hit.class\n);", + "personalization_impact": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setPersonalizationImpact(20), Hit.class);", + "set_user_token": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setUserToken(\"123456\"), Hit.class);", + "set_user_token_with_personalization": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setEnablePersonalization(true).setUserToken(\"123456\"),\n Hit.class\n);", + "override_default_query_type": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setQueryType(QueryType.PREFIX_ALL), Hit.class);", + "override_default_remove_words_if_no_results": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS),\n Hit.class\n);", + "enable_advanced_syntax_search_time": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setAdvancedSyntax(true), Hit.class);", + "overide_default_optional_words": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setOptionalWords(OptionalWords.of(Arrays.asList(\"toyota\", \"2020 2021\"))),\n Hit.class\n);", + "disabling_exact_for_some_attributes_search_time": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setDisableExactOnAttributes(Arrays.asList(\"description\")),\n Hit.class\n);", + "override_default_exact_single_word_query": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setExactOnSingleWordQuery(ExactOnSingleWordQuery.NONE),\n Hit.class\n);", + "override_default_aternative_as_exact": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAlternativesAsExact(Arrays.asList(AlternativesAsExact.MULTI_WORDS_SYNONYM)),\n Hit.class\n);", + "enable_advanced_syntax_exact_phrase": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setAdvancedSyntax(true)\n .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)),\n Hit.class\n);", + "enable_advanced_syntax_exclude_words": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject()\n .setQuery(\"query\")\n .setAdvancedSyntax(true)\n .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXCLUDE_WORDS)),\n Hit.class\n);", + "override_distinct": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setDistinct(Distinct.of(0)), Hit.class);", + "get_ranking_info": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setGetRankingInfo(true), Hit.class);", + "disable_click_analytics": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setClickAnalytics(false), Hit.class);", + "enable_click_analytics": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setClickAnalytics(true), Hit.class);", + "disable_analytics": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setAnalytics(false), Hit.class);", + "add_analytics_tags": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setAnalyticsTags(Arrays.asList(\"front_end\", \"website2\")),\n Hit.class\n);", + "disable_synonyms": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setSynonyms(false), Hit.class);", + "override_replace_synonyms_in_highlights": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setReplaceSynonymsInHighlight(true),\n Hit.class\n);", + "override_min_proximity": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setMinProximity(2), Hit.class);", + "override_default_field": "client.searchSingleIndex(\n \"\",\n new SearchParamsObject().setQuery(\"query\").setResponseFields(Arrays.asList(\"hits\", \"facets\")),\n Hit.class\n);", + "override_percentile_computation": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setPercentileComputation(false), Hit.class);", + "set_ab_test": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setEnableABTest(false), Hit.class);", + "set_enable_re_ranking": "client.searchSingleIndex(\"\", new SearchParamsObject().setQuery(\"query\").setEnableReRanking(false), Hit.class);" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "client.searchSynonyms(\"\");", @@ -1567,6 +2105,9 @@ "distinct true": "client.setSettings(\"\", new IndexSettings().setDistinct(Distinct.of(true)));", "distinct section": "client.setSettings(\"\", new IndexSettings().setAttributeForDistinct(\"section\").setDistinct(Distinct.of(true)));", "attributesForFaceting allergens": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"allergens\")));", + "api_attributes_for_faceting": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"genre\", \"author\")));", + "api_attributes_for_faceting_searchable": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"genre\", \"searchable(author)\")));", + "api_attributes_for_filter_only": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"filterOnly(genre)\", \"author\")));", "attributesForFaceting categoryPageId": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"searchable(categoryPageId)\")));", "unretrievableAttributes": "client.setSettings(\"\", new IndexSettings().setUnretrievableAttributes(Arrays.asList(\"visible_by\")));", "attributesForFaceting user restricted data": "client.setSettings(\"\", new IndexSettings().setAttributesForFaceting(Arrays.asList(\"filterOnly(visible_by)\")));", @@ -1590,6 +2131,7 @@ "customRanking and ranking sort alphabetically": "client.setSettings(\n \"\",\n new IndexSettings()\n .setCustomRanking(Arrays.asList(\"asc(textual_attribute)\"))\n .setRanking(Arrays.asList(\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"))\n);", "relevancyStrictness": "client.setSettings(\n \"\",\n new IndexSettings().setCustomRanking(Arrays.asList(\"asc(textual_attribute)\")).setRelevancyStrictness(0)\n);", "create replica index": "client.setSettings(\"\", new IndexSettings().setReplicas(Arrays.asList(\"products_price_desc\")));", + "create replica index articles": "client.setSettings(\"\", new IndexSettings().setReplicas(Arrays.asList(\"articles_date_desc\")));", "create virtual replica index": "client.setSettings(\"\", new IndexSettings().setReplicas(Arrays.asList(\"virtual(products_price_desc)\")));", "unlink replica index": "client.setSettings(\"\", new IndexSettings().setReplicas(Arrays.asList(\"\")));", "forwardToReplicas": "client.setSettings(\"\", new IndexSettings().setSearchableAttributes(Arrays.asList(\"name\", \"description\")), true);", @@ -1599,15 +2141,77 @@ "ranking closest dates": "client.setSettings(\n \"\",\n new IndexSettings()\n .setRanking(Arrays.asList(\"asc(date_timestamp)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"))\n);", "searchableAttributes item variation": "client.setSettings(\"\", new IndexSettings().setSearchableAttributes(Arrays.asList(\"design\", \"type\", \"color\")));", "searchableAttributes around location": "client.setSettings(\n \"\",\n new IndexSettings()\n .setSearchableAttributes(Arrays.asList(\"name\", \"country\", \"code\", \"iata_code\"))\n .setCustomRanking(Arrays.asList(\"desc(links_count)\"))\n);", - "disableTypoToleranceOnAttributes": "client.setSettings(\"\", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList(\"serial_number\")));", + "attributesToHighlight": "client.setSettings(\"\", new IndexSettings().setAttributesToHighlight(Arrays.asList(\"author\", \"title\", \"content\")));", + "attributesToHighlightStar": "client.setSettings(\"\", new IndexSettings().setAttributesToHighlight(Arrays.asList(\"*\")));", "everything": "client.setSettings(\n \"\",\n new IndexSettings()\n .setAdvancedSyntax(true)\n .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE))\n .setAllowCompressionOfIntegerArray(true)\n .setAllowTyposOnNumericTokens(true)\n .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.SINGLE_WORD_SYNONYM))\n .setAttributeCriteriaComputedByMinProximity(true)\n .setAttributeForDistinct(\"test\")\n .setAttributesForFaceting(Arrays.asList(\"algolia\"))\n .setAttributesToHighlight(Arrays.asList(\"algolia\"))\n .setAttributesToRetrieve(Arrays.asList(\"algolia\"))\n .setAttributesToSnippet(Arrays.asList(\"algolia\"))\n .setAttributesToTransliterate(Arrays.asList(\"algolia\"))\n .setCamelCaseAttributes(Arrays.asList(\"algolia\"))\n .setCustomNormalization(\n new HashMap() {\n {\n put(\n \"algolia\",\n new HashMap() {\n {\n put(\"aloglia\", \"aglolia\");\n }\n }\n );\n }\n }\n )\n .setCustomRanking(Arrays.asList(\"algolia\"))\n .setDecompoundQuery(false)\n .setDecompoundedAttributes(\n new HashMap() {\n {\n put(\"algolia\", \"aloglia\");\n }\n }\n )\n .setDisableExactOnAttributes(Arrays.asList(\"algolia\"))\n .setDisablePrefixOnAttributes(Arrays.asList(\"algolia\"))\n .setDisableTypoToleranceOnAttributes(Arrays.asList(\"algolia\"))\n .setDisableTypoToleranceOnWords(Arrays.asList(\"algolia\"))\n .setDistinct(Distinct.of(3))\n .setEnablePersonalization(true)\n .setEnableReRanking(false)\n .setEnableRules(true)\n .setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE)\n .setHighlightPreTag(\"\")\n .setHighlightPostTag(\"\")\n .setHitsPerPage(10)\n .setIgnorePlurals(IgnorePlurals.of(false))\n .setIndexLanguages(Arrays.asList(SupportedLanguage.FR))\n .setKeepDiacriticsOnCharacters(\"abc\")\n .setMaxFacetHits(20)\n .setMaxValuesPerFacet(30)\n .setMinProximity(6)\n .setMinWordSizefor1Typo(5)\n .setMinWordSizefor2Typos(11)\n .setMode(Mode.NEURAL_SEARCH)\n .setNumericAttributesForFiltering(Arrays.asList(\"algolia\"))\n .setOptionalWords(OptionalWords.of(Arrays.asList(\"myspace\")))\n .setPaginationLimitedTo(0)\n .setQueryLanguages(Arrays.asList(SupportedLanguage.FR))\n .setQueryType(QueryType.PREFIX_LAST)\n .setRanking(Arrays.asList(\"geo\"))\n .setReRankingApplyFilter(ReRankingApplyFilter.of(\"mySearch:filters\"))\n .setRelevancyStrictness(10)\n .setRemoveStopWords(RemoveStopWords.of(false))\n .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS)\n .setRenderingContent(\n new RenderingContent()\n .setFacetOrdering(\n new FacetOrdering()\n .setFacets(new Facets().setOrder(Arrays.asList(\"a\", \"b\")))\n .setValues(\n new HashMap() {\n {\n put(\"a\", new Value().setOrder(Arrays.asList(\"b\")).setSortRemainingBy(SortRemainingBy.COUNT));\n }\n }\n )\n )\n )\n .setReplaceSynonymsInHighlight(true)\n .setReplicas(Arrays.asList(\"\"))\n .setResponseFields(Arrays.asList(\"algolia\"))\n .setRestrictHighlightAndSnippetArrays(true)\n .setSearchableAttributes(Arrays.asList(\"foo\"))\n .setSemanticSearch(new SemanticSearch().setEventSources(Arrays.asList(\"foo\")))\n .setSeparatorsToIndex(\"bar\")\n .setSnippetEllipsisText(\"---\")\n .setSortFacetValuesBy(\"date\")\n .setTypoTolerance(TypoTolerance.of(false))\n .setUnretrievableAttributes(Arrays.asList(\"foo\"))\n .setUserData(\n new HashMap() {\n {\n put(\"user\", \"data\");\n }\n }\n )\n);", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "client.setSettings(\n \"\",\n new IndexSettings()\n .setSearchableAttributes(Arrays.asList(\"brand\", \"name\", \"categories\", \"unordered(description)\"))\n .setCustomRanking(Arrays.asList(\"desc(popularity)\"))\n .setAttributesForFaceting(Arrays.asList(\"searchable(brand)\", \"type\", \"categories\", \"price\"))\n);", + "searchableAttributesOrdering": "client.setSettings(\"\", new IndexSettings().setSearchableAttributes(Arrays.asList(\"unordered(title)\", \"cast\")));", "searchableAttributesProductReferenceSuffixes": "client.setSettings(\n \"\",\n new IndexSettings().setSearchableAttributes(Arrays.asList(\"name\", \"product_reference\", \"product_reference_suffixes\"))\n);", "queryLanguageAndIgnorePlurals": "client.setSettings(\n \"\",\n new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.EN)).setIgnorePlurals(IgnorePlurals.of(true))\n);", "searchableAttributesInMovies": "client.setSettings(\n \"\",\n new IndexSettings().setSearchableAttributes(Arrays.asList(\"title_eng\", \"title_fr\", \"title_es\"))\n);", "disablePrefixOnAttributes": "client.setSettings(\"\", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList(\"serial_number\")));", + "disableTypoToleranceOnAttributes": "client.setSettings(\"\", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList(\"serial_number\")));", "searchableAttributesSimpleExample": "client.setSettings(\"\", new IndexSettings().setSearchableAttributes(Arrays.asList(\"serial_number\")));", - "searchableAttributesSimpleExampleAlt": "client.setSettings(\n \"\",\n new IndexSettings().setSearchableAttributes(Arrays.asList(\"serial_number\", \"serial_number_suffixes\"))\n);" + "searchableAttributesSimpleExampleAlt": "client.setSettings(\n \"\",\n new IndexSettings().setSearchableAttributes(Arrays.asList(\"serial_number\", \"serial_number_suffixes\"))\n);", + "set_searchable_attributes": "client.setSettings(\n \"\",\n new IndexSettings()\n .setAttributesForFaceting(\n Arrays.asList(\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\"\n )\n )\n);", + "unretrievable_attributes": "client.setSettings(\"\", new IndexSettings().setUnretrievableAttributes(Arrays.asList(\"total_number_of_sales\")));", + "set_retrievable_attributes": "client.setSettings(\"\", new IndexSettings().setAttributesToRetrieve(Arrays.asList(\"author\", \"title\", \"content\")));", + "set_all_attributes_as_retrievable": "client.setSettings(\"\", new IndexSettings().setAttributesToRetrieve(Arrays.asList(\"*\")));", + "specify_attributes_not_to_retrieve": "client.setSettings(\"\", new IndexSettings().setAttributesToRetrieve(Arrays.asList(\"*\", \"-SKU\", \"-internal_desc\")));", + "neural_search": "client.setSettings(\"\", new IndexSettings().setMode(Mode.NEURAL_SEARCH));", + "keyword_search": "client.setSettings(\"\", new IndexSettings().setMode(Mode.KEYWORD_SEARCH));", + "set_default_ranking": "client.setSettings(\n \"\",\n new IndexSettings().setRanking(Arrays.asList(\"typo\", \"geo\", \"words\", \"filters\", \"attribute\", \"proximity\", \"exact\", \"custom\"))\n);", + "set_ranking_by_attribute_asc": "client.setSettings(\n \"\",\n new IndexSettings()\n .setRanking(Arrays.asList(\"asc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"))\n);", + "set_ranking_by_attribute_desc": "client.setSettings(\n \"\",\n new IndexSettings()\n .setRanking(Arrays.asList(\"desc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"))\n);", + "restrict_searchable_attributes": "client.setSettings(\"\", new IndexSettings().setCustomRanking(Arrays.asList(\"desc(popularity)\", \"asc(price)\")));", + "set_default_relevancy": "client.setSettings(\"\", new IndexSettings().setRelevancyStrictness(90));", + "set_replicas": "client.setSettings(\n \"\",\n new IndexSettings().setReplicas(Arrays.asList(\"name_of_replica_index1\", \"name_of_replica_index2\"))\n);", + "set_default_max_values_per_facet": "client.setSettings(\"\", new IndexSettings().setMaxValuesPerFacet(100));", + "set_default_sort_facet_values_by": "client.setSettings(\"\", new IndexSettings().setSortFacetValuesBy(\"alpha\"));", + "set_attributes_to_snippet": "client.setSettings(\"\", new IndexSettings().setAttributesToSnippet(Arrays.asList(\"content:80\", \"description\")));", + "set_all_attributes_to_snippet": "client.setSettings(\"\", new IndexSettings().setAttributesToSnippet(Arrays.asList(\"*:80\")));", + "set_default_highlight_pre_tag": "client.setSettings(\"\", new IndexSettings().setHighlightPreTag(\"\"));", + "set_default_highlight_post_tag": "client.setSettings(\"\", new IndexSettings().setHighlightPostTag(\"\"));", + "set_default_snippet_ellipsis_text": "client.setSettings(\"\", new IndexSettings().setSnippetEllipsisText(\"…\"));", + "enable_restrict_highlight_and_snippet_arrays_by_default": "client.setSettings(\"\", new IndexSettings().setRestrictHighlightAndSnippetArrays(true));", + "set_default_hits_per_page": "client.setSettings(\"\", new IndexSettings().setHitsPerPage(20));", + "set_pagination_limit": "client.setSettings(\"\", new IndexSettings().setPaginationLimitedTo(1000));", + "set_default_min_word_size_for_one_typo": "client.setSettings(\"\", new IndexSettings().setMinWordSizefor1Typo(4));", + "set_default_min_word_size_for_two_typos": "client.setSettings(\"\", new IndexSettings().setMinWordSizefor2Typos(4));", + "set_default_typo_tolerance_mode": "client.setSettings(\"\", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)));", + "disable_typos_on_numeric_tokens_by_default": "client.setSettings(\"\", new IndexSettings().setAllowTyposOnNumericTokens(false));", + "disable_typo_tolerance_for_words": "client.setSettings(\"\", new IndexSettings().setDisableTypoToleranceOnWords(Arrays.asList(\"wheel\", \"1X2BCD\")));", + "set_separators_to_index": "client.setSettings(\"\", new IndexSettings().setSeparatorsToIndex(\"+#\"));", + "set_languages_using_querylanguages": "client.setSettings(\n \"\",\n new IndexSettings()\n .setQueryLanguages(Arrays.asList(SupportedLanguage.ES))\n .setRemoveStopWords(RemoveStopWords.of(true))\n .setIgnorePlurals(IgnorePlurals.of(true))\n);", + "set_attributes_to_transliterate": "client.setSettings(\n \"\",\n new IndexSettings()\n .setIndexLanguages(Arrays.asList(SupportedLanguage.JA))\n .setAttributesToTransliterate(Arrays.asList(\"name\", \"description\"))\n);", + "set_camel_case_attributes": "client.setSettings(\"\", new IndexSettings().setCamelCaseAttributes(Arrays.asList(\"description\")));", + "set_decompounded_attributes": "client.setSettings(\n \"\",\n new IndexSettings()\n .setDecompoundedAttributes(\n new HashMap() {\n {\n put(\"de\", Arrays.asList(\"name\"));\n }\n }\n )\n);", + "set_decompounded_multiple_attributes": "client.setSettings(\n \"\",\n new IndexSettings()\n .setDecompoundedAttributes(\n new HashMap() {\n {\n put(\"de\", Arrays.asList(\"name_de\", \"description_de\"));\n put(\"fi\", Arrays.asList(\"name_fi\", \"description_fi\"));\n }\n }\n )\n);", + "set_keep_diacritics_on_characters": "client.setSettings(\"\", new IndexSettings().setKeepDiacriticsOnCharacters(\"øé\"));", + "set_custom_normalization": "client.setSettings(\n \"\",\n new IndexSettings()\n .setCustomNormalization(\n new HashMap() {\n {\n put(\n \"default\",\n new HashMap() {\n {\n put(\"ä\", \"ae\");\n }\n }\n );\n }\n }\n )\n);", + "set_indexlanguages": "client.setSettings(\"\", new IndexSettings().setIndexLanguages(Arrays.asList(SupportedLanguage.JA)));", + "enable_decompound_query_by_default": "client.setSettings(\"\", new IndexSettings().setDecompoundQuery(true));", + "enable_rules_syntax_by_default": "client.setSettings(\"\", new IndexSettings().setEnableRules(true));", + "enable_personalization_settings": "client.setSettings(\"\", new IndexSettings().setEnablePersonalization(true));", + "set_default_query_type": "client.setSettings(\"\", new IndexSettings().setQueryType(QueryType.PREFIX_LAST));", + "set_default_remove_words_if_no_result": "client.setSettings(\"\", new IndexSettings().setRemoveWordsIfNoResults(RemoveWordsIfNoResults.NONE));", + "enable_advanced_syntax_by_default": "client.setSettings(\"\", new IndexSettings().setAdvancedSyntax(true));", + "set_default_optional_words": "client.setSettings(\"\", new IndexSettings().setOptionalWords(OptionalWords.of(Arrays.asList(\"blue\", \"iphone case\"))));", + "disabling_prefix_search_for_some_attributes_by_default": "client.setSettings(\"\", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList(\"sku\")));", + "disabling_exact_for_some_attributes_by_default": "client.setSettings(\"\", new IndexSettings().setDisableExactOnAttributes(Arrays.asList(\"description\")));", + "set_default_exact_single_word_query": "client.setSettings(\"\", new IndexSettings().setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE));", + "set_default_aternative_as_exact": "client.setSettings(\n \"\",\n new IndexSettings().setAlternativesAsExact(Arrays.asList(AlternativesAsExact.IGNORE_PLURALS, AlternativesAsExact.SINGLE_WORD_SYNONYM))\n);", + "set_numeric_attributes_for_filtering": "client.setSettings(\"\", new IndexSettings().setNumericAttributesForFiltering(Arrays.asList(\"quantity\", \"popularity\")));", + "enable_compression_of_integer_array": "client.setSettings(\"\", new IndexSettings().setAllowCompressionOfIntegerArray(true));", + "set_attributes_for_distinct": "client.setSettings(\"\", new IndexSettings().setAttributeForDistinct(\"url\"));", + "set_distinct": "client.setSettings(\"\", new IndexSettings().setDistinct(Distinct.of(1)).setAttributeForDistinct(\"url\"));", + "set_replace_synonyms_in_highlights": "client.setSettings(\"\", new IndexSettings().setReplaceSynonymsInHighlight(false));", + "set_min_proximity": "client.setSettings(\"\", new IndexSettings().setMinProximity(1));", + "set_default_field": "client.setSettings(\"\", new IndexSettings().setResponseFields(Arrays.asList(\"hits\", \"hitsPerPage\", \"nbPages\", \"page\")));", + "set_max_facet_hits": "client.setSettings(\"\", new IndexSettings().setMaxFacetHits(10));", + "set_attribute_criteria_computed_by_min_proximity": "client.setSettings(\"\", new IndexSettings().setAttributeCriteriaComputedByMinProximity(true));", + "set_user_data": "client.setSettings(\n \"\",\n new IndexSettings()\n .setUserData(\n new HashMap() {\n {\n put(\"extraData\", \"This is the custom data that you want to store in your index\");\n }\n }\n )\n);", + "set_rendering_content": "client.setSettings(\n \"\",\n new IndexSettings()\n .setRenderingContent(\n new RenderingContent()\n .setFacetOrdering(\n new FacetOrdering()\n .setFacets(new Facets().setOrder(Arrays.asList(\"size\", \"brand\")))\n .setValues(\n new HashMap() {\n {\n put(\n \"brand\",\n new Value()\n .setOrder(Arrays.asList(\"uniqlo\"))\n .setHide(Arrays.asList(\"muji\"))\n .setSortRemainingBy(SortRemainingBy.COUNT)\n );\n put(\"size\", new Value().setOrder(Arrays.asList(\"S\", \"M\", \"L\")).setSortRemainingBy(SortRemainingBy.HIDDEN));\n }\n }\n )\n )\n )\n);" }, "updateApiKey": { "default": "client.updateApiKey(\n \"ALGOLIA_API_KEY\",\n new ApiKey().setAcl(Arrays.asList(Acl.SEARCH, Acl.ADD_OBJECT)).setValidity(300).setMaxQueriesPerIPPerHour(100).setMaxHitsPerQuery(20)\n);" @@ -1922,6 +2526,10 @@ "filtersStephenKing": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { filters: 'author:\"Stephen King\"' },\n});", "filtersNotTags": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { filters: 'NOT _tags:non-fiction' },\n});", "facetFiltersList": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { facetFilters: ['publisher:Penguin', ['author:Stephen King', 'genre:Horror']] },\n});", + "facetFiltersBook": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facetFilters: ['category:Book'] },\n});", + "facetFiltersAND": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facetFilters: ['category:Book', 'author:John Doe'] },\n});", + "facetFiltersOR": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facetFilters: [['category:Book', 'author:John Doe']] },\n});", + "facetFiltersCombined": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facetFilters: ['author:John Doe', ['category:Book', 'category:Movie']] },\n});", "facetFiltersNeg": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { facetFilters: 'category:-Ebook' },\n});", "filtersAndFacetFilters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { filters: '(author:\"Stephen King\" OR genre:\"Horror\")', facetFilters: ['publisher:Penguin'] },\n});", "facet author genre": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { facets: ['author', 'genre'] },\n});", @@ -1941,9 +2549,90 @@ "clickAnalyticsUserToken": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { clickAnalytics: true, userToken: 'user-1' },\n});", "enablePersonalization": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { enablePersonalization: true, userToken: 'user-1' },\n});", "userToken": "const response = await client.searchSingleIndex({ indexName: 'indexName', searchParams: { userToken: 'user-1' } });", + "userToken1234": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', userToken: 'user-1234' },\n});", "analyticsTag": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { analyticsTags: ['YOUR_ANALYTICS_TAG'] },\n});", "facetFiltersUsers": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { facetFilters: ['user:user42', 'user:public'] },\n});", - "buildTheQuery": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { filters: \"categoryPageId: Men's Clothing\", hitsPerPage: 50, analyticsTags: ['mens-clothing'] },\n});" + "buildTheQuery": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { filters: \"categoryPageId: Men's Clothing\", hitsPerPage: 50, analyticsTags: ['mens-clothing'] },\n});", + "attributesToHighlightOverride": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', attributesToHighlight: ['title', 'content'] },\n});", + "disableTypoToleranceOnAttributes": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', disableTypoToleranceOnAttributes: ['serial_number'] },\n});", + "search_a_query": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: '',\n similarQuery: 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen',\n filters: 'year:1991 TO 2001',\n },\n});", + "search_everything": "const response = await client.searchSingleIndex({ indexName: 'indexName', searchParams: { query: '' } });", + "api_filtering_range_example": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'books', filters: 'price:10 TO 20' },\n});", + "override_retrievable_attributes": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', attributesToRetrieve: ['title', 'content'] },\n});", + "restrict_searchable_attributes": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', restrictSearchableAttributes: ['title', 'author'] },\n});", + "override_default_relevancy": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', relevancyStrictness: 70 },\n});", + "apply_filters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', sumOrFiltersScores: true },\n});", + "apply_all_filters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n filters:\n '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\"',\n },\n});", + "escape_spaces": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', filters: 'category:\"Books and Comics\"' },\n});", + "escape_keywords": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', filters: 'keyword:\"OR\"' },\n});", + "escape_single_quotes": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', filters: 'content:\"It\\'s a wonderful day\"' },\n});", + "escape_double_quotes": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', filters: 'content:\"She said \"Hello World\"' },\n});", + "apply_negative_filters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', optionalFilters: ['category:Book', 'author:-John Doe'] },\n});", + "apply_numeric_filters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', numericFilters: ['price < 1000', ['inStock = 1', 'deliveryDate < 1441755506']] },\n});", + "apply_tag_filters": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', tagFilters: ['SciFi', ['Book', 'Movie']] },\n});", + "facets_all": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facets: ['*'] },\n});", + "retrieve_only_some_facets": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facets: ['category', 'author'] },\n});", + "override_default_max_values_per_facet": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', maxValuesPerFacet: 20 },\n});", + "enable_faceting_after_distinct": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', facetingAfterDistinct: true },\n});", + "sort_facet_values_alphabetically": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', sortFacetValuesBy: 'count' },\n});", + "override_attributes_to_snippet": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', attributesToSnippet: ['title', 'content:80'] },\n});", + "override_default_highlight_pre_tag": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', highlightPreTag: '' },\n});", + "override_default_highlight_post_tag": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', highlightPostTag: '' },\n});", + "override_default_snippet_ellipsis_text": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', snippetEllipsisText: '' },\n});", + "enable_restrict_highlight_and_snippet_arrays": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', restrictHighlightAndSnippetArrays: false },\n});", + "access_page": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', page: 0 },\n});", + "override_default_hits_per_page": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', hitsPerPage: 10 },\n});", + "get_nth_hit": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', offset: 4 },\n});", + "get_n_results": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', length: 4 },\n});", + "override_default_min_word_size_for_one_typo": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', minWordSizefor1Typo: 2 },\n});", + "override_default_min_word_size_for_two_typos": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', minWordSizefor2Typos: 2 },\n});", + "override_default_typo_tolerance_mode": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', typoTolerance: false },\n});", + "disable_typos_on_numeric_tokens_at_search_time": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', allowTyposOnNumericTokens: false },\n});", + "search_around_a_position": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', aroundLatLng: '40.71, -74.01' },\n});", + "search_around_server_ip": "const response = await client.searchSingleIndex(\n { indexName: 'indexName', searchParams: { query: 'query', aroundLatLngViaIP: true } },\n {\n headers: {\n 'x-forwarded-for': '94.228.178.246 // should be replaced with the actual IP you would like to search around',\n },\n },\n);", + "set_around_radius": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', aroundRadius: 1000 },\n});", + "disable_automatic_radius": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', aroundRadius: 'all' },\n});", + "set_geo_search_precision": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', aroundPrecision: 100 },\n});", + "set_geo_search_precision_non_linear": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n aroundPrecision: [\n { from: 0, value: 25 },\n { from: 2000, value: 1000 },\n ],\n },\n});", + "set_minimum_geo_search_radius": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', minimumAroundRadius: 1000 },\n});", + "search_inside_rectangular_area": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n insideBoundingBox: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]],\n },\n});", + "search_inside_multiple_rectangular_areas": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n insideBoundingBox: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625],\n [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875],\n ],\n },\n});", + "search_inside_polygon_area": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n insidePolygon: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625],\n ],\n },\n});", + "search_inside_multiple_polygon_areas": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: {\n query: 'query',\n insidePolygon: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625],\n [\n 49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625,\n 50.62626704081, 4.6181640625,\n ],\n ],\n },\n});", + "set_querylanguages_override": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', removeStopWords: ['ca', 'es'] },\n});", + "set_querylanguages_with_japanese_query": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', queryLanguages: ['ja', 'en'] },\n});", + "set_natural_languages": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: '', naturalLanguages: ['fr'] },\n});", + "override_natural_languages_with_query": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: '', naturalLanguages: ['fr'], removeWordsIfNoResults: 'firstWords' },\n});", + "enable_decompound_query_search_time": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', decompoundQuery: true },\n});", + "enable_rules_search_time": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enableRules: true },\n});", + "set_rule_contexts": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', ruleContexts: ['front_end', 'website2'] },\n});", + "enable_personalization": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enablePersonalization: true },\n});", + "enable_personalization_with_user_token": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' },\n});", + "personalization_impact": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', personalizationImpact: 20 },\n});", + "set_user_token": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', userToken: '123456' },\n});", + "set_user_token_with_personalization": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' },\n});", + "override_default_query_type": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', queryType: 'prefixAll' },\n});", + "override_default_remove_words_if_no_results": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', removeWordsIfNoResults: 'lastWords' },\n});", + "enable_advanced_syntax_search_time": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', advancedSyntax: true },\n});", + "overide_default_optional_words": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', optionalWords: ['toyota', '2020 2021'] },\n});", + "disabling_exact_for_some_attributes_search_time": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', disableExactOnAttributes: ['description'] },\n});", + "override_default_exact_single_word_query": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', exactOnSingleWordQuery: 'none' },\n});", + "override_default_aternative_as_exact": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', alternativesAsExact: ['multiWordsSynonym'] },\n});", + "enable_advanced_syntax_exact_phrase": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['exactPhrase'] },\n});", + "enable_advanced_syntax_exclude_words": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['excludeWords'] },\n});", + "override_distinct": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', distinct: 0 },\n});", + "get_ranking_info": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', getRankingInfo: true },\n});", + "disable_click_analytics": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', clickAnalytics: false },\n});", + "enable_click_analytics": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', clickAnalytics: true },\n});", + "disable_analytics": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', analytics: false },\n});", + "add_analytics_tags": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', analyticsTags: ['front_end', 'website2'] },\n});", + "disable_synonyms": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', synonyms: false },\n});", + "override_replace_synonyms_in_highlights": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', replaceSynonymsInHighlight: true },\n});", + "override_min_proximity": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', minProximity: 2 },\n});", + "override_default_field": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', responseFields: ['hits', 'facets'] },\n});", + "override_percentile_computation": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', percentileComputation: false },\n});", + "set_ab_test": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enableABTest: false },\n});", + "set_enable_re_ranking": "const response = await client.searchSingleIndex({\n indexName: 'indexName',\n searchParams: { query: 'query', enableReRanking: false },\n});" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "const response = await client.searchSynonyms({ indexName: 'indexName' });", @@ -1974,6 +2663,9 @@ "distinct true": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { distinct: true } });", "distinct section": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributeForDistinct: 'section', distinct: true },\n});", "attributesForFaceting allergens": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['allergens'] },\n});", + "api_attributes_for_faceting": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['genre', 'author'] },\n});", + "api_attributes_for_faceting_searchable": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['genre', 'searchable(author)'] },\n});", + "api_attributes_for_filter_only": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['filterOnly(genre)', 'author'] },\n});", "attributesForFaceting categoryPageId": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['searchable(categoryPageId)'] },\n});", "unretrievableAttributes": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { unretrievableAttributes: ['visible_by'] },\n});", "attributesForFaceting user restricted data": "const response = await client.setSettings({\n indexName: '',\n indexSettings: { attributesForFaceting: ['filterOnly(visible_by)'] },\n});", @@ -1997,6 +2689,7 @@ "customRanking and ranking sort alphabetically": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n customRanking: ['asc(textual_attribute)'],\n ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'],\n },\n});", "relevancyStrictness": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 },\n});", "create replica index": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { replicas: ['products_price_desc'] },\n});", + "create replica index articles": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { replicas: ['articles_date_desc'] },\n});", "create virtual replica index": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { replicas: ['virtual(products_price_desc)'] },\n});", "unlink replica index": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { replicas: [''] } });", "forwardToReplicas": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['name', 'description'] },\n forwardToReplicas: true,\n});", @@ -2006,15 +2699,77 @@ "ranking closest dates": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n ranking: ['asc(date_timestamp)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'],\n },\n});", "searchableAttributes item variation": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['design', 'type', 'color'] },\n});", "searchableAttributes around location": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n searchableAttributes: ['name', 'country', 'code', 'iata_code'],\n customRanking: ['desc(links_count)'],\n },\n});", - "disableTypoToleranceOnAttributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] },\n});", + "attributesToHighlight": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToHighlight: ['author', 'title', 'content'] },\n});", + "attributesToHighlightStar": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToHighlight: ['*'] },\n});", "everything": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n advancedSyntax: true,\n advancedSyntaxFeatures: ['exactPhrase'],\n allowCompressionOfIntegerArray: true,\n allowTyposOnNumericTokens: true,\n alternativesAsExact: ['singleWordSynonym'],\n attributeCriteriaComputedByMinProximity: true,\n attributeForDistinct: 'test',\n attributesForFaceting: ['algolia'],\n attributesToHighlight: ['algolia'],\n attributesToRetrieve: ['algolia'],\n attributesToSnippet: ['algolia'],\n attributesToTransliterate: ['algolia'],\n camelCaseAttributes: ['algolia'],\n customNormalization: { algolia: { aloglia: 'aglolia' } },\n customRanking: ['algolia'],\n decompoundQuery: false,\n decompoundedAttributes: { algolia: 'aloglia' },\n disableExactOnAttributes: ['algolia'],\n disablePrefixOnAttributes: ['algolia'],\n disableTypoToleranceOnAttributes: ['algolia'],\n disableTypoToleranceOnWords: ['algolia'],\n distinct: 3,\n enablePersonalization: true,\n enableReRanking: false,\n enableRules: true,\n exactOnSingleWordQuery: 'attribute',\n highlightPreTag: '',\n highlightPostTag: '',\n hitsPerPage: 10,\n ignorePlurals: false,\n indexLanguages: ['fr'],\n keepDiacriticsOnCharacters: 'abc',\n maxFacetHits: 20,\n maxValuesPerFacet: 30,\n minProximity: 6,\n minWordSizefor1Typo: 5,\n minWordSizefor2Typos: 11,\n mode: 'neuralSearch',\n numericAttributesForFiltering: ['algolia'],\n optionalWords: ['myspace'],\n paginationLimitedTo: 0,\n queryLanguages: ['fr'],\n queryType: 'prefixLast',\n ranking: ['geo'],\n reRankingApplyFilter: 'mySearch:filters',\n relevancyStrictness: 10,\n removeStopWords: false,\n removeWordsIfNoResults: 'lastWords',\n renderingContent: {\n facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } },\n },\n replaceSynonymsInHighlight: true,\n replicas: [''],\n responseFields: ['algolia'],\n restrictHighlightAndSnippetArrays: true,\n searchableAttributes: ['foo'],\n semanticSearch: { eventSources: ['foo'] },\n separatorsToIndex: 'bar',\n snippetEllipsisText: '---',\n sortFacetValuesBy: 'date',\n typoTolerance: false,\n unretrievableAttributes: ['foo'],\n userData: { user: 'data' },\n },\n});", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'],\n customRanking: ['desc(popularity)'],\n attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'],\n },\n});", + "searchableAttributesOrdering": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['unordered(title)', 'cast'] },\n});", "searchableAttributesProductReferenceSuffixes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] },\n});", "queryLanguageAndIgnorePlurals": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { queryLanguages: ['en'], ignorePlurals: true },\n});", "searchableAttributesInMovies": "const response = await client.setSettings({\n indexName: 'movies',\n indexSettings: { searchableAttributes: ['title_eng', 'title_fr', 'title_es'] },\n});", "disablePrefixOnAttributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disablePrefixOnAttributes: ['serial_number'] },\n});", + "disableTypoToleranceOnAttributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] },\n});", "searchableAttributesSimpleExample": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['serial_number'] },\n});", - "searchableAttributesSimpleExampleAlt": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] },\n});" + "searchableAttributesSimpleExampleAlt": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] },\n});", + "set_searchable_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n attributesForFaceting: [\n 'author',\n 'filterOnly(isbn)',\n 'searchable(edition)',\n 'afterDistinct(category)',\n 'afterDistinct(searchable(publisher))',\n ],\n },\n});", + "unretrievable_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { unretrievableAttributes: ['total_number_of_sales'] },\n});", + "set_retrievable_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToRetrieve: ['author', 'title', 'content'] },\n});", + "set_all_attributes_as_retrievable": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToRetrieve: ['*'] },\n});", + "specify_attributes_not_to_retrieve": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToRetrieve: ['*', '-SKU', '-internal_desc'] },\n});", + "neural_search": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'neuralSearch' } });", + "keyword_search": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'keywordSearch' } });", + "set_default_ranking": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { ranking: ['typo', 'geo', 'words', 'filters', 'attribute', 'proximity', 'exact', 'custom'] },\n});", + "set_ranking_by_attribute_asc": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n ranking: ['asc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'],\n },\n});", + "set_ranking_by_attribute_desc": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'],\n },\n});", + "restrict_searchable_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { customRanking: ['desc(popularity)', 'asc(price)'] },\n});", + "set_default_relevancy": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { relevancyStrictness: 90 } });", + "set_replicas": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { replicas: ['name_of_replica_index1', 'name_of_replica_index2'] },\n});", + "set_default_max_values_per_facet": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxValuesPerFacet: 100 } });", + "set_default_sort_facet_values_by": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { sortFacetValuesBy: 'alpha' },\n});", + "set_attributes_to_snippet": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToSnippet: ['content:80', 'description'] },\n});", + "set_all_attributes_to_snippet": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributesToSnippet: ['*:80'] },\n});", + "set_default_highlight_pre_tag": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { highlightPreTag: '' } });", + "set_default_highlight_post_tag": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { highlightPostTag: '' },\n});", + "set_default_snippet_ellipsis_text": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { snippetEllipsisText: '…' } });", + "enable_restrict_highlight_and_snippet_arrays_by_default": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { restrictHighlightAndSnippetArrays: true },\n});", + "set_default_hits_per_page": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { hitsPerPage: 20 } });", + "set_pagination_limit": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { paginationLimitedTo: 1000 },\n});", + "set_default_min_word_size_for_one_typo": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minWordSizefor1Typo: 4 } });", + "set_default_min_word_size_for_two_typos": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minWordSizefor2Typos: 4 } });", + "set_default_typo_tolerance_mode": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { typoTolerance: true } });", + "disable_typos_on_numeric_tokens_by_default": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { allowTyposOnNumericTokens: false },\n});", + "disable_typo_tolerance_for_words": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disableTypoToleranceOnWords: ['wheel', '1X2BCD'] },\n});", + "set_separators_to_index": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { separatorsToIndex: '+#' } });", + "set_languages_using_querylanguages": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { queryLanguages: ['es'], removeStopWords: true, ignorePlurals: true },\n});", + "set_attributes_to_transliterate": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { indexLanguages: ['ja'], attributesToTransliterate: ['name', 'description'] },\n});", + "set_camel_case_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { camelCaseAttributes: ['description'] },\n});", + "set_decompounded_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { decompoundedAttributes: { de: ['name'] } },\n});", + "set_decompounded_multiple_attributes": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { decompoundedAttributes: { de: ['name_de', 'description_de'], fi: ['name_fi', 'description_fi'] } },\n});", + "set_keep_diacritics_on_characters": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { keepDiacriticsOnCharacters: 'øé' },\n});", + "set_custom_normalization": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { customNormalization: { default: { ä: 'ae' } } },\n});", + "set_indexlanguages": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { indexLanguages: ['ja'] } });", + "enable_decompound_query_by_default": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { decompoundQuery: true } });", + "enable_rules_syntax_by_default": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { enableRules: true } });", + "enable_personalization_settings": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { enablePersonalization: true },\n});", + "set_default_query_type": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { queryType: 'prefixLast' } });", + "set_default_remove_words_if_no_result": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { removeWordsIfNoResults: 'none' },\n});", + "enable_advanced_syntax_by_default": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { advancedSyntax: true } });", + "set_default_optional_words": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { optionalWords: ['blue', 'iphone case'] },\n});", + "disabling_prefix_search_for_some_attributes_by_default": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disablePrefixOnAttributes: ['sku'] },\n});", + "disabling_exact_for_some_attributes_by_default": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { disableExactOnAttributes: ['description'] },\n});", + "set_default_exact_single_word_query": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { exactOnSingleWordQuery: 'attribute' },\n});", + "set_default_aternative_as_exact": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { alternativesAsExact: ['ignorePlurals', 'singleWordSynonym'] },\n});", + "set_numeric_attributes_for_filtering": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { numericAttributesForFiltering: ['quantity', 'popularity'] },\n});", + "enable_compression_of_integer_array": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { allowCompressionOfIntegerArray: true },\n});", + "set_attributes_for_distinct": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributeForDistinct: 'url' },\n});", + "set_distinct": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { distinct: 1, attributeForDistinct: 'url' },\n});", + "set_replace_synonyms_in_highlights": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { replaceSynonymsInHighlight: false },\n});", + "set_min_proximity": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minProximity: 1 } });", + "set_default_field": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { responseFields: ['hits', 'hitsPerPage', 'nbPages', 'page'] },\n});", + "set_max_facet_hits": "const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxFacetHits: 10 } });", + "set_attribute_criteria_computed_by_min_proximity": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { attributeCriteriaComputedByMinProximity: true },\n});", + "set_user_data": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: { userData: { extraData: 'This is the custom data that you want to store in your index' } },\n});", + "set_rendering_content": "const response = await client.setSettings({\n indexName: 'theIndexName',\n indexSettings: {\n renderingContent: {\n facetOrdering: {\n facets: { order: ['size', 'brand'] },\n values: {\n brand: { order: ['uniqlo'], hide: ['muji'], sortRemainingBy: 'count' },\n size: { order: ['S', 'M', 'L'], sortRemainingBy: 'hidden' },\n },\n },\n },\n },\n});" }, "updateApiKey": { "default": "const response = await client.updateApiKey({\n key: 'ALGOLIA_API_KEY',\n apiKey: { acl: ['search', 'addObject'], validity: 300, maxQueriesPerIPPerHour: 100, maxHitsPerQuery: 20 },\n});" @@ -2329,6 +3084,10 @@ "filtersStephenKing": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n filters = \"author:\\\"Stephen King\\\"\",\n ),\n)", "filtersNotTags": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n filters = \"NOT _tags:non-fiction\",\n ),\n)", "facetFiltersList": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"publisher:Penguin\"), FacetFilters.of(listOf(FacetFilters.of(\"author:Stephen King\"), FacetFilters.of(\"genre:Horror\"))))),\n ),\n)", + "facetFiltersBook": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"category:Book\"))),\n ),\n)", + "facetFiltersAND": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"author:John Doe\"))),\n ),\n)", + "facetFiltersOR": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(listOf(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"author:John Doe\"))))),\n ),\n)", + "facetFiltersCombined": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"author:John Doe\"), FacetFilters.of(listOf(FacetFilters.of(\"category:Book\"), FacetFilters.of(\"category:Movie\"))))),\n ),\n)", "facetFiltersNeg": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n facetFilters = FacetFilters.of(\"category:-Ebook\"),\n ),\n)", "filtersAndFacetFilters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n filters = \"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\",\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"publisher:Penguin\"))),\n ),\n)", "facet author genre": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n facets = listOf(\"author\", \"genre\"),\n ),\n)", @@ -2348,9 +3107,90 @@ "clickAnalyticsUserToken": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n clickAnalytics = true,\n userToken = \"user-1\",\n ),\n)", "enablePersonalization": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n enablePersonalization = true,\n userToken = \"user-1\",\n ),\n)", "userToken": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n userToken = \"user-1\",\n ),\n)", + "userToken1234": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n userToken = \"user-1234\",\n ),\n)", "analyticsTag": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n analyticsTags = listOf(\"YOUR_ANALYTICS_TAG\"),\n ),\n)", "facetFiltersUsers": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n facetFilters = FacetFilters.of(listOf(FacetFilters.of(\"user:user42\"), FacetFilters.of(\"user:public\"))),\n ),\n)", - "buildTheQuery": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n filters = \"categoryPageId: Men's Clothing\",\n hitsPerPage = 50,\n analyticsTags = listOf(\"mens-clothing\"),\n ),\n)" + "buildTheQuery": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n filters = \"categoryPageId: Men's Clothing\",\n hitsPerPage = 50,\n analyticsTags = listOf(\"mens-clothing\"),\n ),\n)", + "attributesToHighlightOverride": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n attributesToHighlight = listOf(\"title\", \"content\"),\n ),\n)", + "disableTypoToleranceOnAttributes": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n disableTypoToleranceOnAttributes = listOf(\"serial_number\"),\n ),\n)", + "search_a_query": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"\",\n similarQuery = \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n filters = \"year:1991 TO 2001\",\n ),\n)", + "search_everything": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"\",\n ),\n)", + "api_filtering_range_example": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"books\",\n filters = \"price:10 TO 20\",\n ),\n)", + "override_retrievable_attributes": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n attributesToRetrieve = listOf(\"title\", \"content\"),\n ),\n)", + "restrict_searchable_attributes": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n restrictSearchableAttributes = listOf(\"title\", \"author\"),\n ),\n)", + "override_default_relevancy": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n relevancyStrictness = 70,\n ),\n)", + "apply_filters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n sumOrFiltersScores = true,\n ),\n)", + "apply_all_filters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n 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\\\"\",\n ),\n)", + "escape_spaces": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n filters = \"category:\\\"Books and Comics\\\"\",\n ),\n)", + "escape_keywords": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n filters = \"keyword:\\\"OR\\\"\",\n ),\n)", + "escape_single_quotes": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n filters = \"content:\\\"It's a wonderful day\\\"\",\n ),\n)", + "escape_double_quotes": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n filters = \"content:\\\"She said \\\"Hello World\\\"\",\n ),\n)", + "apply_negative_filters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of(\"category:Book\"), OptionalFilters.of(\"author:-John Doe\"))),\n ),\n)", + "apply_numeric_filters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n numericFilters = NumericFilters.of(listOf(NumericFilters.of(\"price < 1000\"), NumericFilters.of(listOf(NumericFilters.of(\"inStock = 1\"), NumericFilters.of(\"deliveryDate < 1441755506\"))))),\n ),\n)", + "apply_tag_filters": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n tagFilters = TagFilters.of(listOf(TagFilters.of(\"SciFi\"), TagFilters.of(listOf(TagFilters.of(\"Book\"), TagFilters.of(\"Movie\"))))),\n ),\n)", + "facets_all": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facets = listOf(\"*\"),\n ),\n)", + "retrieve_only_some_facets": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facets = listOf(\"category\", \"author\"),\n ),\n)", + "override_default_max_values_per_facet": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n maxValuesPerFacet = 20,\n ),\n)", + "enable_faceting_after_distinct": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n facetingAfterDistinct = true,\n ),\n)", + "sort_facet_values_alphabetically": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n sortFacetValuesBy = \"count\",\n ),\n)", + "override_attributes_to_snippet": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n attributesToSnippet = listOf(\"title\", \"content:80\"),\n ),\n)", + "override_default_highlight_pre_tag": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n highlightPreTag = \"\",\n ),\n)", + "override_default_highlight_post_tag": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n highlightPostTag = \"\",\n ),\n)", + "override_default_snippet_ellipsis_text": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n snippetEllipsisText = \"\",\n ),\n)", + "enable_restrict_highlight_and_snippet_arrays": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n restrictHighlightAndSnippetArrays = false,\n ),\n)", + "access_page": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n page = 0,\n ),\n)", + "override_default_hits_per_page": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n hitsPerPage = 10,\n ),\n)", + "get_nth_hit": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n offset = 4,\n ),\n)", + "get_n_results": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n length = 4,\n ),\n)", + "override_default_min_word_size_for_one_typo": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n minWordSizefor1Typo = 2,\n ),\n)", + "override_default_min_word_size_for_two_typos": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n minWordSizefor2Typos = 2,\n ),\n)", + "override_default_typo_tolerance_mode": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n typoTolerance = TypoTolerance.of(false),\n ),\n)", + "disable_typos_on_numeric_tokens_at_search_time": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n allowTyposOnNumericTokens = false,\n ),\n)", + "search_around_a_position": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundLatLng = \"40.71, -74.01\",\n ),\n)", + "search_around_server_ip": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundLatLngViaIP = true,\n ),\n requestOptions = RequestOptions(\n headers = buildMap {\n put(\"x-forwarded-for\", \"94.228.178.246 // should be replaced with the actual IP you would like to search around\")\n },\n ),\n)", + "set_around_radius": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundRadius = AroundRadius.of(1000),\n ),\n)", + "disable_automatic_radius": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundRadius = AroundRadiusAll.entries.first { it.value == \"all\" },\n ),\n)", + "set_geo_search_precision": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundPrecision = AroundPrecision.of(100),\n ),\n)", + "set_geo_search_precision_non_linear": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n aroundPrecision = AroundPrecision.of(\n listOf(\n Range(\n from = 0,\n value = 25,\n ),\n Range(\n from = 2000,\n value = 1000,\n ),\n ),\n ),\n ),\n)", + "set_minimum_geo_search_radius": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n minimumAroundRadius = 1000,\n ),\n)", + "search_inside_rectangular_area": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))),\n ),\n)", + "search_inside_multiple_rectangular_areas": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875))),\n ),\n)", + "search_inside_polygon_area": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)),\n ),\n)", + "search_inside_multiple_polygon_areas": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625)),\n ),\n)", + "set_querylanguages_override": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == \"ca\" }, SupportedLanguage.entries.first { it.value == \"es\" })),\n ),\n)", + "set_querylanguages_with_japanese_query": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n queryLanguages = listOf(SupportedLanguage.entries.first { it.value == \"ja\" }, SupportedLanguage.entries.first { it.value == \"en\" }),\n ),\n)", + "set_natural_languages": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"\",\n naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == \"fr\" }),\n ),\n)", + "override_natural_languages_with_query": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"\",\n naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == \"fr\" }),\n removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == \"firstWords\" },\n ),\n)", + "enable_decompound_query_search_time": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n decompoundQuery = true,\n ),\n)", + "enable_rules_search_time": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enableRules = true,\n ),\n)", + "set_rule_contexts": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n ruleContexts = listOf(\"front_end\", \"website2\"),\n ),\n)", + "enable_personalization": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enablePersonalization = true,\n ),\n)", + "enable_personalization_with_user_token": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enablePersonalization = true,\n userToken = \"123456\",\n ),\n)", + "personalization_impact": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n personalizationImpact = 20,\n ),\n)", + "set_user_token": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n userToken = \"123456\",\n ),\n)", + "set_user_token_with_personalization": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enablePersonalization = true,\n userToken = \"123456\",\n ),\n)", + "override_default_query_type": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n queryType = QueryType.entries.first { it.value == \"prefixAll\" },\n ),\n)", + "override_default_remove_words_if_no_results": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == \"lastWords\" },\n ),\n)", + "enable_advanced_syntax_search_time": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n advancedSyntax = true,\n ),\n)", + "overide_default_optional_words": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n optionalWords = OptionalWords.of(listOf(\"toyota\", \"2020 2021\")),\n ),\n)", + "disabling_exact_for_some_attributes_search_time": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n disableExactOnAttributes = listOf(\"description\"),\n ),\n)", + "override_default_exact_single_word_query": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == \"none\" },\n ),\n)", + "override_default_aternative_as_exact": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == \"multiWordsSynonym\" }),\n ),\n)", + "enable_advanced_syntax_exact_phrase": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n advancedSyntax = true,\n advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == \"exactPhrase\" }),\n ),\n)", + "enable_advanced_syntax_exclude_words": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n advancedSyntax = true,\n advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == \"excludeWords\" }),\n ),\n)", + "override_distinct": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n distinct = Distinct.of(0),\n ),\n)", + "get_ranking_info": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n getRankingInfo = true,\n ),\n)", + "disable_click_analytics": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n clickAnalytics = false,\n ),\n)", + "enable_click_analytics": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n clickAnalytics = true,\n ),\n)", + "disable_analytics": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n analytics = false,\n ),\n)", + "add_analytics_tags": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n analyticsTags = listOf(\"front_end\", \"website2\"),\n ),\n)", + "disable_synonyms": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n synonyms = false,\n ),\n)", + "override_replace_synonyms_in_highlights": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n replaceSynonymsInHighlight = true,\n ),\n)", + "override_min_proximity": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n minProximity = 2,\n ),\n)", + "override_default_field": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n responseFields = listOf(\"hits\", \"facets\"),\n ),\n)", + "override_percentile_computation": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n percentileComputation = false,\n ),\n)", + "set_ab_test": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enableABTest = false,\n ),\n)", + "set_enable_re_ranking": "var response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = SearchParamsObject(\n query = \"query\",\n enableReRanking = false,\n ),\n)" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "var response = client.searchSynonyms(\n indexName = \"\",\n)", @@ -2381,6 +3221,9 @@ "distinct true": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n distinct = Distinct.of(true),\n ),\n)", "distinct section": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeForDistinct = \"section\",\n distinct = Distinct.of(true),\n ),\n)", "attributesForFaceting allergens": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"allergens\"),\n ),\n)", + "api_attributes_for_faceting": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"genre\", \"author\"),\n ),\n)", + "api_attributes_for_faceting_searchable": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"genre\", \"searchable(author)\"),\n ),\n)", + "api_attributes_for_filter_only": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"filterOnly(genre)\", \"author\"),\n ),\n)", "attributesForFaceting categoryPageId": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"searchable(categoryPageId)\"),\n ),\n)", "unretrievableAttributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n unretrievableAttributes = listOf(\"visible_by\"),\n ),\n)", "attributesForFaceting user restricted data": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"filterOnly(visible_by)\"),\n ),\n)", @@ -2404,6 +3247,7 @@ "customRanking and ranking sort alphabetically": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = listOf(\"asc(textual_attribute)\"),\n ranking = listOf(\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"),\n ),\n)", "relevancyStrictness": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = listOf(\"asc(textual_attribute)\"),\n relevancyStrictness = 0,\n ),\n)", "create replica index": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = listOf(\"products_price_desc\"),\n ),\n)", + "create replica index articles": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = listOf(\"articles_date_desc\"),\n ),\n)", "create virtual replica index": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = listOf(\"virtual(products_price_desc)\"),\n ),\n)", "unlink replica index": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = listOf(\"\"),\n ),\n)", "forwardToReplicas": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"name\", \"description\"),\n ),\n forwardToReplicas = true,\n)", @@ -2413,15 +3257,77 @@ "ranking closest dates": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = listOf(\"asc(date_timestamp)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"),\n ),\n)", "searchableAttributes item variation": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"design\", \"type\", \"color\"),\n ),\n)", "searchableAttributes around location": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"name\", \"country\", \"code\", \"iata_code\"),\n customRanking = listOf(\"desc(links_count)\"),\n ),\n)", - "disableTypoToleranceOnAttributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnAttributes = listOf(\"serial_number\"),\n ),\n)", + "attributesToHighlight": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToHighlight = listOf(\"author\", \"title\", \"content\"),\n ),\n)", + "attributesToHighlightStar": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToHighlight = listOf(\"*\"),\n ),\n)", "everything": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n advancedSyntax = true,\n advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == \"exactPhrase\" }),\n allowCompressionOfIntegerArray = true,\n allowTyposOnNumericTokens = true,\n alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == \"singleWordSynonym\" }),\n attributeCriteriaComputedByMinProximity = true,\n attributeForDistinct = \"test\",\n attributesForFaceting = listOf(\"algolia\"),\n attributesToHighlight = listOf(\"algolia\"),\n attributesToRetrieve = listOf(\"algolia\"),\n attributesToSnippet = listOf(\"algolia\"),\n attributesToTransliterate = listOf(\"algolia\"),\n camelCaseAttributes = listOf(\"algolia\"),\n customNormalization = mapOf(\"algolia\" to mapOf(\"aloglia\" to \"aglolia\")),\n customRanking = listOf(\"algolia\"),\n decompoundQuery = false,\n decompoundedAttributes = buildJsonObject {\n put(\n \"algolia\",\n JsonPrimitive(\"aloglia\"),\n )\n },\n disableExactOnAttributes = listOf(\"algolia\"),\n disablePrefixOnAttributes = listOf(\"algolia\"),\n disableTypoToleranceOnAttributes = listOf(\"algolia\"),\n disableTypoToleranceOnWords = listOf(\"algolia\"),\n distinct = Distinct.of(3),\n enablePersonalization = true,\n enableReRanking = false,\n enableRules = true,\n exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == \"attribute\" },\n highlightPreTag = \"\",\n highlightPostTag = \"\",\n hitsPerPage = 10,\n ignorePlurals = IgnorePlurals.of(false),\n indexLanguages = listOf(SupportedLanguage.entries.first { it.value == \"fr\" }),\n keepDiacriticsOnCharacters = \"abc\",\n maxFacetHits = 20,\n maxValuesPerFacet = 30,\n minProximity = 6,\n minWordSizefor1Typo = 5,\n minWordSizefor2Typos = 11,\n mode = Mode.entries.first { it.value == \"neuralSearch\" },\n numericAttributesForFiltering = listOf(\"algolia\"),\n optionalWords = OptionalWords.of(listOf(\"myspace\")),\n paginationLimitedTo = 0,\n queryLanguages = listOf(SupportedLanguage.entries.first { it.value == \"fr\" }),\n queryType = QueryType.entries.first { it.value == \"prefixLast\" },\n ranking = listOf(\"geo\"),\n reRankingApplyFilter = ReRankingApplyFilter.of(\"mySearch:filters\"),\n relevancyStrictness = 10,\n removeStopWords = RemoveStopWords.of(false),\n removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == \"lastWords\" },\n renderingContent = RenderingContent(\n facetOrdering = FacetOrdering(\n facets = Facets(\n order = listOf(\"a\", \"b\"),\n ),\n values = mapOf(\n \"a\" to Value(\n order = listOf(\"b\"),\n sortRemainingBy = SortRemainingBy.entries.first { it.value == \"count\" },\n ),\n ),\n ),\n ),\n replaceSynonymsInHighlight = true,\n replicas = listOf(\"\"),\n responseFields = listOf(\"algolia\"),\n restrictHighlightAndSnippetArrays = true,\n searchableAttributes = listOf(\"foo\"),\n semanticSearch = SemanticSearch(\n eventSources = listOf(\"foo\"),\n ),\n separatorsToIndex = \"bar\",\n snippetEllipsisText = \"---\",\n sortFacetValuesBy = \"date\",\n typoTolerance = TypoTolerance.of(false),\n unretrievableAttributes = listOf(\"foo\"),\n userData = buildJsonObject {\n put(\n \"user\",\n JsonPrimitive(\"data\"),\n )\n },\n ),\n)", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"brand\", \"name\", \"categories\", \"unordered(description)\"),\n customRanking = listOf(\"desc(popularity)\"),\n attributesForFaceting = listOf(\"searchable(brand)\", \"type\", \"categories\", \"price\"),\n ),\n)", + "searchableAttributesOrdering": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"unordered(title)\", \"cast\"),\n ),\n)", "searchableAttributesProductReferenceSuffixes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"name\", \"product_reference\", \"product_reference_suffixes\"),\n ),\n)", "queryLanguageAndIgnorePlurals": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryLanguages = listOf(SupportedLanguage.entries.first { it.value == \"en\" }),\n ignorePlurals = IgnorePlurals.of(true),\n ),\n)", "searchableAttributesInMovies": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"title_eng\", \"title_fr\", \"title_es\"),\n ),\n)", "disablePrefixOnAttributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disablePrefixOnAttributes = listOf(\"serial_number\"),\n ),\n)", + "disableTypoToleranceOnAttributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnAttributes = listOf(\"serial_number\"),\n ),\n)", "searchableAttributesSimpleExample": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"serial_number\"),\n ),\n)", - "searchableAttributesSimpleExampleAlt": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"serial_number\", \"serial_number_suffixes\"),\n ),\n)" + "searchableAttributesSimpleExampleAlt": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = listOf(\"serial_number\", \"serial_number_suffixes\"),\n ),\n)", + "set_searchable_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = listOf(\"author\", \"filterOnly(isbn)\", \"searchable(edition)\", \"afterDistinct(category)\", \"afterDistinct(searchable(publisher))\"),\n ),\n)", + "unretrievable_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n unretrievableAttributes = listOf(\"total_number_of_sales\"),\n ),\n)", + "set_retrievable_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = listOf(\"author\", \"title\", \"content\"),\n ),\n)", + "set_all_attributes_as_retrievable": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = listOf(\"*\"),\n ),\n)", + "specify_attributes_not_to_retrieve": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = listOf(\"*\", \"-SKU\", \"-internal_desc\"),\n ),\n)", + "neural_search": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n mode = Mode.entries.first { it.value == \"neuralSearch\" },\n ),\n)", + "keyword_search": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n mode = Mode.entries.first { it.value == \"keywordSearch\" },\n ),\n)", + "set_default_ranking": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = listOf(\"typo\", \"geo\", \"words\", \"filters\", \"attribute\", \"proximity\", \"exact\", \"custom\"),\n ),\n)", + "set_ranking_by_attribute_asc": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = listOf(\"asc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"),\n ),\n)", + "set_ranking_by_attribute_desc": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = listOf(\"desc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"),\n ),\n)", + "restrict_searchable_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = listOf(\"desc(popularity)\", \"asc(price)\"),\n ),\n)", + "set_default_relevancy": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n relevancyStrictness = 90,\n ),\n)", + "set_replicas": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = listOf(\"name_of_replica_index1\", \"name_of_replica_index2\"),\n ),\n)", + "set_default_max_values_per_facet": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n maxValuesPerFacet = 100,\n ),\n)", + "set_default_sort_facet_values_by": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n sortFacetValuesBy = \"alpha\",\n ),\n)", + "set_attributes_to_snippet": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToSnippet = listOf(\"content:80\", \"description\"),\n ),\n)", + "set_all_attributes_to_snippet": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToSnippet = listOf(\"*:80\"),\n ),\n)", + "set_default_highlight_pre_tag": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n highlightPreTag = \"\",\n ),\n)", + "set_default_highlight_post_tag": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n highlightPostTag = \"\",\n ),\n)", + "set_default_snippet_ellipsis_text": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n snippetEllipsisText = \"…\",\n ),\n)", + "enable_restrict_highlight_and_snippet_arrays_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n restrictHighlightAndSnippetArrays = true,\n ),\n)", + "set_default_hits_per_page": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n hitsPerPage = 20,\n ),\n)", + "set_pagination_limit": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n paginationLimitedTo = 1000,\n ),\n)", + "set_default_min_word_size_for_one_typo": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minWordSizefor1Typo = 4,\n ),\n)", + "set_default_min_word_size_for_two_typos": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minWordSizefor2Typos = 4,\n ),\n)", + "set_default_typo_tolerance_mode": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n typoTolerance = TypoTolerance.of(true),\n ),\n)", + "disable_typos_on_numeric_tokens_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n allowTyposOnNumericTokens = false,\n ),\n)", + "disable_typo_tolerance_for_words": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnWords = listOf(\"wheel\", \"1X2BCD\"),\n ),\n)", + "set_separators_to_index": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n separatorsToIndex = \"+#\",\n ),\n)", + "set_languages_using_querylanguages": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryLanguages = listOf(SupportedLanguage.entries.first { it.value == \"es\" }),\n removeStopWords = RemoveStopWords.of(true),\n ignorePlurals = IgnorePlurals.of(true),\n ),\n)", + "set_attributes_to_transliterate": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n indexLanguages = listOf(SupportedLanguage.entries.first { it.value == \"ja\" }),\n attributesToTransliterate = listOf(\"name\", \"description\"),\n ),\n)", + "set_camel_case_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n camelCaseAttributes = listOf(\"description\"),\n ),\n)", + "set_decompounded_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundedAttributes = buildJsonObject {\n put(\n \"de\",\n JsonArray(\n listOf(\n JsonPrimitive(\"name\"),\n ),\n ),\n )\n },\n ),\n)", + "set_decompounded_multiple_attributes": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundedAttributes = buildJsonObject {\n put(\n \"de\",\n JsonArray(\n listOf(\n JsonPrimitive(\"name_de\"),\n JsonPrimitive(\"description_de\"),\n ),\n ),\n )\n put(\n \"fi\",\n JsonArray(\n listOf(\n JsonPrimitive(\"name_fi\"),\n JsonPrimitive(\"description_fi\"),\n ),\n ),\n )\n },\n ),\n)", + "set_keep_diacritics_on_characters": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n keepDiacriticsOnCharacters = \"øé\",\n ),\n)", + "set_custom_normalization": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customNormalization = mapOf(\"default\" to mapOf(\"ä\" to \"ae\")),\n ),\n)", + "set_indexlanguages": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n indexLanguages = listOf(SupportedLanguage.entries.first { it.value == \"ja\" }),\n ),\n)", + "enable_decompound_query_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundQuery = true,\n ),\n)", + "enable_rules_syntax_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n enableRules = true,\n ),\n)", + "enable_personalization_settings": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n enablePersonalization = true,\n ),\n)", + "set_default_query_type": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryType = QueryType.entries.first { it.value == \"prefixLast\" },\n ),\n)", + "set_default_remove_words_if_no_result": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == \"none\" },\n ),\n)", + "enable_advanced_syntax_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n advancedSyntax = true,\n ),\n)", + "set_default_optional_words": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n optionalWords = OptionalWords.of(listOf(\"blue\", \"iphone case\")),\n ),\n)", + "disabling_prefix_search_for_some_attributes_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disablePrefixOnAttributes = listOf(\"sku\"),\n ),\n)", + "disabling_exact_for_some_attributes_by_default": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableExactOnAttributes = listOf(\"description\"),\n ),\n)", + "set_default_exact_single_word_query": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == \"attribute\" },\n ),\n)", + "set_default_aternative_as_exact": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == \"ignorePlurals\" }, AlternativesAsExact.entries.first { it.value == \"singleWordSynonym\" }),\n ),\n)", + "set_numeric_attributes_for_filtering": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n numericAttributesForFiltering = listOf(\"quantity\", \"popularity\"),\n ),\n)", + "enable_compression_of_integer_array": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n allowCompressionOfIntegerArray = true,\n ),\n)", + "set_attributes_for_distinct": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeForDistinct = \"url\",\n ),\n)", + "set_distinct": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n distinct = Distinct.of(1),\n attributeForDistinct = \"url\",\n ),\n)", + "set_replace_synonyms_in_highlights": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replaceSynonymsInHighlight = false,\n ),\n)", + "set_min_proximity": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minProximity = 1,\n ),\n)", + "set_default_field": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n responseFields = listOf(\"hits\", \"hitsPerPage\", \"nbPages\", \"page\"),\n ),\n)", + "set_max_facet_hits": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n maxFacetHits = 10,\n ),\n)", + "set_attribute_criteria_computed_by_min_proximity": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeCriteriaComputedByMinProximity = true,\n ),\n)", + "set_user_data": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n userData = buildJsonObject {\n put(\n \"extraData\",\n JsonPrimitive(\"This is the custom data that you want to store in your index\"),\n )\n },\n ),\n)", + "set_rendering_content": "var response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n renderingContent = RenderingContent(\n facetOrdering = FacetOrdering(\n facets = Facets(\n order = listOf(\"size\", \"brand\"),\n ),\n values = mapOf(\n \"brand\" to Value(\n order = listOf(\"uniqlo\"),\n hide = listOf(\"muji\"),\n sortRemainingBy = SortRemainingBy.entries.first { it.value == \"count\" },\n ),\n \"size\" to Value(\n order = listOf(\"S\", \"M\", \"L\"),\n sortRemainingBy = SortRemainingBy.entries.first { it.value == \"hidden\" },\n ),\n ),\n ),\n ),\n ),\n)" }, "updateApiKey": { "default": "var response = client.updateApiKey(\n key = \"ALGOLIA_API_KEY\",\n apiKey = ApiKey(\n acl = listOf(Acl.entries.first { it.value == \"search\" }, Acl.entries.first { it.value == \"addObject\" }),\n validity = 300,\n maxQueriesPerIPPerHour = 100,\n maxHitsPerQuery = 20,\n ),\n)" @@ -2736,6 +3642,10 @@ "filtersStephenKing": "$response = $client->searchSingleIndex(\n '',\n ['filters' => 'author:\"Stephen King\"',\n ],\n);", "filtersNotTags": "$response = $client->searchSingleIndex(\n '',\n ['filters' => 'NOT _tags:non-fiction',\n ],\n);", "facetFiltersList": "$response = $client->searchSingleIndex(\n '',\n ['facetFilters' => [\n 'publisher:Penguin',\n\n [\n 'author:Stephen King',\n\n 'genre:Horror',\n ],\n ],\n ],\n);", + "facetFiltersBook": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facetFilters' => [\n 'category:Book',\n ],\n ],\n);", + "facetFiltersAND": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facetFilters' => [\n 'category:Book',\n\n 'author:John Doe',\n ],\n ],\n);", + "facetFiltersOR": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facetFilters' => [\n [\n 'category:Book',\n\n 'author:John Doe',\n ],\n ],\n ],\n);", + "facetFiltersCombined": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facetFilters' => [\n 'author:John Doe',\n\n [\n 'category:Book',\n\n 'category:Movie',\n ],\n ],\n ],\n);", "facetFiltersNeg": "$response = $client->searchSingleIndex(\n '',\n ['facetFilters' => 'category:-Ebook',\n ],\n);", "filtersAndFacetFilters": "$response = $client->searchSingleIndex(\n '',\n ['filters' => '(author:\"Stephen King\" OR genre:\"Horror\")',\n 'facetFilters' => [\n 'publisher:Penguin',\n ],\n ],\n);", "facet author genre": "$response = $client->searchSingleIndex(\n '',\n ['facets' => [\n 'author',\n\n 'genre',\n ],\n ],\n);", @@ -2755,9 +3665,90 @@ "clickAnalyticsUserToken": "$response = $client->searchSingleIndex(\n '',\n ['clickAnalytics' => true,\n 'userToken' => 'user-1',\n ],\n);", "enablePersonalization": "$response = $client->searchSingleIndex(\n '',\n ['enablePersonalization' => true,\n 'userToken' => 'user-1',\n ],\n);", "userToken": "$response = $client->searchSingleIndex(\n '',\n ['userToken' => 'user-1',\n ],\n);", + "userToken1234": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'userToken' => 'user-1234',\n ],\n);", "analyticsTag": "$response = $client->searchSingleIndex(\n '',\n ['analyticsTags' => [\n 'YOUR_ANALYTICS_TAG',\n ],\n ],\n);", "facetFiltersUsers": "$response = $client->searchSingleIndex(\n '',\n ['facetFilters' => [\n 'user:user42',\n\n 'user:public',\n ],\n ],\n);", - "buildTheQuery": "$response = $client->searchSingleIndex(\n '',\n ['filters' => \"categoryPageId: Men's Clothing\",\n 'hitsPerPage' => 50,\n 'analyticsTags' => [\n 'mens-clothing',\n ],\n ],\n);" + "buildTheQuery": "$response = $client->searchSingleIndex(\n '',\n ['filters' => \"categoryPageId: Men's Clothing\",\n 'hitsPerPage' => 50,\n 'analyticsTags' => [\n 'mens-clothing',\n ],\n ],\n);", + "attributesToHighlightOverride": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'attributesToHighlight' => [\n 'title',\n\n 'content',\n ],\n ],\n);", + "disableTypoToleranceOnAttributes": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'disableTypoToleranceOnAttributes' => [\n 'serial_number',\n ],\n ],\n);", + "search_a_query": "$response = $client->searchSingleIndex(\n '',\n ['query' => '',\n 'similarQuery' => 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen',\n 'filters' => 'year:1991 TO 2001',\n ],\n);", + "search_everything": "$response = $client->searchSingleIndex(\n '',\n ['query' => '',\n ],\n);", + "api_filtering_range_example": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'books',\n 'filters' => 'price:10 TO 20',\n ],\n);", + "override_retrievable_attributes": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'attributesToRetrieve' => [\n 'title',\n\n 'content',\n ],\n ],\n);", + "restrict_searchable_attributes": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'restrictSearchableAttributes' => [\n 'title',\n\n 'author',\n ],\n ],\n);", + "override_default_relevancy": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'relevancyStrictness' => 70,\n ],\n);", + "apply_filters": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'sumOrFiltersScores' => true,\n ],\n);", + "apply_all_filters": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n '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\"',\n ],\n);", + "escape_spaces": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'filters' => 'category:\"Books and Comics\"',\n ],\n);", + "escape_keywords": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'filters' => 'keyword:\"OR\"',\n ],\n);", + "escape_single_quotes": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'filters' => \"content:\\\"It's a wonderful day\\\"\",\n ],\n);", + "escape_double_quotes": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'filters' => 'content:\"She said \"Hello World\"',\n ],\n);", + "apply_negative_filters": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'optionalFilters' => [\n 'category:Book',\n\n 'author:-John Doe',\n ],\n ],\n);", + "apply_numeric_filters": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'numericFilters' => [\n 'price < 1000',\n\n [\n 'inStock = 1',\n\n 'deliveryDate < 1441755506',\n ],\n ],\n ],\n);", + "apply_tag_filters": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'tagFilters' => [\n 'SciFi',\n\n [\n 'Book',\n\n 'Movie',\n ],\n ],\n ],\n);", + "facets_all": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facets' => [\n '*',\n ],\n ],\n);", + "retrieve_only_some_facets": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facets' => [\n 'category',\n\n 'author',\n ],\n ],\n);", + "override_default_max_values_per_facet": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'maxValuesPerFacet' => 20,\n ],\n);", + "enable_faceting_after_distinct": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'facetingAfterDistinct' => true,\n ],\n);", + "sort_facet_values_alphabetically": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'sortFacetValuesBy' => 'count',\n ],\n);", + "override_attributes_to_snippet": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'attributesToSnippet' => [\n 'title',\n\n 'content:80',\n ],\n ],\n);", + "override_default_highlight_pre_tag": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'highlightPreTag' => '',\n ],\n);", + "override_default_highlight_post_tag": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'highlightPostTag' => '',\n ],\n);", + "override_default_snippet_ellipsis_text": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'snippetEllipsisText' => '',\n ],\n);", + "enable_restrict_highlight_and_snippet_arrays": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'restrictHighlightAndSnippetArrays' => false,\n ],\n);", + "access_page": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'page' => 0,\n ],\n);", + "override_default_hits_per_page": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'hitsPerPage' => 10,\n ],\n);", + "get_nth_hit": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'offset' => 4,\n ],\n);", + "get_n_results": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'length' => 4,\n ],\n);", + "override_default_min_word_size_for_one_typo": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'minWordSizefor1Typo' => 2,\n ],\n);", + "override_default_min_word_size_for_two_typos": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'minWordSizefor2Typos' => 2,\n ],\n);", + "override_default_typo_tolerance_mode": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'typoTolerance' => false,\n ],\n);", + "disable_typos_on_numeric_tokens_at_search_time": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'allowTyposOnNumericTokens' => false,\n ],\n);", + "search_around_a_position": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundLatLng' => '40.71, -74.01',\n ],\n);", + "search_around_server_ip": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundLatLngViaIP' => true,\n ],\n [\n 'headers' => [\n 'x-forwarded-for' => '94.228.178.246 // should be replaced with the actual IP you would like to search around',\n ],\n ]\n);", + "set_around_radius": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundRadius' => 1000,\n ],\n);", + "disable_automatic_radius": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundRadius' => 'all',\n ],\n);", + "set_geo_search_precision": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundPrecision' => 100,\n ],\n);", + "set_geo_search_precision_non_linear": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'aroundPrecision' => [\n ['from' => 0,\n 'value' => 25,\n ],\n\n ['from' => 2000,\n 'value' => 1000,\n ],\n ],\n ],\n);", + "set_minimum_geo_search_radius": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'minimumAroundRadius' => 1000,\n ],\n);", + "search_inside_rectangular_area": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'insideBoundingBox' => [\n [\n 46.650828100116044,\n\n 7.123046875,\n\n 45.17210966999772,\n\n 1.009765625,\n ],\n ],\n ],\n);", + "search_inside_multiple_rectangular_areas": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'insideBoundingBox' => [\n [\n 46.650828100116044,\n\n 7.123046875,\n\n 45.17210966999772,\n\n 1.009765625,\n ],\n\n [\n 49.62625916704081,\n\n 4.6181640625,\n\n 47.715070300900194,\n\n 0.482421875,\n ],\n ],\n ],\n);", + "search_inside_polygon_area": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'insidePolygon' => [\n [\n 46.650828100116044,\n\n 7.123046875,\n\n 45.17210966999772,\n\n 1.009765625,\n\n 49.62625916704081,\n\n 4.6181640625,\n ],\n ],\n ],\n);", + "search_inside_multiple_polygon_areas": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'insidePolygon' => [\n [\n 46.650828100116044,\n\n 7.123046875,\n\n 45.17210966999772,\n\n 1.009765625,\n\n 49.62625916704081,\n\n 4.6181640625,\n ],\n\n [\n 49.62625916704081,\n\n 4.6181640625,\n\n 47.715070300900194,\n\n 0.482421875,\n\n 45.17210966999772,\n\n 1.009765625,\n\n 50.62626704081,\n\n 4.6181640625,\n ],\n ],\n ],\n);", + "set_querylanguages_override": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'removeStopWords' => [\n 'ca',\n\n 'es',\n ],\n ],\n);", + "set_querylanguages_with_japanese_query": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'queryLanguages' => [\n 'ja',\n\n 'en',\n ],\n ],\n);", + "set_natural_languages": "$response = $client->searchSingleIndex(\n '',\n ['query' => '',\n 'naturalLanguages' => [\n 'fr',\n ],\n ],\n);", + "override_natural_languages_with_query": "$response = $client->searchSingleIndex(\n '',\n ['query' => '',\n 'naturalLanguages' => [\n 'fr',\n ],\n 'removeWordsIfNoResults' => 'firstWords',\n ],\n);", + "enable_decompound_query_search_time": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'decompoundQuery' => true,\n ],\n);", + "enable_rules_search_time": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enableRules' => true,\n ],\n);", + "set_rule_contexts": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'ruleContexts' => [\n 'front_end',\n\n 'website2',\n ],\n ],\n);", + "enable_personalization": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enablePersonalization' => true,\n ],\n);", + "enable_personalization_with_user_token": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enablePersonalization' => true,\n 'userToken' => '123456',\n ],\n);", + "personalization_impact": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'personalizationImpact' => 20,\n ],\n);", + "set_user_token": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'userToken' => '123456',\n ],\n);", + "set_user_token_with_personalization": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enablePersonalization' => true,\n 'userToken' => '123456',\n ],\n);", + "override_default_query_type": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'queryType' => 'prefixAll',\n ],\n);", + "override_default_remove_words_if_no_results": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'removeWordsIfNoResults' => 'lastWords',\n ],\n);", + "enable_advanced_syntax_search_time": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'advancedSyntax' => true,\n ],\n);", + "overide_default_optional_words": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'optionalWords' => [\n 'toyota',\n\n '2020 2021',\n ],\n ],\n);", + "disabling_exact_for_some_attributes_search_time": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'disableExactOnAttributes' => [\n 'description',\n ],\n ],\n);", + "override_default_exact_single_word_query": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'exactOnSingleWordQuery' => 'none',\n ],\n);", + "override_default_aternative_as_exact": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'alternativesAsExact' => [\n 'multiWordsSynonym',\n ],\n ],\n);", + "enable_advanced_syntax_exact_phrase": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'advancedSyntax' => true,\n 'advancedSyntaxFeatures' => [\n 'exactPhrase',\n ],\n ],\n);", + "enable_advanced_syntax_exclude_words": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'advancedSyntax' => true,\n 'advancedSyntaxFeatures' => [\n 'excludeWords',\n ],\n ],\n);", + "override_distinct": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'distinct' => 0,\n ],\n);", + "get_ranking_info": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'getRankingInfo' => true,\n ],\n);", + "disable_click_analytics": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'clickAnalytics' => false,\n ],\n);", + "enable_click_analytics": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'clickAnalytics' => true,\n ],\n);", + "disable_analytics": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'analytics' => false,\n ],\n);", + "add_analytics_tags": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'analyticsTags' => [\n 'front_end',\n\n 'website2',\n ],\n ],\n);", + "disable_synonyms": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'synonyms' => false,\n ],\n);", + "override_replace_synonyms_in_highlights": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'replaceSynonymsInHighlight' => true,\n ],\n);", + "override_min_proximity": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'minProximity' => 2,\n ],\n);", + "override_default_field": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'responseFields' => [\n 'hits',\n\n 'facets',\n ],\n ],\n);", + "override_percentile_computation": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'percentileComputation' => false,\n ],\n);", + "set_ab_test": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enableABTest' => false,\n ],\n);", + "set_enable_re_ranking": "$response = $client->searchSingleIndex(\n '',\n ['query' => 'query',\n 'enableReRanking' => false,\n ],\n);" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "$response = $client->searchSynonyms(\n '',\n);", @@ -2788,6 +3779,9 @@ "distinct true": "$response = $client->setSettings(\n '',\n ['distinct' => true,\n ],\n);", "distinct section": "$response = $client->setSettings(\n '',\n ['attributeForDistinct' => 'section',\n 'distinct' => true,\n ],\n);", "attributesForFaceting allergens": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'allergens',\n ],\n ],\n);", + "api_attributes_for_faceting": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'genre',\n\n 'author',\n ],\n ],\n);", + "api_attributes_for_faceting_searchable": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'genre',\n\n 'searchable(author)',\n ],\n ],\n);", + "api_attributes_for_filter_only": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'filterOnly(genre)',\n\n 'author',\n ],\n ],\n);", "attributesForFaceting categoryPageId": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'searchable(categoryPageId)',\n ],\n ],\n);", "unretrievableAttributes": "$response = $client->setSettings(\n '',\n ['unretrievableAttributes' => [\n 'visible_by',\n ],\n ],\n);", "attributesForFaceting user restricted data": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'filterOnly(visible_by)',\n ],\n ],\n);", @@ -2811,6 +3805,7 @@ "customRanking and ranking sort alphabetically": "$response = $client->setSettings(\n '',\n ['customRanking' => [\n 'asc(textual_attribute)',\n ],\n 'ranking' => [\n 'custom',\n\n 'typo',\n\n 'geo',\n\n 'words',\n\n 'filters',\n\n 'proximity',\n\n 'attribute',\n\n 'exact',\n ],\n ],\n);", "relevancyStrictness": "$response = $client->setSettings(\n '',\n ['customRanking' => [\n 'asc(textual_attribute)',\n ],\n 'relevancyStrictness' => 0,\n ],\n);", "create replica index": "$response = $client->setSettings(\n '',\n ['replicas' => [\n 'products_price_desc',\n ],\n ],\n);", + "create replica index articles": "$response = $client->setSettings(\n '',\n ['replicas' => [\n 'articles_date_desc',\n ],\n ],\n);", "create virtual replica index": "$response = $client->setSettings(\n '',\n ['replicas' => [\n 'virtual(products_price_desc)',\n ],\n ],\n);", "unlink replica index": "$response = $client->setSettings(\n '',\n ['replicas' => [\n '',\n ],\n ],\n);", "forwardToReplicas": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'name',\n\n 'description',\n ],\n ],\n true,\n);", @@ -2820,15 +3815,77 @@ "ranking closest dates": "$response = $client->setSettings(\n '',\n ['ranking' => [\n 'asc(date_timestamp)',\n\n 'typo',\n\n 'geo',\n\n 'words',\n\n 'filters',\n\n 'proximity',\n\n 'attribute',\n\n 'exact',\n\n 'custom',\n ],\n ],\n);", "searchableAttributes item variation": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'design',\n\n 'type',\n\n 'color',\n ],\n ],\n);", "searchableAttributes around location": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'name',\n\n 'country',\n\n 'code',\n\n 'iata_code',\n ],\n 'customRanking' => [\n 'desc(links_count)',\n ],\n ],\n);", - "disableTypoToleranceOnAttributes": "$response = $client->setSettings(\n '',\n ['disableTypoToleranceOnAttributes' => [\n 'serial_number',\n ],\n ],\n);", + "attributesToHighlight": "$response = $client->setSettings(\n '',\n ['attributesToHighlight' => [\n 'author',\n\n 'title',\n\n 'content',\n ],\n ],\n);", + "attributesToHighlightStar": "$response = $client->setSettings(\n '',\n ['attributesToHighlight' => [\n '*',\n ],\n ],\n);", "everything": "$response = $client->setSettings(\n '',\n ['advancedSyntax' => true,\n 'advancedSyntaxFeatures' => [\n 'exactPhrase',\n ],\n 'allowCompressionOfIntegerArray' => true,\n 'allowTyposOnNumericTokens' => true,\n 'alternativesAsExact' => [\n 'singleWordSynonym',\n ],\n 'attributeCriteriaComputedByMinProximity' => true,\n 'attributeForDistinct' => 'test',\n 'attributesForFaceting' => [\n 'algolia',\n ],\n 'attributesToHighlight' => [\n 'algolia',\n ],\n 'attributesToRetrieve' => [\n 'algolia',\n ],\n 'attributesToSnippet' => [\n 'algolia',\n ],\n 'attributesToTransliterate' => [\n 'algolia',\n ],\n 'camelCaseAttributes' => [\n 'algolia',\n ],\n 'customNormalization' => ['algolia' => ['aloglia' => 'aglolia',\n ],\n ],\n 'customRanking' => [\n 'algolia',\n ],\n 'decompoundQuery' => false,\n 'decompoundedAttributes' => ['algolia' => 'aloglia',\n ],\n 'disableExactOnAttributes' => [\n 'algolia',\n ],\n 'disablePrefixOnAttributes' => [\n 'algolia',\n ],\n 'disableTypoToleranceOnAttributes' => [\n 'algolia',\n ],\n 'disableTypoToleranceOnWords' => [\n 'algolia',\n ],\n 'distinct' => 3,\n 'enablePersonalization' => true,\n 'enableReRanking' => false,\n 'enableRules' => true,\n 'exactOnSingleWordQuery' => 'attribute',\n 'highlightPreTag' => '',\n 'highlightPostTag' => '',\n 'hitsPerPage' => 10,\n 'ignorePlurals' => false,\n 'indexLanguages' => [\n 'fr',\n ],\n 'keepDiacriticsOnCharacters' => 'abc',\n 'maxFacetHits' => 20,\n 'maxValuesPerFacet' => 30,\n 'minProximity' => 6,\n 'minWordSizefor1Typo' => 5,\n 'minWordSizefor2Typos' => 11,\n 'mode' => 'neuralSearch',\n 'numericAttributesForFiltering' => [\n 'algolia',\n ],\n 'optionalWords' => [\n 'myspace',\n ],\n 'paginationLimitedTo' => 0,\n 'queryLanguages' => [\n 'fr',\n ],\n 'queryType' => 'prefixLast',\n 'ranking' => [\n 'geo',\n ],\n 'reRankingApplyFilter' => 'mySearch:filters',\n 'relevancyStrictness' => 10,\n 'removeStopWords' => false,\n 'removeWordsIfNoResults' => 'lastWords',\n 'renderingContent' => ['facetOrdering' => ['facets' => ['order' => [\n 'a',\n\n 'b',\n ],\n ],\n 'values' => ['a' => ['order' => [\n 'b',\n ],\n 'sortRemainingBy' => 'count',\n ],\n ],\n ],\n ],\n 'replaceSynonymsInHighlight' => true,\n 'replicas' => [\n '',\n ],\n 'responseFields' => [\n 'algolia',\n ],\n 'restrictHighlightAndSnippetArrays' => true,\n 'searchableAttributes' => [\n 'foo',\n ],\n 'semanticSearch' => ['eventSources' => [\n 'foo',\n ],\n ],\n 'separatorsToIndex' => 'bar',\n 'snippetEllipsisText' => '---',\n 'sortFacetValuesBy' => 'date',\n 'typoTolerance' => false,\n 'unretrievableAttributes' => [\n 'foo',\n ],\n 'userData' => ['user' => 'data',\n ],\n ],\n);", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'brand',\n\n 'name',\n\n 'categories',\n\n 'unordered(description)',\n ],\n 'customRanking' => [\n 'desc(popularity)',\n ],\n 'attributesForFaceting' => [\n 'searchable(brand)',\n\n 'type',\n\n 'categories',\n\n 'price',\n ],\n ],\n);", + "searchableAttributesOrdering": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'unordered(title)',\n\n 'cast',\n ],\n ],\n);", "searchableAttributesProductReferenceSuffixes": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'name',\n\n 'product_reference',\n\n 'product_reference_suffixes',\n ],\n ],\n);", "queryLanguageAndIgnorePlurals": "$response = $client->setSettings(\n '',\n ['queryLanguages' => [\n 'en',\n ],\n 'ignorePlurals' => true,\n ],\n);", "searchableAttributesInMovies": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'title_eng',\n\n 'title_fr',\n\n 'title_es',\n ],\n ],\n);", "disablePrefixOnAttributes": "$response = $client->setSettings(\n '',\n ['disablePrefixOnAttributes' => [\n 'serial_number',\n ],\n ],\n);", + "disableTypoToleranceOnAttributes": "$response = $client->setSettings(\n '',\n ['disableTypoToleranceOnAttributes' => [\n 'serial_number',\n ],\n ],\n);", "searchableAttributesSimpleExample": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'serial_number',\n ],\n ],\n);", - "searchableAttributesSimpleExampleAlt": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'serial_number',\n\n 'serial_number_suffixes',\n ],\n ],\n);" + "searchableAttributesSimpleExampleAlt": "$response = $client->setSettings(\n '',\n ['searchableAttributes' => [\n 'serial_number',\n\n 'serial_number_suffixes',\n ],\n ],\n);", + "set_searchable_attributes": "$response = $client->setSettings(\n '',\n ['attributesForFaceting' => [\n 'author',\n\n 'filterOnly(isbn)',\n\n 'searchable(edition)',\n\n 'afterDistinct(category)',\n\n 'afterDistinct(searchable(publisher))',\n ],\n ],\n);", + "unretrievable_attributes": "$response = $client->setSettings(\n '',\n ['unretrievableAttributes' => [\n 'total_number_of_sales',\n ],\n ],\n);", + "set_retrievable_attributes": "$response = $client->setSettings(\n '',\n ['attributesToRetrieve' => [\n 'author',\n\n 'title',\n\n 'content',\n ],\n ],\n);", + "set_all_attributes_as_retrievable": "$response = $client->setSettings(\n '',\n ['attributesToRetrieve' => [\n '*',\n ],\n ],\n);", + "specify_attributes_not_to_retrieve": "$response = $client->setSettings(\n '',\n ['attributesToRetrieve' => [\n '*',\n\n '-SKU',\n\n '-internal_desc',\n ],\n ],\n);", + "neural_search": "$response = $client->setSettings(\n '',\n ['mode' => 'neuralSearch',\n ],\n);", + "keyword_search": "$response = $client->setSettings(\n '',\n ['mode' => 'keywordSearch',\n ],\n);", + "set_default_ranking": "$response = $client->setSettings(\n '',\n ['ranking' => [\n 'typo',\n\n 'geo',\n\n 'words',\n\n 'filters',\n\n 'attribute',\n\n 'proximity',\n\n 'exact',\n\n 'custom',\n ],\n ],\n);", + "set_ranking_by_attribute_asc": "$response = $client->setSettings(\n '',\n ['ranking' => [\n 'asc(price)',\n\n 'typo',\n\n 'geo',\n\n 'words',\n\n 'filters',\n\n 'proximity',\n\n 'attribute',\n\n 'exact',\n\n 'custom',\n ],\n ],\n);", + "set_ranking_by_attribute_desc": "$response = $client->setSettings(\n '',\n ['ranking' => [\n 'desc(price)',\n\n 'typo',\n\n 'geo',\n\n 'words',\n\n 'filters',\n\n 'proximity',\n\n 'attribute',\n\n 'exact',\n\n 'custom',\n ],\n ],\n);", + "restrict_searchable_attributes": "$response = $client->setSettings(\n '',\n ['customRanking' => [\n 'desc(popularity)',\n\n 'asc(price)',\n ],\n ],\n);", + "set_default_relevancy": "$response = $client->setSettings(\n '',\n ['relevancyStrictness' => 90,\n ],\n);", + "set_replicas": "$response = $client->setSettings(\n '',\n ['replicas' => [\n 'name_of_replica_index1',\n\n 'name_of_replica_index2',\n ],\n ],\n);", + "set_default_max_values_per_facet": "$response = $client->setSettings(\n '',\n ['maxValuesPerFacet' => 100,\n ],\n);", + "set_default_sort_facet_values_by": "$response = $client->setSettings(\n '',\n ['sortFacetValuesBy' => 'alpha',\n ],\n);", + "set_attributes_to_snippet": "$response = $client->setSettings(\n '',\n ['attributesToSnippet' => [\n 'content:80',\n\n 'description',\n ],\n ],\n);", + "set_all_attributes_to_snippet": "$response = $client->setSettings(\n '',\n ['attributesToSnippet' => [\n '*:80',\n ],\n ],\n);", + "set_default_highlight_pre_tag": "$response = $client->setSettings(\n '',\n ['highlightPreTag' => '',\n ],\n);", + "set_default_highlight_post_tag": "$response = $client->setSettings(\n '',\n ['highlightPostTag' => '',\n ],\n);", + "set_default_snippet_ellipsis_text": "$response = $client->setSettings(\n '',\n ['snippetEllipsisText' => '…',\n ],\n);", + "enable_restrict_highlight_and_snippet_arrays_by_default": "$response = $client->setSettings(\n '',\n ['restrictHighlightAndSnippetArrays' => true,\n ],\n);", + "set_default_hits_per_page": "$response = $client->setSettings(\n '',\n ['hitsPerPage' => 20,\n ],\n);", + "set_pagination_limit": "$response = $client->setSettings(\n '',\n ['paginationLimitedTo' => 1000,\n ],\n);", + "set_default_min_word_size_for_one_typo": "$response = $client->setSettings(\n '',\n ['minWordSizefor1Typo' => 4,\n ],\n);", + "set_default_min_word_size_for_two_typos": "$response = $client->setSettings(\n '',\n ['minWordSizefor2Typos' => 4,\n ],\n);", + "set_default_typo_tolerance_mode": "$response = $client->setSettings(\n '',\n ['typoTolerance' => true,\n ],\n);", + "disable_typos_on_numeric_tokens_by_default": "$response = $client->setSettings(\n '',\n ['allowTyposOnNumericTokens' => false,\n ],\n);", + "disable_typo_tolerance_for_words": "$response = $client->setSettings(\n '',\n ['disableTypoToleranceOnWords' => [\n 'wheel',\n\n '1X2BCD',\n ],\n ],\n);", + "set_separators_to_index": "$response = $client->setSettings(\n '',\n ['separatorsToIndex' => '+#',\n ],\n);", + "set_languages_using_querylanguages": "$response = $client->setSettings(\n '',\n ['queryLanguages' => [\n 'es',\n ],\n 'removeStopWords' => true,\n 'ignorePlurals' => true,\n ],\n);", + "set_attributes_to_transliterate": "$response = $client->setSettings(\n '',\n ['indexLanguages' => [\n 'ja',\n ],\n 'attributesToTransliterate' => [\n 'name',\n\n 'description',\n ],\n ],\n);", + "set_camel_case_attributes": "$response = $client->setSettings(\n '',\n ['camelCaseAttributes' => [\n 'description',\n ],\n ],\n);", + "set_decompounded_attributes": "$response = $client->setSettings(\n '',\n ['decompoundedAttributes' => ['de' => [\n 'name',\n ],\n ],\n ],\n);", + "set_decompounded_multiple_attributes": "$response = $client->setSettings(\n '',\n ['decompoundedAttributes' => ['de' => [\n 'name_de',\n\n 'description_de',\n ],\n 'fi' => [\n 'name_fi',\n\n 'description_fi',\n ],\n ],\n ],\n);", + "set_keep_diacritics_on_characters": "$response = $client->setSettings(\n '',\n ['keepDiacriticsOnCharacters' => 'øé',\n ],\n);", + "set_custom_normalization": "$response = $client->setSettings(\n '',\n ['customNormalization' => ['default' => ['ä' => 'ae',\n ],\n ],\n ],\n);", + "set_indexlanguages": "$response = $client->setSettings(\n '',\n ['indexLanguages' => [\n 'ja',\n ],\n ],\n);", + "enable_decompound_query_by_default": "$response = $client->setSettings(\n '',\n ['decompoundQuery' => true,\n ],\n);", + "enable_rules_syntax_by_default": "$response = $client->setSettings(\n '',\n ['enableRules' => true,\n ],\n);", + "enable_personalization_settings": "$response = $client->setSettings(\n '',\n ['enablePersonalization' => true,\n ],\n);", + "set_default_query_type": "$response = $client->setSettings(\n '',\n ['queryType' => 'prefixLast',\n ],\n);", + "set_default_remove_words_if_no_result": "$response = $client->setSettings(\n '',\n ['removeWordsIfNoResults' => 'none',\n ],\n);", + "enable_advanced_syntax_by_default": "$response = $client->setSettings(\n '',\n ['advancedSyntax' => true,\n ],\n);", + "set_default_optional_words": "$response = $client->setSettings(\n '',\n ['optionalWords' => [\n 'blue',\n\n 'iphone case',\n ],\n ],\n);", + "disabling_prefix_search_for_some_attributes_by_default": "$response = $client->setSettings(\n '',\n ['disablePrefixOnAttributes' => [\n 'sku',\n ],\n ],\n);", + "disabling_exact_for_some_attributes_by_default": "$response = $client->setSettings(\n '',\n ['disableExactOnAttributes' => [\n 'description',\n ],\n ],\n);", + "set_default_exact_single_word_query": "$response = $client->setSettings(\n '',\n ['exactOnSingleWordQuery' => 'attribute',\n ],\n);", + "set_default_aternative_as_exact": "$response = $client->setSettings(\n '',\n ['alternativesAsExact' => [\n 'ignorePlurals',\n\n 'singleWordSynonym',\n ],\n ],\n);", + "set_numeric_attributes_for_filtering": "$response = $client->setSettings(\n '',\n ['numericAttributesForFiltering' => [\n 'quantity',\n\n 'popularity',\n ],\n ],\n);", + "enable_compression_of_integer_array": "$response = $client->setSettings(\n '',\n ['allowCompressionOfIntegerArray' => true,\n ],\n);", + "set_attributes_for_distinct": "$response = $client->setSettings(\n '',\n ['attributeForDistinct' => 'url',\n ],\n);", + "set_distinct": "$response = $client->setSettings(\n '',\n ['distinct' => 1,\n 'attributeForDistinct' => 'url',\n ],\n);", + "set_replace_synonyms_in_highlights": "$response = $client->setSettings(\n '',\n ['replaceSynonymsInHighlight' => false,\n ],\n);", + "set_min_proximity": "$response = $client->setSettings(\n '',\n ['minProximity' => 1,\n ],\n);", + "set_default_field": "$response = $client->setSettings(\n '',\n ['responseFields' => [\n 'hits',\n\n 'hitsPerPage',\n\n 'nbPages',\n\n 'page',\n ],\n ],\n);", + "set_max_facet_hits": "$response = $client->setSettings(\n '',\n ['maxFacetHits' => 10,\n ],\n);", + "set_attribute_criteria_computed_by_min_proximity": "$response = $client->setSettings(\n '',\n ['attributeCriteriaComputedByMinProximity' => true,\n ],\n);", + "set_user_data": "$response = $client->setSettings(\n '',\n ['userData' => ['extraData' => 'This is the custom data that you want to store in your index',\n ],\n ],\n);", + "set_rendering_content": "$response = $client->setSettings(\n '',\n ['renderingContent' => ['facetOrdering' => ['facets' => ['order' => [\n 'size',\n\n 'brand',\n ],\n ],\n 'values' => ['brand' => ['order' => [\n 'uniqlo',\n ],\n 'hide' => [\n 'muji',\n ],\n 'sortRemainingBy' => 'count',\n ],\n 'size' => ['order' => [\n 'S',\n\n 'M',\n\n 'L',\n ],\n 'sortRemainingBy' => 'hidden',\n ],\n ],\n ],\n ],\n ],\n);" }, "updateApiKey": { "default": "$response = $client->updateApiKey(\n 'ALGOLIA_API_KEY',\n ['acl' => [\n 'search',\n\n 'addObject',\n ],\n 'validity' => 300,\n 'maxQueriesPerIPPerHour' => 100,\n 'maxHitsPerQuery' => 20,\n ],\n);" @@ -3143,6 +4200,10 @@ "filtersStephenKing": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"filters\": 'author:\"Stephen King\"',\n },\n)", "filtersNotTags": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"filters\": \"NOT _tags:non-fiction\",\n },\n)", "facetFiltersList": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"facetFilters\": [\n \"publisher:Penguin\",\n [\n \"author:Stephen King\",\n \"genre:Horror\",\n ],\n ],\n },\n)", + "facetFiltersBook": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facetFilters\": [\n \"category:Book\",\n ],\n },\n)", + "facetFiltersAND": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facetFilters\": [\n \"category:Book\",\n \"author:John Doe\",\n ],\n },\n)", + "facetFiltersOR": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facetFilters\": [\n [\n \"category:Book\",\n \"author:John Doe\",\n ],\n ],\n },\n)", + "facetFiltersCombined": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facetFilters\": [\n \"author:John Doe\",\n [\n \"category:Book\",\n \"category:Movie\",\n ],\n ],\n },\n)", "facetFiltersNeg": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"facetFilters\": \"category:-Ebook\",\n },\n)", "filtersAndFacetFilters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"filters\": '(author:\"Stephen King\" OR genre:\"Horror\")',\n \"facetFilters\": [\n \"publisher:Penguin\",\n ],\n },\n)", "facet author genre": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"facets\": [\n \"author\",\n \"genre\",\n ],\n },\n)", @@ -3162,9 +4223,90 @@ "clickAnalyticsUserToken": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"clickAnalytics\": True,\n \"userToken\": \"user-1\",\n },\n)", "enablePersonalization": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"enablePersonalization\": True,\n \"userToken\": \"user-1\",\n },\n)", "userToken": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"userToken\": \"user-1\",\n },\n)", + "userToken1234": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"userToken\": \"user-1234\",\n },\n)", "analyticsTag": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"analyticsTags\": [\n \"YOUR_ANALYTICS_TAG\",\n ],\n },\n)", "facetFiltersUsers": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"facetFilters\": [\n \"user:user42\",\n \"user:public\",\n ],\n },\n)", - "buildTheQuery": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"filters\": \"categoryPageId: Men's Clothing\",\n \"hitsPerPage\": 50,\n \"analyticsTags\": [\n \"mens-clothing\",\n ],\n },\n)" + "buildTheQuery": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"filters\": \"categoryPageId: Men's Clothing\",\n \"hitsPerPage\": 50,\n \"analyticsTags\": [\n \"mens-clothing\",\n ],\n },\n)", + "attributesToHighlightOverride": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"attributesToHighlight\": [\n \"title\",\n \"content\",\n ],\n },\n)", + "disableTypoToleranceOnAttributes": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"disableTypoToleranceOnAttributes\": [\n \"serial_number\",\n ],\n },\n)", + "search_a_query": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"\",\n \"similarQuery\": \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n \"filters\": \"year:1991 TO 2001\",\n },\n)", + "search_everything": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"\",\n },\n)", + "api_filtering_range_example": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"books\",\n \"filters\": \"price:10 TO 20\",\n },\n)", + "override_retrievable_attributes": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"attributesToRetrieve\": [\n \"title\",\n \"content\",\n ],\n },\n)", + "restrict_searchable_attributes": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"restrictSearchableAttributes\": [\n \"title\",\n \"author\",\n ],\n },\n)", + "override_default_relevancy": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"relevancyStrictness\": 70,\n },\n)", + "apply_filters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"sumOrFiltersScores\": True,\n },\n)", + "apply_all_filters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"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\"',\n },\n)", + "escape_spaces": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"filters\": 'category:\"Books and Comics\"',\n },\n)", + "escape_keywords": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"filters\": 'keyword:\"OR\"',\n },\n)", + "escape_single_quotes": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"filters\": 'content:\"It\\'s a wonderful day\"',\n },\n)", + "escape_double_quotes": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"filters\": 'content:\"She said \"Hello World\"',\n },\n)", + "apply_negative_filters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"optionalFilters\": [\n \"category:Book\",\n \"author:-John Doe\",\n ],\n },\n)", + "apply_numeric_filters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"numericFilters\": [\n \"price < 1000\",\n [\n \"inStock = 1\",\n \"deliveryDate < 1441755506\",\n ],\n ],\n },\n)", + "apply_tag_filters": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"tagFilters\": [\n \"SciFi\",\n [\n \"Book\",\n \"Movie\",\n ],\n ],\n },\n)", + "facets_all": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facets\": [\n \"*\",\n ],\n },\n)", + "retrieve_only_some_facets": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facets\": [\n \"category\",\n \"author\",\n ],\n },\n)", + "override_default_max_values_per_facet": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"maxValuesPerFacet\": 20,\n },\n)", + "enable_faceting_after_distinct": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"facetingAfterDistinct\": True,\n },\n)", + "sort_facet_values_alphabetically": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"sortFacetValuesBy\": \"count\",\n },\n)", + "override_attributes_to_snippet": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"attributesToSnippet\": [\n \"title\",\n \"content:80\",\n ],\n },\n)", + "override_default_highlight_pre_tag": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"highlightPreTag\": \"\",\n },\n)", + "override_default_highlight_post_tag": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"highlightPostTag\": \"\",\n },\n)", + "override_default_snippet_ellipsis_text": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"snippetEllipsisText\": \"\",\n },\n)", + "enable_restrict_highlight_and_snippet_arrays": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"restrictHighlightAndSnippetArrays\": False,\n },\n)", + "access_page": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"page\": 0,\n },\n)", + "override_default_hits_per_page": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"hitsPerPage\": 10,\n },\n)", + "get_nth_hit": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"offset\": 4,\n },\n)", + "get_n_results": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"length\": 4,\n },\n)", + "override_default_min_word_size_for_one_typo": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"minWordSizefor1Typo\": 2,\n },\n)", + "override_default_min_word_size_for_two_typos": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"minWordSizefor2Typos\": 2,\n },\n)", + "override_default_typo_tolerance_mode": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"typoTolerance\": False,\n },\n)", + "disable_typos_on_numeric_tokens_at_search_time": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"allowTyposOnNumericTokens\": False,\n },\n)", + "search_around_a_position": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundLatLng\": \"40.71, -74.01\",\n },\n)", + "search_around_server_ip": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundLatLngViaIP\": True,\n },\n request_options={\n \"headers\": loads(\n \"\"\"{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you would like to search around\"}\"\"\"\n ),\n },\n)", + "set_around_radius": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundRadius\": 1000,\n },\n)", + "disable_automatic_radius": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundRadius\": \"all\",\n },\n)", + "set_geo_search_precision": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundPrecision\": 100,\n },\n)", + "set_geo_search_precision_non_linear": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"aroundPrecision\": [\n {\n \"from\": 0,\n \"value\": 25,\n },\n {\n \"from\": 2000,\n \"value\": 1000,\n },\n ],\n },\n)", + "set_minimum_geo_search_radius": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"minimumAroundRadius\": 1000,\n },\n)", + "search_inside_rectangular_area": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"insideBoundingBox\": [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n ],\n ],\n },\n)", + "search_inside_multiple_rectangular_areas": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"insideBoundingBox\": [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n ],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n ],\n ],\n },\n)", + "search_inside_polygon_area": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"insidePolygon\": [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n ],\n ],\n },\n)", + "search_inside_multiple_polygon_areas": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"insidePolygon\": [\n [\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n ],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625,\n ],\n ],\n },\n)", + "set_querylanguages_override": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"removeStopWords\": [\n \"ca\",\n \"es\",\n ],\n },\n)", + "set_querylanguages_with_japanese_query": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"queryLanguages\": [\n \"ja\",\n \"en\",\n ],\n },\n)", + "set_natural_languages": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"\",\n \"naturalLanguages\": [\n \"fr\",\n ],\n },\n)", + "override_natural_languages_with_query": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"\",\n \"naturalLanguages\": [\n \"fr\",\n ],\n \"removeWordsIfNoResults\": \"firstWords\",\n },\n)", + "enable_decompound_query_search_time": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"decompoundQuery\": True,\n },\n)", + "enable_rules_search_time": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enableRules\": True,\n },\n)", + "set_rule_contexts": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"ruleContexts\": [\n \"front_end\",\n \"website2\",\n ],\n },\n)", + "enable_personalization": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enablePersonalization\": True,\n },\n)", + "enable_personalization_with_user_token": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enablePersonalization\": True,\n \"userToken\": \"123456\",\n },\n)", + "personalization_impact": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"personalizationImpact\": 20,\n },\n)", + "set_user_token": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"userToken\": \"123456\",\n },\n)", + "set_user_token_with_personalization": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enablePersonalization\": True,\n \"userToken\": \"123456\",\n },\n)", + "override_default_query_type": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"queryType\": \"prefixAll\",\n },\n)", + "override_default_remove_words_if_no_results": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"removeWordsIfNoResults\": \"lastWords\",\n },\n)", + "enable_advanced_syntax_search_time": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"advancedSyntax\": True,\n },\n)", + "overide_default_optional_words": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"optionalWords\": [\n \"toyota\",\n \"2020 2021\",\n ],\n },\n)", + "disabling_exact_for_some_attributes_search_time": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"disableExactOnAttributes\": [\n \"description\",\n ],\n },\n)", + "override_default_exact_single_word_query": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"exactOnSingleWordQuery\": \"none\",\n },\n)", + "override_default_aternative_as_exact": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"alternativesAsExact\": [\n \"multiWordsSynonym\",\n ],\n },\n)", + "enable_advanced_syntax_exact_phrase": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"advancedSyntax\": True,\n \"advancedSyntaxFeatures\": [\n \"exactPhrase\",\n ],\n },\n)", + "enable_advanced_syntax_exclude_words": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"advancedSyntax\": True,\n \"advancedSyntaxFeatures\": [\n \"excludeWords\",\n ],\n },\n)", + "override_distinct": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"distinct\": 0,\n },\n)", + "get_ranking_info": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"getRankingInfo\": True,\n },\n)", + "disable_click_analytics": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"clickAnalytics\": False,\n },\n)", + "enable_click_analytics": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"clickAnalytics\": True,\n },\n)", + "disable_analytics": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"analytics\": False,\n },\n)", + "add_analytics_tags": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"analyticsTags\": [\n \"front_end\",\n \"website2\",\n ],\n },\n)", + "disable_synonyms": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"synonyms\": False,\n },\n)", + "override_replace_synonyms_in_highlights": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"replaceSynonymsInHighlight\": True,\n },\n)", + "override_min_proximity": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"minProximity\": 2,\n },\n)", + "override_default_field": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"responseFields\": [\n \"hits\",\n \"facets\",\n ],\n },\n)", + "override_percentile_computation": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"percentileComputation\": False,\n },\n)", + "set_ab_test": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enableABTest\": False,\n },\n)", + "set_enable_re_ranking": "response = client.search_single_index(\n index_name=\"\",\n search_params={\n \"query\": \"query\",\n \"enableReRanking\": False,\n },\n)" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "response = client.search_synonyms(\n index_name=\"\",\n)", @@ -3195,6 +4337,9 @@ "distinct true": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"distinct\": True,\n },\n)", "distinct section": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributeForDistinct\": \"section\",\n \"distinct\": True,\n },\n)", "attributesForFaceting allergens": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"allergens\",\n ],\n },\n)", + "api_attributes_for_faceting": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"genre\",\n \"author\",\n ],\n },\n)", + "api_attributes_for_faceting_searchable": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"genre\",\n \"searchable(author)\",\n ],\n },\n)", + "api_attributes_for_filter_only": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"filterOnly(genre)\",\n \"author\",\n ],\n },\n)", "attributesForFaceting categoryPageId": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"searchable(categoryPageId)\",\n ],\n },\n)", "unretrievableAttributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"unretrievableAttributes\": [\n \"visible_by\",\n ],\n },\n)", "attributesForFaceting user restricted data": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"filterOnly(visible_by)\",\n ],\n },\n)", @@ -3218,6 +4363,7 @@ "customRanking and ranking sort alphabetically": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"customRanking\": [\n \"asc(textual_attribute)\",\n ],\n \"ranking\": [\n \"custom\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n ],\n },\n)", "relevancyStrictness": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"customRanking\": [\n \"asc(textual_attribute)\",\n ],\n \"relevancyStrictness\": 0,\n },\n)", "create replica index": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replicas\": [\n \"products_price_desc\",\n ],\n },\n)", + "create replica index articles": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replicas\": [\n \"articles_date_desc\",\n ],\n },\n)", "create virtual replica index": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replicas\": [\n \"virtual(products_price_desc)\",\n ],\n },\n)", "unlink replica index": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replicas\": [\n \"\",\n ],\n },\n)", "forwardToReplicas": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"name\",\n \"description\",\n ],\n },\n forward_to_replicas=True,\n)", @@ -3227,15 +4373,77 @@ "ranking closest dates": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"ranking\": [\n \"asc(date_timestamp)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n },\n)", "searchableAttributes item variation": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"design\",\n \"type\",\n \"color\",\n ],\n },\n)", "searchableAttributes around location": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"name\",\n \"country\",\n \"code\",\n \"iata_code\",\n ],\n \"customRanking\": [\n \"desc(links_count)\",\n ],\n },\n)", - "disableTypoToleranceOnAttributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disableTypoToleranceOnAttributes\": [\n \"serial_number\",\n ],\n },\n)", + "attributesToHighlight": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToHighlight\": [\n \"author\",\n \"title\",\n \"content\",\n ],\n },\n)", + "attributesToHighlightStar": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToHighlight\": [\n \"*\",\n ],\n },\n)", "everything": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"advancedSyntax\": True,\n \"advancedSyntaxFeatures\": [\n \"exactPhrase\",\n ],\n \"allowCompressionOfIntegerArray\": True,\n \"allowTyposOnNumericTokens\": True,\n \"alternativesAsExact\": [\n \"singleWordSynonym\",\n ],\n \"attributeCriteriaComputedByMinProximity\": True,\n \"attributeForDistinct\": \"test\",\n \"attributesForFaceting\": [\n \"algolia\",\n ],\n \"attributesToHighlight\": [\n \"algolia\",\n ],\n \"attributesToRetrieve\": [\n \"algolia\",\n ],\n \"attributesToSnippet\": [\n \"algolia\",\n ],\n \"attributesToTransliterate\": [\n \"algolia\",\n ],\n \"camelCaseAttributes\": [\n \"algolia\",\n ],\n \"customNormalization\": {\n \"algolia\": {\n \"aloglia\": \"aglolia\",\n },\n },\n \"customRanking\": [\n \"algolia\",\n ],\n \"decompoundQuery\": False,\n \"decompoundedAttributes\": {\n \"algolia\": \"aloglia\",\n },\n \"disableExactOnAttributes\": [\n \"algolia\",\n ],\n \"disablePrefixOnAttributes\": [\n \"algolia\",\n ],\n \"disableTypoToleranceOnAttributes\": [\n \"algolia\",\n ],\n \"disableTypoToleranceOnWords\": [\n \"algolia\",\n ],\n \"distinct\": 3,\n \"enablePersonalization\": True,\n \"enableReRanking\": False,\n \"enableRules\": True,\n \"exactOnSingleWordQuery\": \"attribute\",\n \"highlightPreTag\": \"\",\n \"highlightPostTag\": \"\",\n \"hitsPerPage\": 10,\n \"ignorePlurals\": False,\n \"indexLanguages\": [\n \"fr\",\n ],\n \"keepDiacriticsOnCharacters\": \"abc\",\n \"maxFacetHits\": 20,\n \"maxValuesPerFacet\": 30,\n \"minProximity\": 6,\n \"minWordSizefor1Typo\": 5,\n \"minWordSizefor2Typos\": 11,\n \"mode\": \"neuralSearch\",\n \"numericAttributesForFiltering\": [\n \"algolia\",\n ],\n \"optionalWords\": [\n \"myspace\",\n ],\n \"paginationLimitedTo\": 0,\n \"queryLanguages\": [\n \"fr\",\n ],\n \"queryType\": \"prefixLast\",\n \"ranking\": [\n \"geo\",\n ],\n \"reRankingApplyFilter\": \"mySearch:filters\",\n \"relevancyStrictness\": 10,\n \"removeStopWords\": False,\n \"removeWordsIfNoResults\": \"lastWords\",\n \"renderingContent\": {\n \"facetOrdering\": {\n \"facets\": {\n \"order\": [\n \"a\",\n \"b\",\n ],\n },\n \"values\": {\n \"a\": {\n \"order\": [\n \"b\",\n ],\n \"sortRemainingBy\": \"count\",\n },\n },\n },\n },\n \"replaceSynonymsInHighlight\": True,\n \"replicas\": [\n \"\",\n ],\n \"responseFields\": [\n \"algolia\",\n ],\n \"restrictHighlightAndSnippetArrays\": True,\n \"searchableAttributes\": [\n \"foo\",\n ],\n \"semanticSearch\": {\n \"eventSources\": [\n \"foo\",\n ],\n },\n \"separatorsToIndex\": \"bar\",\n \"snippetEllipsisText\": \"---\",\n \"sortFacetValuesBy\": \"date\",\n \"typoTolerance\": False,\n \"unretrievableAttributes\": [\n \"foo\",\n ],\n \"userData\": {\n \"user\": \"data\",\n },\n },\n)", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"brand\",\n \"name\",\n \"categories\",\n \"unordered(description)\",\n ],\n \"customRanking\": [\n \"desc(popularity)\",\n ],\n \"attributesForFaceting\": [\n \"searchable(brand)\",\n \"type\",\n \"categories\",\n \"price\",\n ],\n },\n)", + "searchableAttributesOrdering": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"unordered(title)\",\n \"cast\",\n ],\n },\n)", "searchableAttributesProductReferenceSuffixes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"name\",\n \"product_reference\",\n \"product_reference_suffixes\",\n ],\n },\n)", "queryLanguageAndIgnorePlurals": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"queryLanguages\": [\n \"en\",\n ],\n \"ignorePlurals\": True,\n },\n)", "searchableAttributesInMovies": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"title_eng\",\n \"title_fr\",\n \"title_es\",\n ],\n },\n)", "disablePrefixOnAttributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disablePrefixOnAttributes\": [\n \"serial_number\",\n ],\n },\n)", + "disableTypoToleranceOnAttributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disableTypoToleranceOnAttributes\": [\n \"serial_number\",\n ],\n },\n)", "searchableAttributesSimpleExample": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"serial_number\",\n ],\n },\n)", - "searchableAttributesSimpleExampleAlt": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"serial_number\",\n \"serial_number_suffixes\",\n ],\n },\n)" + "searchableAttributesSimpleExampleAlt": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"searchableAttributes\": [\n \"serial_number\",\n \"serial_number_suffixes\",\n ],\n },\n)", + "set_searchable_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesForFaceting\": [\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\",\n ],\n },\n)", + "unretrievable_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"unretrievableAttributes\": [\n \"total_number_of_sales\",\n ],\n },\n)", + "set_retrievable_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToRetrieve\": [\n \"author\",\n \"title\",\n \"content\",\n ],\n },\n)", + "set_all_attributes_as_retrievable": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToRetrieve\": [\n \"*\",\n ],\n },\n)", + "specify_attributes_not_to_retrieve": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToRetrieve\": [\n \"*\",\n \"-SKU\",\n \"-internal_desc\",\n ],\n },\n)", + "neural_search": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"mode\": \"neuralSearch\",\n },\n)", + "keyword_search": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"mode\": \"keywordSearch\",\n },\n)", + "set_default_ranking": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"ranking\": [\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"attribute\",\n \"proximity\",\n \"exact\",\n \"custom\",\n ],\n },\n)", + "set_ranking_by_attribute_asc": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"ranking\": [\n \"asc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n },\n)", + "set_ranking_by_attribute_desc": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"ranking\": [\n \"desc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ],\n },\n)", + "restrict_searchable_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"customRanking\": [\n \"desc(popularity)\",\n \"asc(price)\",\n ],\n },\n)", + "set_default_relevancy": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"relevancyStrictness\": 90,\n },\n)", + "set_replicas": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replicas\": [\n \"name_of_replica_index1\",\n \"name_of_replica_index2\",\n ],\n },\n)", + "set_default_max_values_per_facet": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"maxValuesPerFacet\": 100,\n },\n)", + "set_default_sort_facet_values_by": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"sortFacetValuesBy\": \"alpha\",\n },\n)", + "set_attributes_to_snippet": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToSnippet\": [\n \"content:80\",\n \"description\",\n ],\n },\n)", + "set_all_attributes_to_snippet": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributesToSnippet\": [\n \"*:80\",\n ],\n },\n)", + "set_default_highlight_pre_tag": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"highlightPreTag\": \"\",\n },\n)", + "set_default_highlight_post_tag": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"highlightPostTag\": \"\",\n },\n)", + "set_default_snippet_ellipsis_text": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"snippetEllipsisText\": \"…\",\n },\n)", + "enable_restrict_highlight_and_snippet_arrays_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"restrictHighlightAndSnippetArrays\": True,\n },\n)", + "set_default_hits_per_page": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"hitsPerPage\": 20,\n },\n)", + "set_pagination_limit": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"paginationLimitedTo\": 1000,\n },\n)", + "set_default_min_word_size_for_one_typo": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"minWordSizefor1Typo\": 4,\n },\n)", + "set_default_min_word_size_for_two_typos": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"minWordSizefor2Typos\": 4,\n },\n)", + "set_default_typo_tolerance_mode": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"typoTolerance\": True,\n },\n)", + "disable_typos_on_numeric_tokens_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"allowTyposOnNumericTokens\": False,\n },\n)", + "disable_typo_tolerance_for_words": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disableTypoToleranceOnWords\": [\n \"wheel\",\n \"1X2BCD\",\n ],\n },\n)", + "set_separators_to_index": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"separatorsToIndex\": \"+#\",\n },\n)", + "set_languages_using_querylanguages": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"queryLanguages\": [\n \"es\",\n ],\n \"removeStopWords\": True,\n \"ignorePlurals\": True,\n },\n)", + "set_attributes_to_transliterate": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"indexLanguages\": [\n \"ja\",\n ],\n \"attributesToTransliterate\": [\n \"name\",\n \"description\",\n ],\n },\n)", + "set_camel_case_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"camelCaseAttributes\": [\n \"description\",\n ],\n },\n)", + "set_decompounded_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"decompoundedAttributes\": {\n \"de\": [\n \"name\",\n ],\n },\n },\n)", + "set_decompounded_multiple_attributes": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"decompoundedAttributes\": {\n \"de\": [\n \"name_de\",\n \"description_de\",\n ],\n \"fi\": [\n \"name_fi\",\n \"description_fi\",\n ],\n },\n },\n)", + "set_keep_diacritics_on_characters": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"keepDiacriticsOnCharacters\": \"øé\",\n },\n)", + "set_custom_normalization": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"customNormalization\": {\n \"default\": {\n \"ä\": \"ae\",\n },\n },\n },\n)", + "set_indexlanguages": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"indexLanguages\": [\n \"ja\",\n ],\n },\n)", + "enable_decompound_query_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"decompoundQuery\": True,\n },\n)", + "enable_rules_syntax_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"enableRules\": True,\n },\n)", + "enable_personalization_settings": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"enablePersonalization\": True,\n },\n)", + "set_default_query_type": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"queryType\": \"prefixLast\",\n },\n)", + "set_default_remove_words_if_no_result": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"removeWordsIfNoResults\": \"none\",\n },\n)", + "enable_advanced_syntax_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"advancedSyntax\": True,\n },\n)", + "set_default_optional_words": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"optionalWords\": [\n \"blue\",\n \"iphone case\",\n ],\n },\n)", + "disabling_prefix_search_for_some_attributes_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disablePrefixOnAttributes\": [\n \"sku\",\n ],\n },\n)", + "disabling_exact_for_some_attributes_by_default": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"disableExactOnAttributes\": [\n \"description\",\n ],\n },\n)", + "set_default_exact_single_word_query": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"exactOnSingleWordQuery\": \"attribute\",\n },\n)", + "set_default_aternative_as_exact": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"alternativesAsExact\": [\n \"ignorePlurals\",\n \"singleWordSynonym\",\n ],\n },\n)", + "set_numeric_attributes_for_filtering": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"numericAttributesForFiltering\": [\n \"quantity\",\n \"popularity\",\n ],\n },\n)", + "enable_compression_of_integer_array": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"allowCompressionOfIntegerArray\": True,\n },\n)", + "set_attributes_for_distinct": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributeForDistinct\": \"url\",\n },\n)", + "set_distinct": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"distinct\": 1,\n \"attributeForDistinct\": \"url\",\n },\n)", + "set_replace_synonyms_in_highlights": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"replaceSynonymsInHighlight\": False,\n },\n)", + "set_min_proximity": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"minProximity\": 1,\n },\n)", + "set_default_field": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"responseFields\": [\n \"hits\",\n \"hitsPerPage\",\n \"nbPages\",\n \"page\",\n ],\n },\n)", + "set_max_facet_hits": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"maxFacetHits\": 10,\n },\n)", + "set_attribute_criteria_computed_by_min_proximity": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"attributeCriteriaComputedByMinProximity\": True,\n },\n)", + "set_user_data": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"userData\": {\n \"extraData\": \"This is the custom data that you want to store in your index\",\n },\n },\n)", + "set_rendering_content": "response = client.set_settings(\n index_name=\"\",\n index_settings={\n \"renderingContent\": {\n \"facetOrdering\": {\n \"facets\": {\n \"order\": [\n \"size\",\n \"brand\",\n ],\n },\n \"values\": {\n \"brand\": {\n \"order\": [\n \"uniqlo\",\n ],\n \"hide\": [\n \"muji\",\n ],\n \"sortRemainingBy\": \"count\",\n },\n \"size\": {\n \"order\": [\n \"S\",\n \"M\",\n \"L\",\n ],\n \"sortRemainingBy\": \"hidden\",\n },\n },\n },\n },\n },\n)" }, "updateApiKey": { "default": "response = client.update_api_key(\n key=\"ALGOLIA_API_KEY\",\n api_key={\n \"acl\": [\n \"search\",\n \"addObject\",\n ],\n \"validity\": 300,\n \"maxQueriesPerIPPerHour\": 100,\n \"maxHitsPerQuery\": 20,\n },\n)" @@ -3550,6 +4758,10 @@ "filtersStephenKing": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(filters: \"author:\\\"Stephen King\\\"\")\n)", "filtersNotTags": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(filters: \"NOT _tags:non-fiction\")\n)", "facetFiltersList": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n facet_filters: [\"publisher:Penguin\", [\"author:Stephen King\", \"genre:Horror\"]]\n )\n)", + "facetFiltersBook": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", facet_filters: [\"category:Book\"])\n)", + "facetFiltersAND": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", facet_filters: [\"category:Book\", \"author:John Doe\"])\n)", + "facetFiltersOR": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", facet_filters: [[\"category:Book\", \"author:John Doe\"]])\n)", + "facetFiltersCombined": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n facet_filters: [\"author:John Doe\", [\"category:Book\", \"category:Movie\"]]\n )\n)", "facetFiltersNeg": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(facet_filters: \"category:-Ebook\")\n)", "filtersAndFacetFilters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n filters: \"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\",\n facet_filters: [\"publisher:Penguin\"]\n )\n)", "facet author genre": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(facets: [\"author\", \"genre\"])\n)", @@ -3569,9 +4781,90 @@ "clickAnalyticsUserToken": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(click_analytics: true, user_token: \"user-1\")\n)", "enablePersonalization": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(enable_personalization: true, user_token: \"user-1\")\n)", "userToken": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(user_token: \"user-1\")\n)", + "userToken1234": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", user_token: \"user-1234\")\n)", "analyticsTag": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(analytics_tags: [\"YOUR_ANALYTICS_TAG\"])\n)", "facetFiltersUsers": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(facet_filters: [\"user:user42\", \"user:public\"])\n)", - "buildTheQuery": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n filters: \"categoryPageId: Men's Clothing\",\n hits_per_page: 50,\n analytics_tags: [\"mens-clothing\"]\n )\n)" + "buildTheQuery": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n filters: \"categoryPageId: Men's Clothing\",\n hits_per_page: 50,\n analytics_tags: [\"mens-clothing\"]\n )\n)", + "attributesToHighlightOverride": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", attributes_to_highlight: [\"title\", \"content\"])\n)", + "disableTypoToleranceOnAttributes": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", disable_typo_tolerance_on_attributes: [\"serial_number\"])\n)", + "search_a_query": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"\",\n similar_query: \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n filters: \"year:1991 TO 2001\"\n )\n)", + "search_everything": "response = client.search_single_index(\"\", Algolia::Search::SearchParamsObject.new(query: \"\"))", + "api_filtering_range_example": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"books\", filters: \"price:10 TO 20\")\n)", + "override_retrievable_attributes": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", attributes_to_retrieve: [\"title\", \"content\"])\n)", + "restrict_searchable_attributes": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", restrict_searchable_attributes: [\"title\", \"author\"])\n)", + "override_default_relevancy": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", relevancy_strictness: 70)\n)", + "apply_filters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", sum_or_filters_scores: true)\n)", + "apply_all_filters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n 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\\\"\"\n )\n)", + "escape_spaces": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", filters: \"category:\\\"Books and Comics\\\"\")\n)", + "escape_keywords": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", filters: \"keyword:\\\"OR\\\"\")\n)", + "escape_single_quotes": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", filters: \"content:\\\"It's a wonderful day\\\"\")\n)", + "escape_double_quotes": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", filters: \"content:\\\"She said \\\"Hello World\\\"\")\n)", + "apply_negative_filters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", optional_filters: [\"category:Book\", \"author:-John Doe\"])\n)", + "apply_numeric_filters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n numeric_filters: [\"price < 1000\", [\"inStock = 1\", \"deliveryDate < 1441755506\"]]\n )\n)", + "apply_tag_filters": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", tag_filters: [\"SciFi\", [\"Book\", \"Movie\"]])\n)", + "facets_all": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", facets: [\"*\"])\n)", + "retrieve_only_some_facets": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", facets: [\"category\", \"author\"])\n)", + "override_default_max_values_per_facet": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", max_values_per_facet: 20)\n)", + "enable_faceting_after_distinct": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", faceting_after_distinct: true)\n)", + "sort_facet_values_alphabetically": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", sort_facet_values_by: \"count\")\n)", + "override_attributes_to_snippet": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", attributes_to_snippet: [\"title\", \"content:80\"])\n)", + "override_default_highlight_pre_tag": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", highlight_pre_tag: \"\")\n)", + "override_default_highlight_post_tag": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", highlight_post_tag: \"\")\n)", + "override_default_snippet_ellipsis_text": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", snippet_ellipsis_text: \"\")\n)", + "enable_restrict_highlight_and_snippet_arrays": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", restrict_highlight_and_snippet_arrays: false)\n)", + "access_page": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", page: 0)\n)", + "override_default_hits_per_page": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", hits_per_page: 10)\n)", + "get_nth_hit": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", offset: 4)\n)", + "get_n_results": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", length: 4)\n)", + "override_default_min_word_size_for_one_typo": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", min_word_sizefor1_typo: 2)\n)", + "override_default_min_word_size_for_two_typos": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", min_word_sizefor2_typos: 2)\n)", + "override_default_typo_tolerance_mode": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", typo_tolerance: false)\n)", + "disable_typos_on_numeric_tokens_at_search_time": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", allow_typos_on_numeric_tokens: false)\n)", + "search_around_a_position": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", around_lat_lng: \"40.71, -74.01\")\n)", + "search_around_server_ip": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", around_lat_lng_via_ip: true),\n {\n :header_params => JSON.parse(\n \"{\\\"x-forwarded-for\\\":\\\"94.228.178.246 // should be replaced with the actual IP you would like to search around\\\"}\",\n :symbolize_names => true\n )\n }\n)", + "set_around_radius": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", around_radius: 1000)\n)", + "disable_automatic_radius": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", around_radius: \"all\")\n)", + "set_geo_search_precision": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", around_precision: 100)\n)", + "set_geo_search_precision_non_linear": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n around_precision: [\n Algolia::Search::Range.new(from: 0, value: 25),\n Algolia::Search::Range.new(from: 2000, value: 1000)\n ]\n )\n)", + "set_minimum_geo_search_radius": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", minimum_around_radius: 1000)\n)", + "search_inside_rectangular_area": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n inside_bounding_box: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]]\n )\n)", + "search_inside_multiple_rectangular_areas": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n inside_bounding_box: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625],\n [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875]\n ]\n )\n)", + "search_inside_polygon_area": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n inside_polygon: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625]\n ]\n )\n)", + "search_inside_multiple_polygon_areas": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n inside_polygon: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625\n ]\n ]\n )\n)", + "set_querylanguages_override": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", remove_stop_words: [\"ca\", \"es\"])\n)", + "set_querylanguages_with_japanese_query": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", query_languages: [\"ja\", \"en\"])\n)", + "set_natural_languages": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"\", natural_languages: [\"fr\"])\n)", + "override_natural_languages_with_query": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"\",\n natural_languages: [\"fr\"],\n remove_words_if_no_results: \"firstWords\"\n )\n)", + "enable_decompound_query_search_time": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", decompound_query: true)\n)", + "enable_rules_search_time": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_rules: true)\n)", + "set_rule_contexts": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", rule_contexts: [\"front_end\", \"website2\"])\n)", + "enable_personalization": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_personalization: true)\n)", + "enable_personalization_with_user_token": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_personalization: true, user_token: \"123456\")\n)", + "personalization_impact": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", personalization_impact: 20)\n)", + "set_user_token": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", user_token: \"123456\")\n)", + "set_user_token_with_personalization": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_personalization: true, user_token: \"123456\")\n)", + "override_default_query_type": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", query_type: \"prefixAll\")\n)", + "override_default_remove_words_if_no_results": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", remove_words_if_no_results: \"lastWords\")\n)", + "enable_advanced_syntax_search_time": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", advanced_syntax: true)\n)", + "overide_default_optional_words": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", optional_words: [\"toyota\", \"2020 2021\"])\n)", + "disabling_exact_for_some_attributes_search_time": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", disable_exact_on_attributes: [\"description\"])\n)", + "override_default_exact_single_word_query": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", exact_on_single_word_query: \"none\")\n)", + "override_default_aternative_as_exact": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", alternatives_as_exact: [\"multiWordsSynonym\"])\n)", + "enable_advanced_syntax_exact_phrase": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n advanced_syntax: true,\n advanced_syntax_features: [\"exactPhrase\"]\n )\n)", + "enable_advanced_syntax_exclude_words": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(\n query: \"query\",\n advanced_syntax: true,\n advanced_syntax_features: [\"excludeWords\"]\n )\n)", + "override_distinct": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", distinct: 0)\n)", + "get_ranking_info": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", get_ranking_info: true)\n)", + "disable_click_analytics": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", click_analytics: false)\n)", + "enable_click_analytics": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", click_analytics: true)\n)", + "disable_analytics": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", analytics: false)\n)", + "add_analytics_tags": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", analytics_tags: [\"front_end\", \"website2\"])\n)", + "disable_synonyms": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", synonyms: false)\n)", + "override_replace_synonyms_in_highlights": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", replace_synonyms_in_highlight: true)\n)", + "override_min_proximity": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", min_proximity: 2)\n)", + "override_default_field": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", response_fields: [\"hits\", \"facets\"])\n)", + "override_percentile_computation": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", percentile_computation: false)\n)", + "set_ab_test": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_ab_test: false)\n)", + "set_enable_re_ranking": "response = client.search_single_index(\n \"\",\n Algolia::Search::SearchParamsObject.new(query: \"query\", enable_re_ranking: false)\n)" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "response = client.search_synonyms(\"\")", @@ -3602,6 +4895,9 @@ "distinct true": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(distinct: true))", "distinct section": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attribute_for_distinct: \"section\", distinct: true)\n)", "attributesForFaceting allergens": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"allergens\"])\n)", + "api_attributes_for_faceting": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"genre\", \"author\"])\n)", + "api_attributes_for_faceting_searchable": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"genre\", \"searchable(author)\"])\n)", + "api_attributes_for_filter_only": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"filterOnly(genre)\", \"author\"])\n)", "attributesForFaceting categoryPageId": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"searchable(categoryPageId)\"])\n)", "unretrievableAttributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(unretrievable_attributes: [\"visible_by\"])\n)", "attributesForFaceting user restricted data": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_for_faceting: [\"filterOnly(visible_by)\"])\n)", @@ -3625,6 +4921,7 @@ "customRanking and ranking sort alphabetically": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n custom_ranking: [\"asc(textual_attribute)\"],\n ranking: [\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"]\n )\n)", "relevancyStrictness": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(custom_ranking: [\"asc(textual_attribute)\"], relevancy_strictness: 0)\n)", "create replica index": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(replicas: [\"products_price_desc\"])\n)", + "create replica index articles": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(replicas: [\"articles_date_desc\"])\n)", "create virtual replica index": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(replicas: [\"virtual(products_price_desc)\"])\n)", "unlink replica index": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(replicas: [\"\"]))", "forwardToReplicas": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"name\", \"description\"]),\n true\n)", @@ -3634,15 +4931,77 @@ "ranking closest dates": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n ranking: [\"asc(date_timestamp)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"]\n )\n)", "searchableAttributes item variation": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"design\", \"type\", \"color\"])\n)", "searchableAttributes around location": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n searchable_attributes: [\"name\", \"country\", \"code\", \"iata_code\"],\n custom_ranking: [\"desc(links_count)\"]\n )\n)", - "disableTypoToleranceOnAttributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: [\"serial_number\"])\n)", + "attributesToHighlight": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_highlight: [\"author\", \"title\", \"content\"])\n)", + "attributesToHighlightStar": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_highlight: [\"*\"])\n)", "everything": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n advanced_syntax: true,\n advanced_syntax_features: [\"exactPhrase\"],\n allow_compression_of_integer_array: true,\n allow_typos_on_numeric_tokens: true,\n alternatives_as_exact: [\"singleWordSynonym\"],\n attribute_criteria_computed_by_min_proximity: true,\n attribute_for_distinct: \"test\",\n attributes_for_faceting: [\"algolia\"],\n attributes_to_highlight: [\"algolia\"],\n attributes_to_retrieve: [\"algolia\"],\n attributes_to_snippet: [\"algolia\"],\n attributes_to_transliterate: [\"algolia\"],\n camel_case_attributes: [\"algolia\"],\n custom_normalization: {algolia: {aloglia: \"aglolia\"}},\n custom_ranking: [\"algolia\"],\n decompound_query: false,\n decompounded_attributes: {algolia: \"aloglia\"},\n disable_exact_on_attributes: [\"algolia\"],\n disable_prefix_on_attributes: [\"algolia\"],\n disable_typo_tolerance_on_attributes: [\"algolia\"],\n disable_typo_tolerance_on_words: [\"algolia\"],\n distinct: 3,\n enable_personalization: true,\n enable_re_ranking: false,\n enable_rules: true,\n exact_on_single_word_query: \"attribute\",\n highlight_pre_tag: \"\",\n highlight_post_tag: \"\",\n hits_per_page: 10,\n ignore_plurals: false,\n index_languages: [\"fr\"],\n keep_diacritics_on_characters: \"abc\",\n max_facet_hits: 20,\n max_values_per_facet: 30,\n min_proximity: 6,\n min_word_sizefor1_typo: 5,\n min_word_sizefor2_typos: 11,\n mode: \"neuralSearch\",\n numeric_attributes_for_filtering: [\"algolia\"],\n optional_words: [\"myspace\"],\n pagination_limited_to: 0,\n query_languages: [\"fr\"],\n query_type: \"prefixLast\",\n ranking: [\"geo\"],\n re_ranking_apply_filter: \"mySearch:filters\",\n relevancy_strictness: 10,\n remove_stop_words: false,\n remove_words_if_no_results: \"lastWords\",\n rendering_content: Algolia::Search::RenderingContent.new(\n facet_ordering: Algolia::Search::FacetOrdering.new(\n facets: Algolia::Search::Facets.new(order: [\"a\", \"b\"]),\n values: {a: Algolia::Search::Value.new(order: [\"b\"], sort_remaining_by: \"count\")}\n )\n ),\n replace_synonyms_in_highlight: true,\n replicas: [\"\"],\n response_fields: [\"algolia\"],\n restrict_highlight_and_snippet_arrays: true,\n searchable_attributes: [\"foo\"],\n semantic_search: Algolia::Search::SemanticSearch.new(event_sources: [\"foo\"]),\n separators_to_index: \"bar\",\n snippet_ellipsis_text: \"---\",\n sort_facet_values_by: \"date\",\n typo_tolerance: false,\n unretrievable_attributes: [\"foo\"],\n user_data: {user: \"data\"}\n )\n)", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n searchable_attributes: [\"brand\", \"name\", \"categories\", \"unordered(description)\"],\n custom_ranking: [\"desc(popularity)\"],\n attributes_for_faceting: [\"searchable(brand)\", \"type\", \"categories\", \"price\"]\n )\n)", + "searchableAttributesOrdering": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"unordered(title)\", \"cast\"])\n)", "searchableAttributesProductReferenceSuffixes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n searchable_attributes: [\"name\", \"product_reference\", \"product_reference_suffixes\"]\n )\n)", "queryLanguageAndIgnorePlurals": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(query_languages: [\"en\"], ignore_plurals: true)\n)", "searchableAttributesInMovies": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"title_eng\", \"title_fr\", \"title_es\"])\n)", "disablePrefixOnAttributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: [\"serial_number\"])\n)", + "disableTypoToleranceOnAttributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: [\"serial_number\"])\n)", "searchableAttributesSimpleExample": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"serial_number\"])\n)", - "searchableAttributesSimpleExampleAlt": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"serial_number\", \"serial_number_suffixes\"])\n)" + "searchableAttributesSimpleExampleAlt": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(searchable_attributes: [\"serial_number\", \"serial_number_suffixes\"])\n)", + "set_searchable_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n attributes_for_faceting: [\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\"\n ]\n )\n)", + "unretrievable_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(unretrievable_attributes: [\"total_number_of_sales\"])\n)", + "set_retrievable_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_retrieve: [\"author\", \"title\", \"content\"])\n)", + "set_all_attributes_as_retrievable": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(attributes_to_retrieve: [\"*\"]))", + "specify_attributes_not_to_retrieve": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_retrieve: [\"*\", \"-SKU\", \"-internal_desc\"])\n)", + "neural_search": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(mode: \"neuralSearch\"))", + "keyword_search": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(mode: \"keywordSearch\"))", + "set_default_ranking": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n ranking: [\"typo\", \"geo\", \"words\", \"filters\", \"attribute\", \"proximity\", \"exact\", \"custom\"]\n )\n)", + "set_ranking_by_attribute_asc": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n ranking: [\"asc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"]\n )\n)", + "set_ranking_by_attribute_desc": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n ranking: [\"desc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"]\n )\n)", + "restrict_searchable_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(custom_ranking: [\"desc(popularity)\", \"asc(price)\"])\n)", + "set_default_relevancy": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(relevancy_strictness: 90))", + "set_replicas": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(replicas: [\"name_of_replica_index1\", \"name_of_replica_index2\"])\n)", + "set_default_max_values_per_facet": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(max_values_per_facet: 100))", + "set_default_sort_facet_values_by": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(sort_facet_values_by: \"alpha\"))", + "set_attributes_to_snippet": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_snippet: [\"content:80\", \"description\"])\n)", + "set_all_attributes_to_snippet": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attributes_to_snippet: [\"*:80\"])\n)", + "set_default_highlight_pre_tag": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(highlight_pre_tag: \"\"))", + "set_default_highlight_post_tag": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(highlight_post_tag: \"\"))", + "set_default_snippet_ellipsis_text": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(snippet_ellipsis_text: \"…\"))", + "enable_restrict_highlight_and_snippet_arrays_by_default": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(restrict_highlight_and_snippet_arrays: true)\n)", + "set_default_hits_per_page": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(hits_per_page: 20))", + "set_pagination_limit": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(pagination_limited_to: 1000))", + "set_default_min_word_size_for_one_typo": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(min_word_sizefor1_typo: 4))", + "set_default_min_word_size_for_two_typos": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(min_word_sizefor2_typos: 4))", + "set_default_typo_tolerance_mode": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(typo_tolerance: true))", + "disable_typos_on_numeric_tokens_by_default": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(allow_typos_on_numeric_tokens: false)\n)", + "disable_typo_tolerance_for_words": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_words: [\"wheel\", \"1X2BCD\"])\n)", + "set_separators_to_index": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(separators_to_index: \"+#\"))", + "set_languages_using_querylanguages": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(query_languages: [\"es\"], remove_stop_words: true, ignore_plurals: true)\n)", + "set_attributes_to_transliterate": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(index_languages: [\"ja\"], attributes_to_transliterate: [\"name\", \"description\"])\n)", + "set_camel_case_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(camel_case_attributes: [\"description\"])\n)", + "set_decompounded_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(decompounded_attributes: {de: [\"name\"]})\n)", + "set_decompounded_multiple_attributes": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n decompounded_attributes: {de: [\"name_de\", \"description_de\"], fi: [\"name_fi\", \"description_fi\"]}\n )\n)", + "set_keep_diacritics_on_characters": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(keep_diacritics_on_characters: \"øé\")\n)", + "set_custom_normalization": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(custom_normalization: {default: {ä: \"ae\"}})\n)", + "set_indexlanguages": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(index_languages: [\"ja\"]))", + "enable_decompound_query_by_default": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(decompound_query: true))", + "enable_rules_syntax_by_default": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(enable_rules: true))", + "enable_personalization_settings": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(enable_personalization: true))", + "set_default_query_type": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(query_type: \"prefixLast\"))", + "set_default_remove_words_if_no_result": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(remove_words_if_no_results: \"none\")\n)", + "enable_advanced_syntax_by_default": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(advanced_syntax: true))", + "set_default_optional_words": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(optional_words: [\"blue\", \"iphone case\"])\n)", + "disabling_prefix_search_for_some_attributes_by_default": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: [\"sku\"])\n)", + "disabling_exact_for_some_attributes_by_default": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(disable_exact_on_attributes: [\"description\"])\n)", + "set_default_exact_single_word_query": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(exact_on_single_word_query: \"attribute\")\n)", + "set_default_aternative_as_exact": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(alternatives_as_exact: [\"ignorePlurals\", \"singleWordSynonym\"])\n)", + "set_numeric_attributes_for_filtering": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(numeric_attributes_for_filtering: [\"quantity\", \"popularity\"])\n)", + "enable_compression_of_integer_array": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(allow_compression_of_integer_array: true)\n)", + "set_attributes_for_distinct": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(attribute_for_distinct: \"url\"))", + "set_distinct": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(distinct: 1, attribute_for_distinct: \"url\")\n)", + "set_replace_synonyms_in_highlights": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(replace_synonyms_in_highlight: false)\n)", + "set_min_proximity": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(min_proximity: 1))", + "set_default_field": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(response_fields: [\"hits\", \"hitsPerPage\", \"nbPages\", \"page\"])\n)", + "set_max_facet_hits": "response = client.set_settings(\"\", Algolia::Search::IndexSettings.new(max_facet_hits: 10))", + "set_attribute_criteria_computed_by_min_proximity": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(attribute_criteria_computed_by_min_proximity: true)\n)", + "set_user_data": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n user_data: {extraData: \"This is the custom data that you want to store in your index\"}\n )\n)", + "set_rendering_content": "response = client.set_settings(\n \"\",\n Algolia::Search::IndexSettings.new(\n rendering_content: Algolia::Search::RenderingContent.new(\n facet_ordering: Algolia::Search::FacetOrdering.new(\n facets: Algolia::Search::Facets.new(order: [\"size\", \"brand\"]),\n values: {\n brand: Algolia::Search::Value.new(order: [\"uniqlo\"], hide: [\"muji\"], sort_remaining_by: \"count\"),\n size: Algolia::Search::Value.new(order: [\"S\", \"M\", \"L\"], sort_remaining_by: \"hidden\")\n }\n )\n )\n )\n)" }, "updateApiKey": { "default": "response = client.update_api_key(\n \"ALGOLIA_API_KEY\",\n Algolia::Search::ApiKey.new(\n acl: [\"search\", \"addObject\"],\n validity: 300,\n max_queries_per_ip_per_hour: 100,\n max_hits_per_query: 20\n )\n)" @@ -3927,6 +5286,10 @@ "filtersStephenKing": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n filters = Some(\"author:\\\"Stephen King\\\"\")\n )\n )\n)", "filtersNotTags": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n filters = Some(\"NOT _tags:non-fiction\")\n )\n )\n)", "facetFiltersList": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n facetFilters = Some(\n FacetFilters(\n Seq(\n FacetFilters(\"publisher:Penguin\"),\n FacetFilters(Seq(FacetFilters(\"author:Stephen King\"), FacetFilters(\"genre:Horror\")))\n )\n )\n )\n )\n )\n)", + "facetFiltersBook": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facetFilters = Some(FacetFilters(Seq(FacetFilters(\"category:Book\"))))\n )\n )\n)", + "facetFiltersAND": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facetFilters = Some(FacetFilters(Seq(FacetFilters(\"category:Book\"), FacetFilters(\"author:John Doe\"))))\n )\n )\n)", + "facetFiltersOR": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facetFilters =\n Some(FacetFilters(Seq(FacetFilters(Seq(FacetFilters(\"category:Book\"), FacetFilters(\"author:John Doe\"))))))\n )\n )\n)", + "facetFiltersCombined": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facetFilters = Some(\n FacetFilters(\n Seq(\n FacetFilters(\"author:John Doe\"),\n FacetFilters(Seq(FacetFilters(\"category:Book\"), FacetFilters(\"category:Movie\")))\n )\n )\n )\n )\n )\n)", "facetFiltersNeg": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n facetFilters = Some(FacetFilters(\"category:-Ebook\"))\n )\n )\n)", "filtersAndFacetFilters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n filters = Some(\"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\"),\n facetFilters = Some(FacetFilters(Seq(FacetFilters(\"publisher:Penguin\"))))\n )\n )\n)", "facet author genre": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n facets = Some(Seq(\"author\", \"genre\"))\n )\n )\n)", @@ -3946,9 +5309,90 @@ "clickAnalyticsUserToken": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n clickAnalytics = Some(true),\n userToken = Some(\"user-1\")\n )\n )\n)", "enablePersonalization": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n enablePersonalization = Some(true),\n userToken = Some(\"user-1\")\n )\n )\n)", "userToken": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n userToken = Some(\"user-1\")\n )\n )\n)", + "userToken1234": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n userToken = Some(\"user-1234\")\n )\n )\n)", "analyticsTag": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n analyticsTags = Some(Seq(\"YOUR_ANALYTICS_TAG\"))\n )\n )\n)", "facetFiltersUsers": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n facetFilters = Some(FacetFilters(Seq(FacetFilters(\"user:user42\"), FacetFilters(\"user:public\"))))\n )\n )\n)", - "buildTheQuery": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n filters = Some(\"categoryPageId: Men's Clothing\"),\n hitsPerPage = Some(50),\n analyticsTags = Some(Seq(\"mens-clothing\"))\n )\n )\n)" + "buildTheQuery": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n filters = Some(\"categoryPageId: Men's Clothing\"),\n hitsPerPage = Some(50),\n analyticsTags = Some(Seq(\"mens-clothing\"))\n )\n )\n)", + "attributesToHighlightOverride": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n attributesToHighlight = Some(Seq(\"title\", \"content\"))\n )\n )\n)", + "disableTypoToleranceOnAttributes": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n disableTypoToleranceOnAttributes = Some(Seq(\"serial_number\"))\n )\n )\n)", + "search_a_query": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"\"),\n similarQuery = Some(\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\"),\n filters = Some(\"year:1991 TO 2001\")\n )\n )\n)", + "search_everything": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"\")\n )\n )\n)", + "api_filtering_range_example": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"books\"),\n filters = Some(\"price:10 TO 20\")\n )\n )\n)", + "override_retrievable_attributes": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n attributesToRetrieve = Some(Seq(\"title\", \"content\"))\n )\n )\n)", + "restrict_searchable_attributes": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n restrictSearchableAttributes = Some(Seq(\"title\", \"author\"))\n )\n )\n)", + "override_default_relevancy": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n relevancyStrictness = Some(70)\n )\n )\n)", + "apply_filters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n sumOrFiltersScores = Some(true)\n )\n )\n)", + "apply_all_filters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n filters = Some(\n \"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\\\"\"\n )\n )\n )\n)", + "escape_spaces": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n filters = Some(\"category:\\\"Books and Comics\\\"\")\n )\n )\n)", + "escape_keywords": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n filters = Some(\"keyword:\\\"OR\\\"\")\n )\n )\n)", + "escape_single_quotes": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n filters = Some(\"content:\\\"It's a wonderful day\\\"\")\n )\n )\n)", + "escape_double_quotes": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n filters = Some(\"content:\\\"She said \\\"Hello World\\\"\")\n )\n )\n)", + "apply_negative_filters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n optionalFilters =\n Some(OptionalFilters(Seq(OptionalFilters(\"category:Book\"), OptionalFilters(\"author:-John Doe\"))))\n )\n )\n)", + "apply_numeric_filters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n numericFilters = Some(\n NumericFilters(\n Seq(\n NumericFilters(\"price < 1000\"),\n NumericFilters(Seq(NumericFilters(\"inStock = 1\"), NumericFilters(\"deliveryDate < 1441755506\")))\n )\n )\n )\n )\n )\n)", + "apply_tag_filters": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n tagFilters =\n Some(TagFilters(Seq(TagFilters(\"SciFi\"), TagFilters(Seq(TagFilters(\"Book\"), TagFilters(\"Movie\"))))))\n )\n )\n)", + "facets_all": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facets = Some(Seq(\"*\"))\n )\n )\n)", + "retrieve_only_some_facets": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facets = Some(Seq(\"category\", \"author\"))\n )\n )\n)", + "override_default_max_values_per_facet": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n maxValuesPerFacet = Some(20)\n )\n )\n)", + "enable_faceting_after_distinct": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n facetingAfterDistinct = Some(true)\n )\n )\n)", + "sort_facet_values_alphabetically": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n sortFacetValuesBy = Some(\"count\")\n )\n )\n)", + "override_attributes_to_snippet": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n attributesToSnippet = Some(Seq(\"title\", \"content:80\"))\n )\n )\n)", + "override_default_highlight_pre_tag": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n highlightPreTag = Some(\"\")\n )\n )\n)", + "override_default_highlight_post_tag": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n highlightPostTag = Some(\"\")\n )\n )\n)", + "override_default_snippet_ellipsis_text": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n snippetEllipsisText = Some(\"\")\n )\n )\n)", + "enable_restrict_highlight_and_snippet_arrays": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n restrictHighlightAndSnippetArrays = Some(false)\n )\n )\n)", + "access_page": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n page = Some(0)\n )\n )\n)", + "override_default_hits_per_page": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n hitsPerPage = Some(10)\n )\n )\n)", + "get_nth_hit": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n offset = Some(4)\n )\n )\n)", + "get_n_results": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n length = Some(4)\n )\n )\n)", + "override_default_min_word_size_for_one_typo": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n minWordSizefor1Typo = Some(2)\n )\n )\n)", + "override_default_min_word_size_for_two_typos": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n minWordSizefor2Typos = Some(2)\n )\n )\n)", + "override_default_typo_tolerance_mode": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n typoTolerance = Some(TypoTolerance(false))\n )\n )\n)", + "disable_typos_on_numeric_tokens_at_search_time": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n allowTyposOnNumericTokens = Some(false)\n )\n )\n)", + "search_around_a_position": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundLatLng = Some(\"40.71, -74.01\")\n )\n )\n)", + "search_around_server_ip": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundLatLngViaIP = Some(true)\n )\n ),\n requestOptions = Some(\n RequestOptions\n .builder()\n .withHeader(\n \"x-forwarded-for\",\n \"94.228.178.246 // should be replaced with the actual IP you would like to search around\"\n )\n .build()\n )\n)", + "set_around_radius": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundRadius = Some(AroundRadius(1000))\n )\n )\n)", + "disable_automatic_radius": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundRadius = Some(AroundRadiusAll.withName(\"all\"))\n )\n )\n)", + "set_geo_search_precision": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundPrecision = Some(AroundPrecision(100))\n )\n )\n)", + "set_geo_search_precision_non_linear": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n aroundPrecision = Some(\n AroundPrecision(\n Seq(\n Range(\n from = Some(0),\n value = Some(25)\n ),\n Range(\n from = Some(2000),\n value = Some(1000)\n )\n )\n )\n )\n )\n )\n)", + "set_minimum_geo_search_radius": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n minimumAroundRadius = Some(1000)\n )\n )\n)", + "search_inside_rectangular_area": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n insideBoundingBox =\n Some(InsideBoundingBox(Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))))\n )\n )\n)", + "search_inside_multiple_rectangular_areas": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n insideBoundingBox = Some(\n InsideBoundingBox(\n Seq(\n Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625),\n Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875)\n )\n )\n )\n )\n )\n)", + "search_inside_polygon_area": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n insidePolygon = Some(\n Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625))\n )\n )\n )\n)", + "search_inside_multiple_polygon_areas": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n insidePolygon = Some(\n Seq(\n Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625),\n Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625,\n 50.62626704081, 4.6181640625)\n )\n )\n )\n )\n)", + "set_querylanguages_override": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n removeStopWords =\n Some(RemoveStopWords(Seq(SupportedLanguage.withName(\"ca\"), SupportedLanguage.withName(\"es\"))))\n )\n )\n)", + "set_querylanguages_with_japanese_query": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n queryLanguages = Some(Seq(SupportedLanguage.withName(\"ja\"), SupportedLanguage.withName(\"en\")))\n )\n )\n)", + "set_natural_languages": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"\"),\n naturalLanguages = Some(Seq(SupportedLanguage.withName(\"fr\")))\n )\n )\n)", + "override_natural_languages_with_query": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"\"),\n naturalLanguages = Some(Seq(SupportedLanguage.withName(\"fr\"))),\n removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName(\"firstWords\"))\n )\n )\n)", + "enable_decompound_query_search_time": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n decompoundQuery = Some(true)\n )\n )\n)", + "enable_rules_search_time": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enableRules = Some(true)\n )\n )\n)", + "set_rule_contexts": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n ruleContexts = Some(Seq(\"front_end\", \"website2\"))\n )\n )\n)", + "enable_personalization": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enablePersonalization = Some(true)\n )\n )\n)", + "enable_personalization_with_user_token": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enablePersonalization = Some(true),\n userToken = Some(\"123456\")\n )\n )\n)", + "personalization_impact": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n personalizationImpact = Some(20)\n )\n )\n)", + "set_user_token": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n userToken = Some(\"123456\")\n )\n )\n)", + "set_user_token_with_personalization": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enablePersonalization = Some(true),\n userToken = Some(\"123456\")\n )\n )\n)", + "override_default_query_type": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n queryType = Some(QueryType.withName(\"prefixAll\"))\n )\n )\n)", + "override_default_remove_words_if_no_results": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName(\"lastWords\"))\n )\n )\n)", + "enable_advanced_syntax_search_time": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n advancedSyntax = Some(true)\n )\n )\n)", + "overide_default_optional_words": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n optionalWords = Some(OptionalWords(Seq(\"toyota\", \"2020 2021\")))\n )\n )\n)", + "disabling_exact_for_some_attributes_search_time": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n disableExactOnAttributes = Some(Seq(\"description\"))\n )\n )\n)", + "override_default_exact_single_word_query": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName(\"none\"))\n )\n )\n)", + "override_default_aternative_as_exact": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n alternativesAsExact = Some(Seq(AlternativesAsExact.withName(\"multiWordsSynonym\")))\n )\n )\n)", + "enable_advanced_syntax_exact_phrase": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n advancedSyntax = Some(true),\n advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName(\"exactPhrase\")))\n )\n )\n)", + "enable_advanced_syntax_exclude_words": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n advancedSyntax = Some(true),\n advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName(\"excludeWords\")))\n )\n )\n)", + "override_distinct": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n distinct = Some(Distinct(0))\n )\n )\n)", + "get_ranking_info": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n getRankingInfo = Some(true)\n )\n )\n)", + "disable_click_analytics": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n clickAnalytics = Some(false)\n )\n )\n)", + "enable_click_analytics": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n clickAnalytics = Some(true)\n )\n )\n)", + "disable_analytics": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n analytics = Some(false)\n )\n )\n)", + "add_analytics_tags": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n analyticsTags = Some(Seq(\"front_end\", \"website2\"))\n )\n )\n)", + "disable_synonyms": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n synonyms = Some(false)\n )\n )\n)", + "override_replace_synonyms_in_highlights": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n replaceSynonymsInHighlight = Some(true)\n )\n )\n)", + "override_min_proximity": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n minProximity = Some(2)\n )\n )\n)", + "override_default_field": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n responseFields = Some(Seq(\"hits\", \"facets\"))\n )\n )\n)", + "override_percentile_computation": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n percentileComputation = Some(false)\n )\n )\n)", + "set_ab_test": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enableABTest = Some(false)\n )\n )\n)", + "set_enable_re_ranking": "val response = client.searchSingleIndex(\n indexName = \"\",\n searchParams = Some(\n SearchParamsObject(\n query = Some(\"query\"),\n enableReRanking = Some(false)\n )\n )\n)" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "val response = client.searchSynonyms(\n indexName = \"\"\n)", @@ -3976,6 +5420,9 @@ "distinct true": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n distinct = Some(Distinct(true))\n )\n)", "distinct section": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeForDistinct = Some(\"section\"),\n distinct = Some(Distinct(true))\n )\n)", "attributesForFaceting allergens": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"allergens\"))\n )\n)", + "api_attributes_for_faceting": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"genre\", \"author\"))\n )\n)", + "api_attributes_for_faceting_searchable": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"genre\", \"searchable(author)\"))\n )\n)", + "api_attributes_for_filter_only": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"filterOnly(genre)\", \"author\"))\n )\n)", "attributesForFaceting categoryPageId": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"searchable(categoryPageId)\"))\n )\n)", "unretrievableAttributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n unretrievableAttributes = Some(Seq(\"visible_by\"))\n )\n)", "attributesForFaceting user restricted data": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(Seq(\"filterOnly(visible_by)\"))\n )\n)", @@ -3999,6 +5446,7 @@ "customRanking and ranking sort alphabetically": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = Some(Seq(\"asc(textual_attribute)\")),\n ranking = Some(Seq(\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"))\n )\n)", "relevancyStrictness": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = Some(Seq(\"asc(textual_attribute)\")),\n relevancyStrictness = Some(0)\n )\n)", "create replica index": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = Some(Seq(\"products_price_desc\"))\n )\n)", + "create replica index articles": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = Some(Seq(\"articles_date_desc\"))\n )\n)", "create virtual replica index": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = Some(Seq(\"virtual(products_price_desc)\"))\n )\n)", "unlink replica index": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = Some(Seq(\"\"))\n )\n)", "forwardToReplicas": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"name\", \"description\"))\n ),\n forwardToReplicas = Some(true)\n)", @@ -4008,15 +5456,77 @@ "ranking closest dates": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = Some(\n Seq(\"asc(date_timestamp)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\")\n )\n )\n)", "searchableAttributes item variation": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"design\", \"type\", \"color\"))\n )\n)", "searchableAttributes around location": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"name\", \"country\", \"code\", \"iata_code\")),\n customRanking = Some(Seq(\"desc(links_count)\"))\n )\n)", - "disableTypoToleranceOnAttributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnAttributes = Some(Seq(\"serial_number\"))\n )\n)", + "attributesToHighlight": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToHighlight = Some(Seq(\"author\", \"title\", \"content\"))\n )\n)", + "attributesToHighlightStar": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToHighlight = Some(Seq(\"*\"))\n )\n)", "everything": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n advancedSyntax = Some(true),\n advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName(\"exactPhrase\"))),\n allowCompressionOfIntegerArray = Some(true),\n allowTyposOnNumericTokens = Some(true),\n alternativesAsExact = Some(Seq(AlternativesAsExact.withName(\"singleWordSynonym\"))),\n attributeCriteriaComputedByMinProximity = Some(true),\n attributeForDistinct = Some(\"test\"),\n attributesForFaceting = Some(Seq(\"algolia\")),\n attributesToHighlight = Some(Seq(\"algolia\")),\n attributesToRetrieve = Some(Seq(\"algolia\")),\n attributesToSnippet = Some(Seq(\"algolia\")),\n attributesToTransliterate = Some(Seq(\"algolia\")),\n camelCaseAttributes = Some(Seq(\"algolia\")),\n customNormalization = Some(Map(\"algolia\" -> Map(\"aloglia\" -> \"aglolia\"))),\n customRanking = Some(Seq(\"algolia\")),\n decompoundQuery = Some(false),\n decompoundedAttributes = Some(JObject(List(JField(\"algolia\", JString(\"aloglia\"))))),\n disableExactOnAttributes = Some(Seq(\"algolia\")),\n disablePrefixOnAttributes = Some(Seq(\"algolia\")),\n disableTypoToleranceOnAttributes = Some(Seq(\"algolia\")),\n disableTypoToleranceOnWords = Some(Seq(\"algolia\")),\n distinct = Some(Distinct(3)),\n enablePersonalization = Some(true),\n enableReRanking = Some(false),\n enableRules = Some(true),\n exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName(\"attribute\")),\n highlightPreTag = Some(\"\"),\n highlightPostTag = Some(\"\"),\n hitsPerPage = Some(10),\n ignorePlurals = Some(IgnorePlurals(false)),\n indexLanguages = Some(Seq(SupportedLanguage.withName(\"fr\"))),\n keepDiacriticsOnCharacters = Some(\"abc\"),\n maxFacetHits = Some(20),\n maxValuesPerFacet = Some(30),\n minProximity = Some(6),\n minWordSizefor1Typo = Some(5),\n minWordSizefor2Typos = Some(11),\n mode = Some(Mode.withName(\"neuralSearch\")),\n numericAttributesForFiltering = Some(Seq(\"algolia\")),\n optionalWords = Some(OptionalWords(Seq(\"myspace\"))),\n paginationLimitedTo = Some(0),\n queryLanguages = Some(Seq(SupportedLanguage.withName(\"fr\"))),\n queryType = Some(QueryType.withName(\"prefixLast\")),\n ranking = Some(Seq(\"geo\")),\n reRankingApplyFilter = Some(ReRankingApplyFilter(\"mySearch:filters\")),\n relevancyStrictness = Some(10),\n removeStopWords = Some(RemoveStopWords(false)),\n removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName(\"lastWords\")),\n renderingContent = Some(\n RenderingContent(\n facetOrdering = Some(\n FacetOrdering(\n facets = Some(\n Facets(\n order = Some(Seq(\"a\", \"b\"))\n )\n ),\n values = Some(\n Map(\n \"a\" -> Value(\n order = Some(Seq(\"b\")),\n sortRemainingBy = Some(SortRemainingBy.withName(\"count\"))\n )\n )\n )\n )\n )\n )\n ),\n replaceSynonymsInHighlight = Some(true),\n replicas = Some(Seq(\"\")),\n responseFields = Some(Seq(\"algolia\")),\n restrictHighlightAndSnippetArrays = Some(true),\n searchableAttributes = Some(Seq(\"foo\")),\n semanticSearch = Some(\n SemanticSearch(\n eventSources = Some(Seq(\"foo\"))\n )\n ),\n separatorsToIndex = Some(\"bar\"),\n snippetEllipsisText = Some(\"---\"),\n sortFacetValuesBy = Some(\"date\"),\n typoTolerance = Some(TypoTolerance(false)),\n unretrievableAttributes = Some(Seq(\"foo\")),\n userData = Some(JObject(List(JField(\"user\", JString(\"data\")))))\n )\n)", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"brand\", \"name\", \"categories\", \"unordered(description)\")),\n customRanking = Some(Seq(\"desc(popularity)\")),\n attributesForFaceting = Some(Seq(\"searchable(brand)\", \"type\", \"categories\", \"price\"))\n )\n)", + "searchableAttributesOrdering": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"unordered(title)\", \"cast\"))\n )\n)", "searchableAttributesProductReferenceSuffixes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"name\", \"product_reference\", \"product_reference_suffixes\"))\n )\n)", "queryLanguageAndIgnorePlurals": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryLanguages = Some(Seq(SupportedLanguage.withName(\"en\"))),\n ignorePlurals = Some(IgnorePlurals(true))\n )\n)", "searchableAttributesInMovies": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"title_eng\", \"title_fr\", \"title_es\"))\n )\n)", "disablePrefixOnAttributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disablePrefixOnAttributes = Some(Seq(\"serial_number\"))\n )\n)", + "disableTypoToleranceOnAttributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnAttributes = Some(Seq(\"serial_number\"))\n )\n)", "searchableAttributesSimpleExample": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"serial_number\"))\n )\n)", - "searchableAttributesSimpleExampleAlt": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"serial_number\", \"serial_number_suffixes\"))\n )\n)" + "searchableAttributesSimpleExampleAlt": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n searchableAttributes = Some(Seq(\"serial_number\", \"serial_number_suffixes\"))\n )\n)", + "set_searchable_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesForFaceting = Some(\n Seq(\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\"\n )\n )\n )\n)", + "unretrievable_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n unretrievableAttributes = Some(Seq(\"total_number_of_sales\"))\n )\n)", + "set_retrievable_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = Some(Seq(\"author\", \"title\", \"content\"))\n )\n)", + "set_all_attributes_as_retrievable": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = Some(Seq(\"*\"))\n )\n)", + "specify_attributes_not_to_retrieve": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToRetrieve = Some(Seq(\"*\", \"-SKU\", \"-internal_desc\"))\n )\n)", + "neural_search": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n mode = Some(Mode.withName(\"neuralSearch\"))\n )\n)", + "keyword_search": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n mode = Some(Mode.withName(\"keywordSearch\"))\n )\n)", + "set_default_ranking": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking = Some(Seq(\"typo\", \"geo\", \"words\", \"filters\", \"attribute\", \"proximity\", \"exact\", \"custom\"))\n )\n)", + "set_ranking_by_attribute_asc": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking =\n Some(Seq(\"asc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"))\n )\n)", + "set_ranking_by_attribute_desc": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n ranking =\n Some(Seq(\"desc(price)\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\", \"custom\"))\n )\n)", + "restrict_searchable_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customRanking = Some(Seq(\"desc(popularity)\", \"asc(price)\"))\n )\n)", + "set_default_relevancy": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n relevancyStrictness = Some(90)\n )\n)", + "set_replicas": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replicas = Some(Seq(\"name_of_replica_index1\", \"name_of_replica_index2\"))\n )\n)", + "set_default_max_values_per_facet": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n maxValuesPerFacet = Some(100)\n )\n)", + "set_default_sort_facet_values_by": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n sortFacetValuesBy = Some(\"alpha\")\n )\n)", + "set_attributes_to_snippet": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToSnippet = Some(Seq(\"content:80\", \"description\"))\n )\n)", + "set_all_attributes_to_snippet": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributesToSnippet = Some(Seq(\"*:80\"))\n )\n)", + "set_default_highlight_pre_tag": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n highlightPreTag = Some(\"\")\n )\n)", + "set_default_highlight_post_tag": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n highlightPostTag = Some(\"\")\n )\n)", + "set_default_snippet_ellipsis_text": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n snippetEllipsisText = Some(\"…\")\n )\n)", + "enable_restrict_highlight_and_snippet_arrays_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n restrictHighlightAndSnippetArrays = Some(true)\n )\n)", + "set_default_hits_per_page": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n hitsPerPage = Some(20)\n )\n)", + "set_pagination_limit": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n paginationLimitedTo = Some(1000)\n )\n)", + "set_default_min_word_size_for_one_typo": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minWordSizefor1Typo = Some(4)\n )\n)", + "set_default_min_word_size_for_two_typos": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minWordSizefor2Typos = Some(4)\n )\n)", + "set_default_typo_tolerance_mode": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n typoTolerance = Some(TypoTolerance(true))\n )\n)", + "disable_typos_on_numeric_tokens_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n allowTyposOnNumericTokens = Some(false)\n )\n)", + "disable_typo_tolerance_for_words": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableTypoToleranceOnWords = Some(Seq(\"wheel\", \"1X2BCD\"))\n )\n)", + "set_separators_to_index": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n separatorsToIndex = Some(\"+#\")\n )\n)", + "set_languages_using_querylanguages": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryLanguages = Some(Seq(SupportedLanguage.withName(\"es\"))),\n removeStopWords = Some(RemoveStopWords(true)),\n ignorePlurals = Some(IgnorePlurals(true))\n )\n)", + "set_attributes_to_transliterate": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n indexLanguages = Some(Seq(SupportedLanguage.withName(\"ja\"))),\n attributesToTransliterate = Some(Seq(\"name\", \"description\"))\n )\n)", + "set_camel_case_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n camelCaseAttributes = Some(Seq(\"description\"))\n )\n)", + "set_decompounded_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundedAttributes = Some(JObject(List(JField(\"de\", JArray(List(JString(\"name\")))))))\n )\n)", + "set_decompounded_multiple_attributes": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundedAttributes = Some(\n JObject(\n List(\n JField(\"de\", JArray(List(JString(\"name_de\"), JString(\"description_de\")))),\n JField(\"fi\", JArray(List(JString(\"name_fi\"), JString(\"description_fi\"))))\n )\n )\n )\n )\n)", + "set_keep_diacritics_on_characters": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n keepDiacriticsOnCharacters = Some(\"øé\")\n )\n)", + "set_custom_normalization": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n customNormalization = Some(Map(\"default\" -> Map(\"ä\" -> \"ae\")))\n )\n)", + "set_indexlanguages": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n indexLanguages = Some(Seq(SupportedLanguage.withName(\"ja\")))\n )\n)", + "enable_decompound_query_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n decompoundQuery = Some(true)\n )\n)", + "enable_rules_syntax_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n enableRules = Some(true)\n )\n)", + "enable_personalization_settings": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n enablePersonalization = Some(true)\n )\n)", + "set_default_query_type": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n queryType = Some(QueryType.withName(\"prefixLast\"))\n )\n)", + "set_default_remove_words_if_no_result": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName(\"none\"))\n )\n)", + "enable_advanced_syntax_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n advancedSyntax = Some(true)\n )\n)", + "set_default_optional_words": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n optionalWords = Some(OptionalWords(Seq(\"blue\", \"iphone case\")))\n )\n)", + "disabling_prefix_search_for_some_attributes_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disablePrefixOnAttributes = Some(Seq(\"sku\"))\n )\n)", + "disabling_exact_for_some_attributes_by_default": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n disableExactOnAttributes = Some(Seq(\"description\"))\n )\n)", + "set_default_exact_single_word_query": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName(\"attribute\"))\n )\n)", + "set_default_aternative_as_exact": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n alternativesAsExact =\n Some(Seq(AlternativesAsExact.withName(\"ignorePlurals\"), AlternativesAsExact.withName(\"singleWordSynonym\")))\n )\n)", + "set_numeric_attributes_for_filtering": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n numericAttributesForFiltering = Some(Seq(\"quantity\", \"popularity\"))\n )\n)", + "enable_compression_of_integer_array": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n allowCompressionOfIntegerArray = Some(true)\n )\n)", + "set_attributes_for_distinct": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeForDistinct = Some(\"url\")\n )\n)", + "set_distinct": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n distinct = Some(Distinct(1)),\n attributeForDistinct = Some(\"url\")\n )\n)", + "set_replace_synonyms_in_highlights": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n replaceSynonymsInHighlight = Some(false)\n )\n)", + "set_min_proximity": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n minProximity = Some(1)\n )\n)", + "set_default_field": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n responseFields = Some(Seq(\"hits\", \"hitsPerPage\", \"nbPages\", \"page\"))\n )\n)", + "set_max_facet_hits": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n maxFacetHits = Some(10)\n )\n)", + "set_attribute_criteria_computed_by_min_proximity": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n attributeCriteriaComputedByMinProximity = Some(true)\n )\n)", + "set_user_data": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n userData = Some(\n JObject(List(JField(\"extraData\", JString(\"This is the custom data that you want to store in your index\"))))\n )\n )\n)", + "set_rendering_content": "val response = client.setSettings(\n indexName = \"\",\n indexSettings = IndexSettings(\n renderingContent = Some(\n RenderingContent(\n facetOrdering = Some(\n FacetOrdering(\n facets = Some(\n Facets(\n order = Some(Seq(\"size\", \"brand\"))\n )\n ),\n values = Some(\n Map(\n \"brand\" -> Value(\n order = Some(Seq(\"uniqlo\")),\n hide = Some(Seq(\"muji\")),\n sortRemainingBy = Some(SortRemainingBy.withName(\"count\"))\n ),\n \"size\" -> Value(\n order = Some(Seq(\"S\", \"M\", \"L\")),\n sortRemainingBy = Some(SortRemainingBy.withName(\"hidden\"))\n )\n )\n )\n )\n )\n )\n )\n )\n)" }, "updateApiKey": { "default": "val response = client.updateApiKey(\n key = \"ALGOLIA_API_KEY\",\n apiKey = ApiKey(\n acl = Seq(Acl.withName(\"search\"), Acl.withName(\"addObject\")),\n validity = Some(300),\n maxQueriesPerIPPerHour = Some(100),\n maxHitsPerQuery = Some(20)\n )\n)" @@ -4320,6 +5830,10 @@ "filtersStephenKing": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(filters: \"author:\\\"Stephen King\\\"\"))\n)", "filtersNotTags": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(filters: \"NOT _tags:non-fiction\"))\n)", "facetFiltersList": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(\n facetFilters: SearchFacetFilters\n .arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"publisher:Penguin\"),\n SearchFacetFilters.arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"author:Stephen King\"),\n SearchFacetFilters.string(\"genre:Horror\"),\n ]),\n ])\n ))\n)", + "facetFiltersBook": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([SearchFacetFilters.string(\"category:Book\")])\n ))\n)", + "facetFiltersAND": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"category:Book\"),\n SearchFacetFilters.string(\"author:John Doe\"),\n ])\n ))\n)", + "facetFiltersOR": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facetFilters: SearchFacetFilters\n .arrayOfSearchFacetFilters([SearchFacetFilters.arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"category:Book\"),\n SearchFacetFilters.string(\"author:John Doe\"),\n ])])\n ))\n)", + "facetFiltersCombined": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"author:John Doe\"),\n SearchFacetFilters.arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"category:Book\"),\n SearchFacetFilters.string(\"category:Movie\"),\n ]),\n ])\n ))\n)", "facetFiltersNeg": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(\n facetFilters: SearchFacetFilters\n .string(\"category:-Ebook\")\n ))\n)", "filtersAndFacetFilters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n filters: \"(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")\",\n facetFilters: SearchFacetFilters\n .arrayOfSearchFacetFilters([SearchFacetFilters.string(\"publisher:Penguin\")])\n ))\n)", "facet author genre": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(facets: [\n \"author\",\n \"genre\",\n ]))\n)", @@ -4339,9 +5853,90 @@ "clickAnalyticsUserToken": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n userToken: \"user-1\",\n clickAnalytics: true\n ))\n)", "enablePersonalization": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n userToken: \"user-1\",\n enablePersonalization: true\n ))\n)", "userToken": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(userToken: \"user-1\"))\n)", + "userToken1234": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n userToken: \"user-1234\"\n ))\n)", "analyticsTag": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(analyticsTags: [\"YOUR_ANALYTICS_TAG\"]))\n)", "facetFiltersUsers": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams\n .searchSearchParamsObject(SearchSearchParamsObject(\n facetFilters: SearchFacetFilters\n .arrayOfSearchFacetFilters([\n SearchFacetFilters.string(\"user:user42\"),\n SearchFacetFilters.string(\"user:public\"),\n ])\n ))\n)", - "buildTheQuery": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n filters: \"categoryPageId: Men's Clothing\",\n analyticsTags: [\"mens-clothing\"],\n hitsPerPage: 50\n ))\n)" + "buildTheQuery": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n filters: \"categoryPageId: Men's Clothing\",\n analyticsTags: [\"mens-clothing\"],\n hitsPerPage: 50\n ))\n)", + "attributesToHighlightOverride": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n attributesToHighlight: [\"title\", \"content\"]\n ))\n)", + "disableTypoToleranceOnAttributes": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n disableTypoToleranceOnAttributes: [\"serial_number\"]\n ))\n)", + "search_a_query": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"\",\n similarQuery: \"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\n filters: \"year:1991 TO 2001\"\n ))\n)", + "search_everything": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: \"\"))\n)", + "api_filtering_range_example": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"books\",\n filters: \"price:10 TO 20\"\n ))\n)", + "override_retrievable_attributes": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n attributesToRetrieve: [\"title\", \"content\"]\n ))\n)", + "restrict_searchable_attributes": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n restrictSearchableAttributes: [\"title\", \"author\"]\n ))\n)", + "override_default_relevancy": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n relevancyStrictness: 70\n ))\n)", + "apply_filters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n sumOrFiltersScores: true\n ))\n)", + "apply_all_filters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n 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\\\"\"\n ))\n)", + "escape_spaces": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n filters: \"category:\\\"Books and Comics\\\"\"\n ))\n)", + "escape_keywords": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n filters: \"keyword:\\\"OR\\\"\"\n ))\n)", + "escape_single_quotes": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n filters: \"content:\\\"It's a wonderful day\\\"\"\n ))\n)", + "escape_double_quotes": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n filters: \"content:\\\"She said \\\"Hello World\\\"\"\n ))\n)", + "apply_negative_filters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n optionalFilters: SearchOptionalFilters.arrayOfSearchOptionalFilters([\n SearchOptionalFilters.string(\"category:Book\"),\n SearchOptionalFilters.string(\"author:-John Doe\"),\n ])\n ))\n)", + "apply_numeric_filters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n numericFilters: SearchNumericFilters.arrayOfSearchNumericFilters([\n SearchNumericFilters.string(\"price < 1000\"),\n SearchNumericFilters.arrayOfSearchNumericFilters([\n SearchNumericFilters.string(\"inStock = 1\"),\n SearchNumericFilters.string(\"deliveryDate < 1441755506\"),\n ]),\n ])\n ))\n)", + "apply_tag_filters": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n tagFilters: SearchTagFilters.arrayOfSearchTagFilters([\n SearchTagFilters.string(\"SciFi\"),\n SearchTagFilters.arrayOfSearchTagFilters([\n SearchTagFilters.string(\"Book\"),\n SearchTagFilters.string(\"Movie\"),\n ]),\n ])\n ))\n)", + "facets_all": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facets: [\"*\"]\n ))\n)", + "retrieve_only_some_facets": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facets: [\"category\", \"author\"]\n ))\n)", + "override_default_max_values_per_facet": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n maxValuesPerFacet: 20\n ))\n)", + "enable_faceting_after_distinct": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n facetingAfterDistinct: true\n ))\n)", + "sort_facet_values_alphabetically": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n sortFacetValuesBy: \"count\"\n ))\n)", + "override_attributes_to_snippet": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n attributesToSnippet: [\"title\", \"content:80\"]\n ))\n)", + "override_default_highlight_pre_tag": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n highlightPreTag: \"\"\n ))\n)", + "override_default_highlight_post_tag": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n highlightPostTag: \"\"\n ))\n)", + "override_default_snippet_ellipsis_text": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n snippetEllipsisText: \"\"\n ))\n)", + "enable_restrict_highlight_and_snippet_arrays": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n restrictHighlightAndSnippetArrays: false\n ))\n)", + "access_page": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: \"query\", page: 0))\n)", + "override_default_hits_per_page": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n hitsPerPage: 10\n ))\n)", + "get_nth_hit": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n offset: 4\n ))\n)", + "get_n_results": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n length: 4\n ))\n)", + "override_default_min_word_size_for_one_typo": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n minWordSizefor1Typo: 2\n ))\n)", + "override_default_min_word_size_for_two_typos": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n minWordSizefor2Typos: 2\n ))\n)", + "override_default_typo_tolerance_mode": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n typoTolerance: SearchTypoTolerance.bool(false)\n ))\n)", + "disable_typos_on_numeric_tokens_at_search_time": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n allowTyposOnNumericTokens: false\n ))\n)", + "search_around_a_position": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundLatLng: \"40.71, -74.01\"\n ))\n)", + "search_around_server_ip": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundLatLngViaIP: true\n )),\n requestOptions: RequestOptions(\n headers: [\n \"x-forwarded-for\": \"94.228.178.246 // should be replaced with the actual IP you would like to search around\",\n ]\n )\n)", + "set_around_radius": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundRadius: SearchAroundRadius.int(1000)\n ))\n)", + "disable_automatic_radius": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundRadius: SearchAroundRadius.searchAroundRadiusAll(SearchAroundRadiusAll.all)\n ))\n)", + "set_geo_search_precision": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundPrecision: SearchAroundPrecision.int(100)\n ))\n)", + "set_geo_search_precision_non_linear": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n aroundPrecision: SearchAroundPrecision.arrayOfSearchRange([\n SearchRange(from: 0, value: 25),\n SearchRange(from: 2000, value: 1000),\n ])\n ))\n)", + "set_minimum_geo_search_radius": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n minimumAroundRadius: 1000\n ))\n)", + "search_inside_rectangular_area": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([[\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n ]])\n ))\n)", + "search_inside_multiple_rectangular_areas": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625],\n [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875],\n ])\n ))\n)", + "search_inside_polygon_area": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n insidePolygon: [[\n 46.650828100116044,\n 7.123046875,\n 45.17210966999772,\n 1.009765625,\n 49.62625916704081,\n 4.6181640625,\n ]]\n ))\n)", + "search_inside_multiple_polygon_areas": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n insidePolygon: [\n [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625],\n [\n 49.62625916704081,\n 4.6181640625,\n 47.715070300900194,\n 0.482421875,\n 45.17210966999772,\n 1.009765625,\n 50.62626704081,\n 4.6181640625,\n ],\n ]\n ))\n)", + "set_querylanguages_override": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n removeStopWords: SearchRemoveStopWords.arrayOfSearchSupportedLanguage([\n SearchSupportedLanguage.ca,\n SearchSupportedLanguage.es,\n ])\n ))\n)", + "set_querylanguages_with_japanese_query": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n queryLanguages: [SearchSupportedLanguage.ja, SearchSupportedLanguage.en]\n ))\n)", + "set_natural_languages": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"\",\n naturalLanguages: [SearchSupportedLanguage.fr]\n ))\n)", + "override_natural_languages_with_query": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"\",\n naturalLanguages: [SearchSupportedLanguage.fr],\n removeWordsIfNoResults: SearchRemoveWordsIfNoResults.firstWords\n ))\n)", + "enable_decompound_query_search_time": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n decompoundQuery: true\n ))\n)", + "enable_rules_search_time": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n enableRules: true\n ))\n)", + "set_rule_contexts": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n ruleContexts: [\"front_end\", \"website2\"]\n ))\n)", + "enable_personalization": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n enablePersonalization: true\n ))\n)", + "enable_personalization_with_user_token": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n userToken: \"123456\",\n enablePersonalization: true\n ))\n)", + "personalization_impact": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n personalizationImpact: 20\n ))\n)", + "set_user_token": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n userToken: \"123456\"\n ))\n)", + "set_user_token_with_personalization": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n userToken: \"123456\",\n enablePersonalization: true\n ))\n)", + "override_default_query_type": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n queryType: SearchQueryType.prefixAll\n ))\n)", + "override_default_remove_words_if_no_results": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords\n ))\n)", + "enable_advanced_syntax_search_time": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n advancedSyntax: true\n ))\n)", + "overide_default_optional_words": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n optionalWords: SearchOptionalWords.arrayOfString([\"toyota\", \"2020 2021\"])\n ))\n)", + "disabling_exact_for_some_attributes_search_time": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n disableExactOnAttributes: [\"description\"]\n ))\n)", + "override_default_exact_single_word_query": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n exactOnSingleWordQuery: SearchExactOnSingleWordQuery.`none`\n ))\n)", + "override_default_aternative_as_exact": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n alternativesAsExact: [SearchAlternativesAsExact.multiWordsSynonym]\n ))\n)", + "enable_advanced_syntax_exact_phrase": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n advancedSyntax: true,\n advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase]\n ))\n)", + "enable_advanced_syntax_exclude_words": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n advancedSyntax: true,\n advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.excludeWords]\n ))\n)", + "override_distinct": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n distinct: SearchDistinct.int(0)\n ))\n)", + "get_ranking_info": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n getRankingInfo: true\n ))\n)", + "disable_click_analytics": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n clickAnalytics: false\n ))\n)", + "enable_click_analytics": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n clickAnalytics: true\n ))\n)", + "disable_analytics": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n analytics: false\n ))\n)", + "add_analytics_tags": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n analyticsTags: [\"front_end\", \"website2\"]\n ))\n)", + "disable_synonyms": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n synonyms: false\n ))\n)", + "override_replace_synonyms_in_highlights": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n replaceSynonymsInHighlight: true\n ))\n)", + "override_min_proximity": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n minProximity: 2\n ))\n)", + "override_default_field": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n responseFields: [\"hits\", \"facets\"]\n ))\n)", + "override_percentile_computation": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n percentileComputation: false\n ))\n)", + "set_ab_test": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n enableABTest: false\n ))\n)", + "set_enable_re_ranking": "let response: SearchResponse = try await client.searchSingleIndex(\n indexName: \"\",\n searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(\n query: \"query\",\n enableReRanking: false\n ))\n)" }, "searchSynonyms": { "searchSynonyms with minimal parameters": "let response = try await client.searchSynonyms(indexName: \"\")", @@ -4372,6 +5967,9 @@ "distinct true": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(distinct: SearchDistinct.bool(true))\n)", "distinct section": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributeForDistinct: \"section\", distinct: SearchDistinct.bool(true))\n)", "attributesForFaceting allergens": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"allergens\"])\n)", + "api_attributes_for_faceting": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"genre\", \"author\"])\n)", + "api_attributes_for_faceting_searchable": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"genre\", \"searchable(author)\"])\n)", + "api_attributes_for_filter_only": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"filterOnly(genre)\", \"author\"])\n)", "attributesForFaceting categoryPageId": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"searchable(categoryPageId)\"])\n)", "unretrievableAttributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(unretrievableAttributes: [\"visible_by\"])\n)", "attributesForFaceting user restricted data": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\"filterOnly(visible_by)\"])\n)", @@ -4395,6 +5993,7 @@ "customRanking and ranking sort alphabetically": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n customRanking: [\"asc(textual_attribute)\"],\n ranking: [\"custom\", \"typo\", \"geo\", \"words\", \"filters\", \"proximity\", \"attribute\", \"exact\"]\n )\n)", "relevancyStrictness": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(customRanking: [\"asc(textual_attribute)\"], relevancyStrictness: 0)\n)", "create replica index": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replicas: [\"products_price_desc\"])\n)", + "create replica index articles": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replicas: [\"articles_date_desc\"])\n)", "create virtual replica index": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replicas: [\"virtual(products_price_desc)\"])\n)", "unlink replica index": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replicas: [\"\"])\n)", "forwardToReplicas": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"name\", \"description\"]),\n forwardToReplicas: true\n)", @@ -4404,15 +6003,77 @@ "ranking closest dates": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(ranking: [\n \"asc(date_timestamp)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ])\n)", "searchableAttributes item variation": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"design\", \"type\", \"color\"])\n)", "searchableAttributes around location": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n searchableAttributes: [\"name\", \"country\", \"code\", \"iata_code\"],\n customRanking: [\"desc(links_count)\"]\n )\n)", - "disableTypoToleranceOnAttributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disableTypoToleranceOnAttributes: [\"serial_number\"])\n)", + "attributesToHighlight": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToHighlight: [\"author\", \"title\", \"content\"])\n)", + "attributesToHighlightStar": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToHighlight: [\"*\"])\n)", "everything": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\"algolia\"],\n replicas: [\"\"],\n paginationLimitedTo: 0,\n unretrievableAttributes: [\"foo\"],\n disableTypoToleranceOnWords: [\"algolia\"],\n attributesToTransliterate: [\"algolia\"],\n camelCaseAttributes: [\"algolia\"],\n decompoundedAttributes: [\"algolia\": \"aloglia\"],\n indexLanguages: [SearchSupportedLanguage.fr],\n disablePrefixOnAttributes: [\"algolia\"],\n allowCompressionOfIntegerArray: true,\n numericAttributesForFiltering: [\"algolia\"],\n separatorsToIndex: \"bar\",\n searchableAttributes: [\"foo\"],\n userData: [\"user\": \"data\"],\n customNormalization: [\"algolia\": [\"aloglia\": \"aglolia\"]],\n attributeForDistinct: \"test\",\n maxFacetHits: 20,\n keepDiacriticsOnCharacters: \"abc\",\n customRanking: [\"algolia\"],\n attributesToRetrieve: [\"algolia\"],\n ranking: [\"geo\"],\n relevancyStrictness: 10,\n attributesToHighlight: [\"algolia\"],\n attributesToSnippet: [\"algolia\"],\n highlightPreTag: \"\",\n highlightPostTag: \"\",\n snippetEllipsisText: \"---\",\n restrictHighlightAndSnippetArrays: true,\n hitsPerPage: 10,\n minWordSizefor1Typo: 5,\n minWordSizefor2Typos: 11,\n typoTolerance: SearchTypoTolerance.bool(false),\n allowTyposOnNumericTokens: true,\n disableTypoToleranceOnAttributes: [\"algolia\"],\n ignorePlurals: SearchIgnorePlurals.bool(false),\n removeStopWords: SearchRemoveStopWords.bool(false),\n queryLanguages: [SearchSupportedLanguage.fr],\n decompoundQuery: false,\n enableRules: true,\n enablePersonalization: true,\n queryType: SearchQueryType.prefixLast,\n removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords,\n mode: SearchMode.neuralSearch,\n semanticSearch: SearchSemanticSearch(eventSources: [\"foo\"]),\n advancedSyntax: true,\n optionalWords: SearchOptionalWords.arrayOfString([\"myspace\"]),\n disableExactOnAttributes: [\"algolia\"],\n exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute,\n alternativesAsExact: [SearchAlternativesAsExact.singleWordSynonym],\n advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase],\n distinct: SearchDistinct.int(3),\n replaceSynonymsInHighlight: true,\n minProximity: 6,\n responseFields: [\"algolia\"],\n maxValuesPerFacet: 30,\n sortFacetValuesBy: \"date\",\n attributeCriteriaComputedByMinProximity: true,\n renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering(\n facets: SearchFacets(order: [\"a\", \"b\"]),\n values: [\"a\": SearchValue(order: [\"b\"], sortRemainingBy: SearchSortRemainingBy.count)]\n )),\n enableReRanking: false,\n reRankingApplyFilter: SearchReRankingApplyFilter.string(\"mySearch:filters\")\n )\n)", "searchableAttributesWithCustomRankingsAndAttributesForFaceting": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesForFaceting: [\"searchable(brand)\", \"type\", \"categories\", \"price\"],\n searchableAttributes: [\"brand\", \"name\", \"categories\", \"unordered(description)\"],\n customRanking: [\"desc(popularity)\"]\n )\n)", + "searchableAttributesOrdering": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"unordered(title)\", \"cast\"])\n)", "searchableAttributesProductReferenceSuffixes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\n \"name\",\n \"product_reference\",\n \"product_reference_suffixes\",\n ])\n)", "queryLanguageAndIgnorePlurals": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ignorePlurals: SearchIgnorePlurals.bool(true),\n queryLanguages: [SearchSupportedLanguage.en]\n )\n)", "searchableAttributesInMovies": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"title_eng\", \"title_fr\", \"title_es\"])\n)", "disablePrefixOnAttributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disablePrefixOnAttributes: [\"serial_number\"])\n)", + "disableTypoToleranceOnAttributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disableTypoToleranceOnAttributes: [\"serial_number\"])\n)", "searchableAttributesSimpleExample": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"serial_number\"])\n)", - "searchableAttributesSimpleExampleAlt": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"serial_number\", \"serial_number_suffixes\"])\n)" + "searchableAttributesSimpleExampleAlt": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(searchableAttributes: [\"serial_number\", \"serial_number_suffixes\"])\n)", + "set_searchable_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesForFaceting: [\n \"author\",\n \"filterOnly(isbn)\",\n \"searchable(edition)\",\n \"afterDistinct(category)\",\n \"afterDistinct(searchable(publisher))\",\n ])\n)", + "unretrievable_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(unretrievableAttributes: [\"total_number_of_sales\"])\n)", + "set_retrievable_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToRetrieve: [\"author\", \"title\", \"content\"])\n)", + "set_all_attributes_as_retrievable": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToRetrieve: [\"*\"])\n)", + "specify_attributes_not_to_retrieve": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToRetrieve: [\"*\", \"-SKU\", \"-internal_desc\"])\n)", + "neural_search": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(mode: SearchMode.neuralSearch)\n)", + "keyword_search": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(mode: SearchMode.keywordSearch)\n)", + "set_default_ranking": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(ranking: [\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"attribute\",\n \"proximity\",\n \"exact\",\n \"custom\",\n ])\n)", + "set_ranking_by_attribute_asc": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(ranking: [\n \"asc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ])\n)", + "set_ranking_by_attribute_desc": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(ranking: [\n \"desc(price)\",\n \"typo\",\n \"geo\",\n \"words\",\n \"filters\",\n \"proximity\",\n \"attribute\",\n \"exact\",\n \"custom\",\n ])\n)", + "restrict_searchable_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(customRanking: [\"desc(popularity)\", \"asc(price)\"])\n)", + "set_default_relevancy": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(relevancyStrictness: 90)\n)", + "set_replicas": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replicas: [\"name_of_replica_index1\", \"name_of_replica_index2\"])\n)", + "set_default_max_values_per_facet": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(maxValuesPerFacet: 100)\n)", + "set_default_sort_facet_values_by": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(sortFacetValuesBy: \"alpha\")\n)", + "set_attributes_to_snippet": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToSnippet: [\"content:80\", \"description\"])\n)", + "set_all_attributes_to_snippet": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributesToSnippet: [\"*:80\"])\n)", + "set_default_highlight_pre_tag": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(highlightPreTag: \"\")\n)", + "set_default_highlight_post_tag": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(highlightPostTag: \"\")\n)", + "set_default_snippet_ellipsis_text": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(snippetEllipsisText: \"…\")\n)", + "enable_restrict_highlight_and_snippet_arrays_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(restrictHighlightAndSnippetArrays: true)\n)", + "set_default_hits_per_page": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(hitsPerPage: 20)\n)", + "set_pagination_limit": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(paginationLimitedTo: 1000)\n)", + "set_default_min_word_size_for_one_typo": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(minWordSizefor1Typo: 4)\n)", + "set_default_min_word_size_for_two_typos": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(minWordSizefor2Typos: 4)\n)", + "set_default_typo_tolerance_mode": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true))\n)", + "disable_typos_on_numeric_tokens_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(allowTyposOnNumericTokens: false)\n)", + "disable_typo_tolerance_for_words": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disableTypoToleranceOnWords: [\"wheel\", \"1X2BCD\"])\n)", + "set_separators_to_index": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(separatorsToIndex: \"+#\")\n)", + "set_languages_using_querylanguages": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n ignorePlurals: SearchIgnorePlurals.bool(true),\n removeStopWords: SearchRemoveStopWords.bool(true),\n queryLanguages: [SearchSupportedLanguage.es]\n )\n)", + "set_attributes_to_transliterate": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n attributesToTransliterate: [\"name\", \"description\"],\n indexLanguages: [SearchSupportedLanguage.ja]\n )\n)", + "set_camel_case_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(camelCaseAttributes: [\"description\"])\n)", + "set_decompounded_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(decompoundedAttributes: [\"de\": [\"name\"]])\n)", + "set_decompounded_multiple_attributes": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(decompoundedAttributes: [\n \"de\": [\"name_de\", \"description_de\"],\n \"fi\": [\"name_fi\", \"description_fi\"],\n ])\n)", + "set_keep_diacritics_on_characters": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(keepDiacriticsOnCharacters: \"øé\")\n)", + "set_custom_normalization": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(customNormalization: [\"default\": [\"ä\": \"ae\"]])\n)", + "set_indexlanguages": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(indexLanguages: [SearchSupportedLanguage.ja])\n)", + "enable_decompound_query_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(decompoundQuery: true)\n)", + "enable_rules_syntax_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(enableRules: true)\n)", + "enable_personalization_settings": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(enablePersonalization: true)\n)", + "set_default_query_type": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(queryType: SearchQueryType.prefixLast)\n)", + "set_default_remove_words_if_no_result": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(removeWordsIfNoResults: SearchRemoveWordsIfNoResults.`none`)\n)", + "enable_advanced_syntax_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(advancedSyntax: true)\n)", + "set_default_optional_words": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(optionalWords: SearchOptionalWords.arrayOfString([\"blue\", \"iphone case\"]))\n)", + "disabling_prefix_search_for_some_attributes_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disablePrefixOnAttributes: [\"sku\"])\n)", + "disabling_exact_for_some_attributes_by_default": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(disableExactOnAttributes: [\"description\"])\n)", + "set_default_exact_single_word_query": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute)\n)", + "set_default_aternative_as_exact": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(alternativesAsExact: [\n SearchAlternativesAsExact.ignorePlurals,\n SearchAlternativesAsExact.singleWordSynonym,\n ])\n)", + "set_numeric_attributes_for_filtering": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(numericAttributesForFiltering: [\"quantity\", \"popularity\"])\n)", + "enable_compression_of_integer_array": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(allowCompressionOfIntegerArray: true)\n)", + "set_attributes_for_distinct": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributeForDistinct: \"url\")\n)", + "set_distinct": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributeForDistinct: \"url\", distinct: SearchDistinct.int(1))\n)", + "set_replace_synonyms_in_highlights": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(replaceSynonymsInHighlight: false)\n)", + "set_min_proximity": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(minProximity: 1)\n)", + "set_default_field": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(responseFields: [\"hits\", \"hitsPerPage\", \"nbPages\", \"page\"])\n)", + "set_max_facet_hits": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(maxFacetHits: 10)\n)", + "set_attribute_criteria_computed_by_min_proximity": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(attributeCriteriaComputedByMinProximity: true)\n)", + "set_user_data": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(\n userData: [\"extraData\": \"This is the custom data that you want to store in your index\"]\n )\n)", + "set_rendering_content": "let response = try await client.setSettings(\n indexName: \"\",\n indexSettings: IndexSettings(renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering(\n facets: SearchFacets(order: [\"size\", \"brand\"]),\n values: [\n \"brand\": SearchValue(order: [\"uniqlo\"], sortRemainingBy: SearchSortRemainingBy.count,\n hide: [\"muji\"]),\n \"size\": SearchValue(order: [\"S\", \"M\", \"L\"], sortRemainingBy: SearchSortRemainingBy.hidden),\n ]\n )))\n)" }, "updateApiKey": { "default": "let response = try await client.updateApiKey(\n key: \"ALGOLIA_API_KEY\",\n apiKey: ApiKey(\n acl: [Acl.search, Acl.addObject],\n maxHitsPerQuery: 20,\n maxQueriesPerIPPerHour: 100,\n validity: 300\n )\n)" diff --git a/docs/snippets/csharp/src/Search.cs b/docs/snippets/csharp/src/Search.cs index 980b9b0e38..b21bfd41e7 100644 --- a/docs/snippets/csharp/src/Search.cs +++ b/docs/snippets/csharp/src/Search.cs @@ -5,6 +5,7 @@ using Algolia.Search.Models.Search; // IMPORT< using Action = Algolia.Search.Models.Search.Action; +using Range = Algolia.Search.Models.Search.Range; public class SnippetSearchClient { @@ -4636,9 +4637,144 @@ public async Task SnippetForSearchClientSearchSingleIndex13() /// /// Snippet for the SearchSingleIndex method. /// - /// facetFiltersNeg + /// facetFiltersBook /// public async Task SnippetForSearchClientSearchSingleIndex14() + { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List { new FacetFilters("category:Book") } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// facetFiltersAND + /// + public async Task SnippetForSearchClientSearchSingleIndex15() + { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("author:John Doe"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// facetFiltersOR + /// + public async Task SnippetForSearchClientSearchSingleIndex16() + { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("author:John Doe"), + } + ), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// facetFiltersCombined + /// + public async Task SnippetForSearchClientSearchSingleIndex17() + { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters("author:John Doe"), + new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("category:Movie"), + } + ), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// facetFiltersNeg + /// + public async Task SnippetForSearchClientSearchSingleIndex18() { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client @@ -4660,7 +4796,7 @@ public async Task SnippetForSearchClientSearchSingleIndex14() /// /// filtersAndFacetFilters /// - public async Task SnippetForSearchClientSearchSingleIndex15() + public async Task SnippetForSearchClientSearchSingleIndex19() { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client @@ -4688,7 +4824,7 @@ public async Task SnippetForSearchClientSearchSingleIndex15() /// /// facet author genre /// - public async Task SnippetForSearchClientSearchSingleIndex16() + public async Task SnippetForSearchClientSearchSingleIndex20() { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client @@ -4713,7 +4849,7 @@ public async Task SnippetForSearchClientSearchSingleIndex16() /// /// facet wildcard /// - public async Task SnippetForSearchClientSearchSingleIndex17() + public async Task SnippetForSearchClientSearchSingleIndex21() { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client @@ -4733,7 +4869,7 @@ public async Task SnippetForSearchClientSearchSingleIndex17() /// /// maxValuesPerFacet /// - public async Task SnippetForSearchClientSearchSingleIndex18() + public async Task SnippetForSearchClientSearchSingleIndex22() { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client @@ -4753,7 +4889,7 @@ public async Task SnippetForSearchClientSearchSingleIndex18() /// /// aroundLatLng /// - public async Task SnippetForSearchClientSearchSingleIndex19() + public async Task SnippetForSearchClientSearchSingleIndex23() { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client @@ -4773,7 +4909,7 @@ public async Task SnippetForSearchClientSearchSingleIndex19() /// /// aroundLatLngViaIP /// - public async Task SnippetForSearchClientSearchSingleIndex20() + public async Task SnippetForSearchClientSearchSingleIndex24() { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client @@ -4793,7 +4929,7 @@ public async Task SnippetForSearchClientSearchSingleIndex20() /// /// aroundRadius /// - public async Task SnippetForSearchClientSearchSingleIndex21() + public async Task SnippetForSearchClientSearchSingleIndex25() { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client @@ -4819,7 +4955,7 @@ public async Task SnippetForSearchClientSearchSingleIndex21() /// /// insideBoundingBox /// - public async Task SnippetForSearchClientSearchSingleIndex22() + public async Task SnippetForSearchClientSearchSingleIndex26() { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client @@ -4849,7 +4985,7 @@ public async Task SnippetForSearchClientSearchSingleIndex22() /// /// insidePolygon /// - public async Task SnippetForSearchClientSearchSingleIndex23() + public async Task SnippetForSearchClientSearchSingleIndex27() { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client @@ -4891,7 +5027,7 @@ public async Task SnippetForSearchClientSearchSingleIndex23() /// /// insidePolygon /// - public async Task SnippetForSearchClientSearchSingleIndex24() + public async Task SnippetForSearchClientSearchSingleIndex28() { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client @@ -4933,7 +5069,7 @@ public async Task SnippetForSearchClientSearchSingleIndex24() /// /// optionalFilters /// - public async Task SnippetForSearchClientSearchSingleIndex25() + public async Task SnippetForSearchClientSearchSingleIndex29() { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client @@ -4960,7 +5096,7 @@ public async Task SnippetForSearchClientSearchSingleIndex25() /// /// optionalFiltersMany /// - public async Task SnippetForSearchClientSearchSingleIndex26() + public async Task SnippetForSearchClientSearchSingleIndex30() { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client @@ -4992,7 +5128,7 @@ public async Task SnippetForSearchClientSearchSingleIndex26() /// /// optionalFiltersSimple /// - public async Task SnippetForSearchClientSearchSingleIndex27() + public async Task SnippetForSearchClientSearchSingleIndex31() { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client @@ -5023,7 +5159,7 @@ public async Task SnippetForSearchClientSearchSingleIndex27() /// /// restrictSearchableAttributes /// - public async Task SnippetForSearchClientSearchSingleIndex28() + public async Task SnippetForSearchClientSearchSingleIndex32() { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client @@ -5045,7 +5181,7 @@ public async Task SnippetForSearchClientSearchSingleIndex28() /// /// getRankingInfo /// - public async Task SnippetForSearchClientSearchSingleIndex29() + public async Task SnippetForSearchClientSearchSingleIndex33() { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client @@ -5065,7 +5201,7 @@ public async Task SnippetForSearchClientSearchSingleIndex29() /// /// clickAnalytics /// - public async Task SnippetForSearchClientSearchSingleIndex30() + public async Task SnippetForSearchClientSearchSingleIndex34() { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client @@ -5085,7 +5221,7 @@ public async Task SnippetForSearchClientSearchSingleIndex30() /// /// clickAnalyticsUserToken /// - public async Task SnippetForSearchClientSearchSingleIndex31() + public async Task SnippetForSearchClientSearchSingleIndex35() { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client @@ -5105,7 +5241,7 @@ public async Task SnippetForSearchClientSearchSingleIndex31() /// /// enablePersonalization /// - public async Task SnippetForSearchClientSearchSingleIndex32() + public async Task SnippetForSearchClientSearchSingleIndex36() { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client @@ -5127,7 +5263,7 @@ public async Task SnippetForSearchClientSearchSingleIndex32() /// /// userToken /// - public async Task SnippetForSearchClientSearchSingleIndex33() + public async Task SnippetForSearchClientSearchSingleIndex37() { // >SEPARATOR searchSingleIndex userToken // Initialize the client @@ -5142,12 +5278,32 @@ public async Task SnippetForSearchClientSearchSingleIndex33() // SEPARATOR< } + /// + /// Snippet for the SearchSingleIndex method. + /// + /// userToken1234 + /// + public async Task SnippetForSearchClientSearchSingleIndex38() + { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", UserToken = "user-1234" }) + ); + // >LOG + // SEPARATOR< + } + /// /// Snippet for the SearchSingleIndex method. /// /// analyticsTag /// - public async Task SnippetForSearchClientSearchSingleIndex34() + public async Task SnippetForSearchClientSearchSingleIndex39() { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client @@ -5169,7 +5325,7 @@ public async Task SnippetForSearchClientSearchSingleIndex34() /// /// facetFiltersUsers /// - public async Task SnippetForSearchClientSearchSingleIndex35() + public async Task SnippetForSearchClientSearchSingleIndex40() { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client @@ -5200,7 +5356,7 @@ public async Task SnippetForSearchClientSearchSingleIndex35() /// /// buildTheQuery /// - public async Task SnippetForSearchClientSearchSingleIndex36() + public async Task SnippetForSearchClientSearchSingleIndex41() { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client @@ -5223,128 +5379,2202 @@ public async Task SnippetForSearchClientSearchSingleIndex36() } /// - /// Snippet for the SearchSynonyms method. + /// Snippet for the SearchSingleIndex method. /// - /// searchSynonyms with minimal parameters + /// attributesToHighlightOverride /// - public async Task SnippetForSearchClientSearchSynonyms() + public async Task SnippetForSearchClientSearchSingleIndex42() { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - var response = await client.SearchSynonymsAsync(""); + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToHighlight = new List { "title", "content" }, + } + ) + ); // >LOG // SEPARATOR< } /// - /// Snippet for the SearchSynonyms method. + /// Snippet for the SearchSingleIndex method. /// - /// searchSynonyms with all parameters + /// disableTypoToleranceOnAttributes /// - public async Task SnippetForSearchClientSearchSynonyms1() + public async Task SnippetForSearchClientSearchSingleIndex43() { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - var response = await client.SearchSynonymsAsync( + var response = await client.SearchSingleIndexAsync( "", - new SearchSynonymsParams - { - Query = "myQuery", - Type = Enum.Parse("Altcorrection1"), - Page = 10, - HitsPerPage = 10, - } + new SearchParams( + new SearchParamsObject + { + Query = "query", + DisableTypoToleranceOnAttributes = new List { "serial_number" }, + } + ) ); // >LOG // SEPARATOR< } /// - /// Snippet for the SearchUserIds method. + /// Snippet for the SearchSingleIndex method. /// - /// searchUserIds + /// search_a_query /// - public async Task SnippetForSearchClientSearchUserIds() + public async Task SnippetForSearchClientSearchSingleIndex44() { - // >SEPARATOR searchUserIds default + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - var response = await client.SearchUserIdsAsync( - new SearchUserIdsParams - { - Query = "test", - ClusterName = "theClusterName", - Page = 5, - HitsPerPage = 10, - } + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "shirt" }) ); // >LOG // SEPARATOR< } /// - /// Snippet for the SetClientApiKey method. + /// Snippet for the SearchSingleIndex method. /// - /// switch API key + /// search_everything /// - public async Task SnippetForSearchClientSetClientApiKey() + public async Task SnippetForSearchClientSearchSingleIndex45() { - // >SEPARATOR setClientApiKey default + // >SEPARATOR searchSingleIndex search_everything // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - client.SetClientApiKey("updated-api-key"); + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "" }) + ); // >LOG // SEPARATOR< } /// - /// Snippet for the SetDictionarySettings method. + /// Snippet for the SearchSingleIndex method. /// - /// get setDictionarySettings results with minimal parameters + /// api_filtering_range_example /// - public async Task SnippetForSearchClientSetDictionarySettings() + public async Task SnippetForSearchClientSearchSingleIndex46() { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - var response = await client.SetDictionarySettingsAsync( - new DictionarySettingsParams - { - DisableStandardEntries = new StandardEntries - { - Plurals = new Dictionary - { - { "fr", false }, - { "en", false }, - { "ru", true }, - }, - }, - } + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "books", Filters = "price:10 TO 20" }) ); // >LOG // SEPARATOR< } /// - /// Snippet for the SetDictionarySettings method. + /// Snippet for the SearchSingleIndex method. /// - /// get setDictionarySettings results with all parameters + /// search_a_query /// - public async Task SnippetForSearchClientSetDictionarySettings1() + public async Task SnippetForSearchClientSearchSingleIndex47() { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // >SEPARATOR searchSingleIndex search_a_query + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "", + SimilarQuery = "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + Filters = "year:1991 TO 2001", + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_retrievable_attributes + /// + public async Task SnippetForSearchClientSearchSingleIndex48() + { + // >SEPARATOR searchSingleIndex override_retrievable_attributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToRetrieve = new List { "title", "content" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// restrict_searchable_attributes + /// + public async Task SnippetForSearchClientSearchSingleIndex49() + { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RestrictSearchableAttributes = new List { "title", "author" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_relevancy + /// + public async Task SnippetForSearchClientSearchSingleIndex50() + { + // >SEPARATOR searchSingleIndex override_default_relevancy + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", RelevancyStrictness = 70 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex51() + { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Filters = "(category:Book OR category:Ebook) AND _tags:published", + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_all_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex52() + { + // >SEPARATOR searchSingleIndex apply_all_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + 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\"", + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// escape_spaces + /// + public async Task SnippetForSearchClientSearchSingleIndex53() + { + // >SEPARATOR searchSingleIndex escape_spaces + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "category:\"Books and Comics\"" } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// escape_keywords + /// + public async Task SnippetForSearchClientSearchSingleIndex54() + { + // >SEPARATOR searchSingleIndex escape_keywords + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Filters = "keyword:\"OR\"" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// escape_single_quotes + /// + public async Task SnippetForSearchClientSearchSingleIndex55() + { + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "content:\"It's a wonderful day\"" } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// escape_double_quotes + /// + public async Task SnippetForSearchClientSearchSingleIndex56() + { + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "content:\"She said \"Hello World\"" } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex57() + { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalFilters = new OptionalFilters( + new List + { + new OptionalFilters("category:Book"), + new OptionalFilters("author:John Doe"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_negative_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex58() + { + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalFilters = new OptionalFilters( + new List + { + new OptionalFilters("category:Book"), + new OptionalFilters("author:-John Doe"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_numeric_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex59() + { + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + NumericFilters = new NumericFilters( + new List + { + new NumericFilters("price < 1000"), + new NumericFilters( + new List + { + new NumericFilters("inStock = 1"), + new NumericFilters("deliveryDate < 1441755506"), + } + ), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_tag_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex60() + { + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + TagFilters = new TagFilters( + new List + { + new TagFilters("SciFi"), + new TagFilters( + new List { new TagFilters("Book"), new TagFilters("Movie") } + ), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// apply_filters + /// + public async Task SnippetForSearchClientSearchSingleIndex61() + { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", SumOrFiltersScores = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// facets_all + /// + public async Task SnippetForSearchClientSearchSingleIndex62() + { + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Facets = new List { "*" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// retrieve_only_some_facets + /// + public async Task SnippetForSearchClientSearchSingleIndex63() + { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Facets = new List { "category", "author" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_max_values_per_facet + /// + public async Task SnippetForSearchClientSearchSingleIndex64() + { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", MaxValuesPerFacet = 20 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_faceting_after_distinct + /// + public async Task SnippetForSearchClientSearchSingleIndex65() + { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", FacetingAfterDistinct = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// sort_facet_values_alphabetically + /// + public async Task SnippetForSearchClientSearchSingleIndex66() + { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", SortFacetValuesBy = "count" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_attributes_to_snippet + /// + public async Task SnippetForSearchClientSearchSingleIndex67() + { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToSnippet = new List { "title", "content:80" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_highlight_pre_tag + /// + public async Task SnippetForSearchClientSearchSingleIndex68() + { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", HighlightPreTag = "" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_highlight_post_tag + /// + public async Task SnippetForSearchClientSearchSingleIndex69() + { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", HighlightPostTag = "" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_snippet_ellipsis_text + /// + public async Task SnippetForSearchClientSearchSingleIndex70() + { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", SnippetEllipsisText = "" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_restrict_highlight_and_snippet_arrays + /// + public async Task SnippetForSearchClientSearchSingleIndex71() + { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", RestrictHighlightAndSnippetArrays = false } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// access_page + /// + public async Task SnippetForSearchClientSearchSingleIndex72() + { + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Page = 0 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_hits_per_page + /// + public async Task SnippetForSearchClientSearchSingleIndex73() + { + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", HitsPerPage = 10 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// get_nth_hit + /// + public async Task SnippetForSearchClientSearchSingleIndex74() + { + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Offset = 4 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// get_n_results + /// + public async Task SnippetForSearchClientSearchSingleIndex75() + { + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Length = 4 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_min_word_size_for_one_typo + /// + public async Task SnippetForSearchClientSearchSingleIndex76() + { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", MinWordSizefor1Typo = 2 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_min_word_size_for_two_typos + /// + public async Task SnippetForSearchClientSearchSingleIndex77() + { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", MinWordSizefor2Typos = 2 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_typo_tolerance_mode + /// + public async Task SnippetForSearchClientSearchSingleIndex78() + { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", TypoTolerance = new TypoTolerance(false) } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disable_typos_on_numeric_tokens_at_search_time + /// + public async Task SnippetForSearchClientSearchSingleIndex79() + { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", AllowTyposOnNumericTokens = false } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_around_a_position + /// + public async Task SnippetForSearchClientSearchSingleIndex80() + { + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", AroundLatLng = "40.71, -74.01" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_around_server_ip + /// + public async Task SnippetForSearchClientSearchSingleIndex81() + { + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", AroundLatLngViaIP = true }), + new RequestOptionBuilder() + .AddExtraHeader( + "x-forwarded-for", + "94.228.178.246 // should be replaced with the actual IP you would like to search around" + ) + .Build() + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_around_radius + /// + public async Task SnippetForSearchClientSearchSingleIndex82() + { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", AroundRadius = new AroundRadius(1000) } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disable_automatic_radius + /// + public async Task SnippetForSearchClientSearchSingleIndex83() + { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AroundRadius = new AroundRadius(Enum.Parse("All")), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_geo_search_precision + /// + public async Task SnippetForSearchClientSearchSingleIndex84() + { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", AroundPrecision = new AroundPrecision(100) } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_geo_search_precision_non_linear + /// + public async Task SnippetForSearchClientSearchSingleIndex85() + { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AroundPrecision = new AroundPrecision( + new List + { + new Range { From = 0, Value = 25 }, + new Range { From = 2000, Value = 1000 }, + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_minimum_geo_search_radius + /// + public async Task SnippetForSearchClientSearchSingleIndex86() + { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", MinimumAroundRadius = 1000 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_inside_rectangular_area + /// + public async Task SnippetForSearchClientSearchSingleIndex87() + { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsideBoundingBox = new InsideBoundingBox( + new List> + { + new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 }, + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_inside_multiple_rectangular_areas + /// + public async Task SnippetForSearchClientSearchSingleIndex88() + { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsideBoundingBox = new InsideBoundingBox( + new List> + { + new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 }, + new List { 49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875 }, + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_inside_polygon_area + /// + public async Task SnippetForSearchClientSearchSingleIndex89() + { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsidePolygon = new List> + { + new List + { + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + }, + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// search_inside_multiple_polygon_areas + /// + public async Task SnippetForSearchClientSearchSingleIndex90() + { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsidePolygon = new List> + { + new List + { + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + }, + new List + { + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625, + }, + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_querylanguages_override + /// + public async Task SnippetForSearchClientSearchSingleIndex91() + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + IgnorePlurals = new IgnorePlurals( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_querylanguages_override + /// + public async Task SnippetForSearchClientSearchSingleIndex92() + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveStopWords = new RemoveStopWords( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_querylanguages_override + /// + public async Task SnippetForSearchClientSearchSingleIndex93() + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveStopWords = new RemoveStopWords( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_querylanguages_with_japanese_query + /// + public async Task SnippetForSearchClientSearchSingleIndex94() + { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + QueryLanguages = new List + { + Enum.Parse("Ja"), + Enum.Parse("En"), + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_natural_languages + /// + public async Task SnippetForSearchClientSearchSingleIndex95() + { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "", + NaturalLanguages = new List { Enum.Parse("Fr") }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_natural_languages_with_query + /// + public async Task SnippetForSearchClientSearchSingleIndex96() + { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "", + NaturalLanguages = new List { Enum.Parse("Fr") }, + RemoveWordsIfNoResults = Enum.Parse("FirstWords"), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_decompound_query_search_time + /// + public async Task SnippetForSearchClientSearchSingleIndex97() + { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", DecompoundQuery = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_rules_search_time + /// + public async Task SnippetForSearchClientSearchSingleIndex98() + { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", EnableRules = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_rule_contexts + /// + public async Task SnippetForSearchClientSearchSingleIndex99() + { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RuleContexts = new List { "front_end", "website2" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_personalization + /// + public async Task SnippetForSearchClientSearchSingleIndex100() + { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", EnablePersonalization = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_personalization_with_user_token + /// + public async Task SnippetForSearchClientSearchSingleIndex101() + { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + EnablePersonalization = true, + UserToken = "123456", + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// personalization_impact + /// + public async Task SnippetForSearchClientSearchSingleIndex102() + { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", PersonalizationImpact = 20 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_user_token + /// + public async Task SnippetForSearchClientSearchSingleIndex103() + { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", UserToken = "123456" }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_user_token_with_personalization + /// + public async Task SnippetForSearchClientSearchSingleIndex104() + { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + EnablePersonalization = true, + UserToken = "123456", + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_query_type + /// + public async Task SnippetForSearchClientSearchSingleIndex105() + { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", QueryType = Enum.Parse("PrefixAll") } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_remove_words_if_no_results + /// + public async Task SnippetForSearchClientSearchSingleIndex106() + { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveWordsIfNoResults = Enum.Parse("LastWords"), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_advanced_syntax_search_time + /// + public async Task SnippetForSearchClientSearchSingleIndex107() + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", AdvancedSyntax = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// overide_default_optional_words + /// + public async Task SnippetForSearchClientSearchSingleIndex108() + { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalWords = new OptionalWords(new List { "toyota", "2020 2021" }), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disabling_exact_for_some_attributes_search_time + /// + public async Task SnippetForSearchClientSearchSingleIndex109() + { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + DisableExactOnAttributes = new List { "description" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_exact_single_word_query + /// + public async Task SnippetForSearchClientSearchSingleIndex110() + { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + ExactOnSingleWordQuery = Enum.Parse("None"), + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_aternative_as_exact + /// + public async Task SnippetForSearchClientSearchSingleIndex111() + { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AlternativesAsExact = new List + { + Enum.Parse("MultiWordsSynonym"), + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_advanced_syntax_exact_phrase + /// + public async Task SnippetForSearchClientSearchSingleIndex112() + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExactPhrase"), + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_advanced_syntax_exclude_words + /// + public async Task SnippetForSearchClientSearchSingleIndex113() + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExcludeWords"), + }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_distinct + /// + public async Task SnippetForSearchClientSearchSingleIndex114() + { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Distinct = new Distinct(0) }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// get_ranking_info + /// + public async Task SnippetForSearchClientSearchSingleIndex115() + { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", GetRankingInfo = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disable_click_analytics + /// + public async Task SnippetForSearchClientSearchSingleIndex116() + { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", ClickAnalytics = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// enable_click_analytics + /// + public async Task SnippetForSearchClientSearchSingleIndex117() + { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", ClickAnalytics = true }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disable_analytics + /// + public async Task SnippetForSearchClientSearchSingleIndex118() + { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Analytics = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// add_analytics_tags + /// + public async Task SnippetForSearchClientSearchSingleIndex119() + { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AnalyticsTags = new List { "front_end", "website2" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// disable_synonyms + /// + public async Task SnippetForSearchClientSearchSingleIndex120() + { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", Synonyms = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_replace_synonyms_in_highlights + /// + public async Task SnippetForSearchClientSearchSingleIndex121() + { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject { Query = "query", ReplaceSynonymsInHighlight = true } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_min_proximity + /// + public async Task SnippetForSearchClientSearchSingleIndex122() + { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", MinProximity = 2 }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_default_field + /// + public async Task SnippetForSearchClientSearchSingleIndex123() + { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams( + new SearchParamsObject + { + Query = "query", + ResponseFields = new List { "hits", "facets" }, + } + ) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// override_percentile_computation + /// + public async Task SnippetForSearchClientSearchSingleIndex124() + { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", PercentileComputation = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_ab_test + /// + public async Task SnippetForSearchClientSearchSingleIndex125() + { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", EnableABTest = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSingleIndex method. + /// + /// set_enable_re_ranking + /// + public async Task SnippetForSearchClientSearchSingleIndex126() + { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSingleIndexAsync( + "", + new SearchParams(new SearchParamsObject { Query = "query", EnableReRanking = false }) + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSynonyms method. + /// + /// searchSynonyms with minimal parameters + /// + public async Task SnippetForSearchClientSearchSynonyms() + { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSynonymsAsync(""); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchSynonyms method. + /// + /// searchSynonyms with all parameters + /// + public async Task SnippetForSearchClientSearchSynonyms1() + { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchSynonymsAsync( + "", + new SearchSynonymsParams + { + Query = "myQuery", + Type = Enum.Parse("Altcorrection1"), + Page = 10, + HitsPerPage = 10, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SearchUserIds method. + /// + /// searchUserIds + /// + public async Task SnippetForSearchClientSearchUserIds() + { + // >SEPARATOR searchUserIds default + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SearchUserIdsAsync( + new SearchUserIdsParams + { + Query = "test", + ClusterName = "theClusterName", + Page = 5, + HitsPerPage = 10, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetClientApiKey method. + /// + /// switch API key + /// + public async Task SnippetForSearchClientSetClientApiKey() + { + // >SEPARATOR setClientApiKey default + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + client.SetClientApiKey("updated-api-key"); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetDictionarySettings method. + /// + /// get setDictionarySettings results with minimal parameters + /// + public async Task SnippetForSearchClientSetDictionarySettings() + { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetDictionarySettingsAsync( + new DictionarySettingsParams + { + DisableStandardEntries = new StandardEntries + { + Plurals = new Dictionary + { + { "fr", false }, + { "en", false }, + { "ru", true }, + }, + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetDictionarySettings method. + /// + /// get setDictionarySettings results with all parameters + /// + public async Task SnippetForSearchClientSetDictionarySettings1() + { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -5352,16 +7582,1539 @@ public async Task SnippetForSearchClientSetDictionarySettings1() var response = await client.SetDictionarySettingsAsync( new DictionarySettingsParams { - DisableStandardEntries = new StandardEntries + DisableStandardEntries = new StandardEntries + { + Plurals = new Dictionary + { + { "fr", false }, + { "en", false }, + { "ru", true }, + }, + Stopwords = new Dictionary { { "fr", false } }, + Compounds = new Dictionary { { "ru", true } }, + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// minimal parameters + /// + public async Task SnippetForSearchClientSetSettings() + { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { PaginationLimitedTo = 10 }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// boolean typoTolerance + /// + public async Task SnippetForSearchClientSetSettings1() + { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { TypoTolerance = new TypoTolerance(true) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// enum typoTolerance + /// + public async Task SnippetForSearchClientSetSettings2() + { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { TypoTolerance = new TypoTolerance(Enum.Parse("Min")) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// ignorePlurals + /// + public async Task SnippetForSearchClientSetSettings3() + { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { IgnorePlurals = new IgnorePlurals(true) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// list of string ignorePlurals + /// + public async Task SnippetForSearchClientSetSettings4() + { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + IgnorePlurals = new IgnorePlurals( + new List { Enum.Parse("Fr") } + ), + }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// removeStopWords boolean + /// + public async Task SnippetForSearchClientSetSettings5() + { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { RemoveStopWords = new RemoveStopWords(true) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// removeStopWords list of string + /// + public async Task SnippetForSearchClientSetSettings6() + { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + RemoveStopWords = new RemoveStopWords( + new List { Enum.Parse("Fr") } + ), + }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// boolean distinct + /// + public async Task SnippetForSearchClientSetSettings7() + { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Distinct = new Distinct(true) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// integer distinct + /// + public async Task SnippetForSearchClientSetSettings8() + { + // >SEPARATOR setSettings integer distinct + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Distinct = new Distinct(1) }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// distinct company + /// + public async Task SnippetForSearchClientSetSettings9() + { + // >SEPARATOR setSettings distinct company + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributeForDistinct = "company", Distinct = new Distinct(true) } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// distinct design + /// + public async Task SnippetForSearchClientSetSettings10() + { + // >SEPARATOR setSettings distinct design + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributeForDistinct = "design", Distinct = new Distinct(true) } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// distinct true + /// + public async Task SnippetForSearchClientSetSettings11() + { + // >SEPARATOR setSettings distinct true + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Distinct = new Distinct(true) } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// distinct section + /// + public async Task SnippetForSearchClientSetSettings12() + { + // >SEPARATOR setSettings distinct section + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributeForDistinct = "section", Distinct = new Distinct(true) } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting allergens + /// + public async Task SnippetForSearchClientSetSettings13() + { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "allergens" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// api_attributes_for_faceting + /// + public async Task SnippetForSearchClientSetSettings14() + { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "genre", "author" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// api_attributes_for_faceting_searchable + /// + public async Task SnippetForSearchClientSetSettings15() + { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "genre", "searchable(author)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// api_attributes_for_filter_only + /// + public async Task SnippetForSearchClientSetSettings16() + { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "filterOnly(genre)", "author" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting categoryPageId + /// + public async Task SnippetForSearchClientSetSettings17() + { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "searchable(categoryPageId)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// unretrievableAttributes + /// + public async Task SnippetForSearchClientSetSettings18() + { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { UnretrievableAttributes = new List { "visible_by" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting user restricted data + /// + public async Task SnippetForSearchClientSetSettings19() + { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "filterOnly(visible_by)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting optional filters + /// + public async Task SnippetForSearchClientSetSettings20() + { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "can_deliver_quickly", "restaurant" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting redirect index + /// + public async Task SnippetForSearchClientSetSettings21() + { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "query_terms" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting multiple consequences + /// + public async Task SnippetForSearchClientSetSettings22() + { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "director" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting in-depth optional filters + /// + public async Task SnippetForSearchClientSetSettings23() + { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "filterOnly(brand)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// mode neuralSearch + /// + public async Task SnippetForSearchClientSetSettings24() + { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Mode = Enum.Parse("NeuralSearch") } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// mode keywordSearch + /// + public async Task SnippetForSearchClientSetSettings25() + { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Mode = Enum.Parse("KeywordSearch") } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributes same priority + /// + public async Task SnippetForSearchClientSetSettings26() + { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "title,comments", "ingredients" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributes higher priority + /// + public async Task SnippetForSearchClientSetSettings27() + { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "title", "ingredients" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking retweets + /// + public async Task SnippetForSearchClientSetSettings28() + { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "desc(retweets)", "desc(likes)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking boosted + /// + public async Task SnippetForSearchClientSetSettings29() + { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { CustomRanking = new List { "desc(boosted)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking pageviews + /// + public async Task SnippetForSearchClientSetSettings30() + { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "desc(pageviews)", "desc(comments)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking applying search parameters for a specific query + /// + public async Task SnippetForSearchClientSetSettings31() + { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "desc(nb_airline_liaisons)" }, + AttributesForFaceting = new List { "city, country" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking rounded pageviews + /// + public async Task SnippetForSearchClientSetSettings32() + { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "desc(rounded_pageviews)", "desc(comments)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking price + /// + public async Task SnippetForSearchClientSetSettings33() + { + // >SEPARATOR setSettings customRanking price + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { CustomRanking = new List { "desc(price)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// ranking exhaustive + /// + public async Task SnippetForSearchClientSetSettings34() + { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + Ranking = new List + { + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// ranking standard replica + /// + public async Task SnippetForSearchClientSetSettings35() + { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Ranking = new List { "desc(post_date_timestamp)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// ranking virtual replica + /// + public async Task SnippetForSearchClientSetSettings36() + { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { CustomRanking = new List { "desc(post_date_timestamp)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// customRanking and ranking sort alphabetically + /// + public async Task SnippetForSearchClientSetSettings37() + { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "asc(textual_attribute)" }, + Ranking = new List + { + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// relevancyStrictness + /// + public async Task SnippetForSearchClientSetSettings38() + { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + CustomRanking = new List { "asc(textual_attribute)" }, + RelevancyStrictness = 0, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// create replica index + /// + public async Task SnippetForSearchClientSetSettings39() + { + // >SEPARATOR setSettings create replica index + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Replicas = new List { "products_price_desc" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// create replica index articles + /// + public async Task SnippetForSearchClientSetSettings40() + { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Replicas = new List { "articles_date_desc" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// create virtual replica index + /// + public async Task SnippetForSearchClientSetSettings41() + { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Replicas = new List { "virtual(products_price_desc)" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// unlink replica index + /// + public async Task SnippetForSearchClientSetSettings42() + { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Replicas = new List { "" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// forwardToReplicas + /// + public async Task SnippetForSearchClientSetSettings43() + { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "name", "description" }, + }, + true + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// maxValuesPerFacet + /// + public async Task SnippetForSearchClientSetSettings44() + { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { MaxValuesPerFacet = 1000 } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// maxFacetHits + /// + public async Task SnippetForSearchClientSetSettings45() + { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { MaxFacetHits = 1000 } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesForFaceting complex + /// + public async Task SnippetForSearchClientSetSettings46() + { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List + { + "actor", + "filterOnly(category)", + "searchable(publisher)", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// ranking closest dates + /// + public async Task SnippetForSearchClientSetSettings47() + { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + Ranking = new List + { + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributes item variation + /// + public async Task SnippetForSearchClientSetSettings48() + { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "design", "type", "color" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributes around location + /// + public async Task SnippetForSearchClientSetSettings49() + { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "name", "country", "code", "iata_code" }, + CustomRanking = new List { "desc(links_count)" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesToHighlight + /// + public async Task SnippetForSearchClientSetSettings50() + { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesToHighlight = new List { "author", "title", "content" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// attributesToHighlightStar + /// + public async Task SnippetForSearchClientSetSettings51() + { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AttributesToHighlight = new List { "*" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// everything + /// + public async Task SnippetForSearchClientSetSettings52() + { + // >SEPARATOR setSettings everything + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExactPhrase"), + }, + AllowCompressionOfIntegerArray = true, + AllowTyposOnNumericTokens = true, + AlternativesAsExact = new List + { + Enum.Parse("SingleWordSynonym"), + }, + AttributeCriteriaComputedByMinProximity = true, + AttributeForDistinct = "test", + AttributesForFaceting = new List { "algolia" }, + AttributesToHighlight = new List { "algolia" }, + AttributesToRetrieve = new List { "algolia" }, + AttributesToSnippet = new List { "algolia" }, + AttributesToTransliterate = new List { "algolia" }, + CamelCaseAttributes = new List { "algolia" }, + CustomNormalization = new Dictionary> + { + { + "algolia", + new Dictionary { { "aloglia", "aglolia" } } + }, + }, + CustomRanking = new List { "algolia" }, + DecompoundQuery = false, + DecompoundedAttributes = new Dictionary { { "algolia", "aloglia" } }, + DisableExactOnAttributes = new List { "algolia" }, + DisablePrefixOnAttributes = new List { "algolia" }, + DisableTypoToleranceOnAttributes = new List { "algolia" }, + DisableTypoToleranceOnWords = new List { "algolia" }, + Distinct = new Distinct(3), + EnablePersonalization = true, + EnableReRanking = false, + EnableRules = true, + ExactOnSingleWordQuery = Enum.Parse("Attribute"), + HighlightPreTag = "", + HighlightPostTag = "", + HitsPerPage = 10, + IgnorePlurals = new IgnorePlurals(false), + IndexLanguages = new List { Enum.Parse("Fr") }, + KeepDiacriticsOnCharacters = "abc", + MaxFacetHits = 20, + MaxValuesPerFacet = 30, + MinProximity = 6, + MinWordSizefor1Typo = 5, + MinWordSizefor2Typos = 11, + Mode = Enum.Parse("NeuralSearch"), + NumericAttributesForFiltering = new List { "algolia" }, + OptionalWords = new OptionalWords(new List { "myspace" }), + PaginationLimitedTo = 0, + QueryLanguages = new List { Enum.Parse("Fr") }, + QueryType = Enum.Parse("PrefixLast"), + Ranking = new List { "geo" }, + ReRankingApplyFilter = new ReRankingApplyFilter("mySearch:filters"), + RelevancyStrictness = 10, + RemoveStopWords = new RemoveStopWords(false), + RemoveWordsIfNoResults = Enum.Parse("LastWords"), + RenderingContent = new RenderingContent + { + FacetOrdering = new FacetOrdering + { + Facets = new Facets + { + Order = new List { "a", "b" }, + }, + Values = new Dictionary + { + { + "a", + new Value + { + Order = new List { "b" }, + SortRemainingBy = Enum.Parse("Count"), + } + }, + }, + }, + }, + ReplaceSynonymsInHighlight = true, + Replicas = new List { "" }, + ResponseFields = new List { "algolia" }, + RestrictHighlightAndSnippetArrays = true, + SearchableAttributes = new List { "foo" }, + SemanticSearch = new SemanticSearch { EventSources = new List { "foo" } }, + SeparatorsToIndex = "bar", + SnippetEllipsisText = "---", + SortFacetValuesBy = "date", + TypoTolerance = new TypoTolerance(false), + UnretrievableAttributes = new List { "foo" }, + UserData = new Dictionary { { "user", "data" } }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesWithCustomRankingsAndAttributesForFaceting + /// + public async Task SnippetForSearchClientSetSettings53() + { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List + { + "brand", + "name", + "categories", + "unordered(description)", + }, + CustomRanking = new List { "desc(popularity)" }, + AttributesForFaceting = new List + { + "searchable(brand)", + "type", + "categories", + "price", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesOrdering + /// + public async Task SnippetForSearchClientSetSettings54() + { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "unordered(title)", "cast" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesProductReferenceSuffixes + /// + public async Task SnippetForSearchClientSetSettings55() + { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List + { + "name", + "product_reference", + "product_reference_suffixes", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// queryLanguageAndIgnorePlurals + /// + public async Task SnippetForSearchClientSetSettings56() + { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + QueryLanguages = new List { Enum.Parse("En") }, + IgnorePlurals = new IgnorePlurals(true), + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesInMovies + /// + public async Task SnippetForSearchClientSetSettings57() + { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "title_eng", "title_fr", "title_es" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// disablePrefixOnAttributes + /// + public async Task SnippetForSearchClientSetSettings58() + { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { DisablePrefixOnAttributes = new List { "serial_number" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// disableTypoToleranceOnAttributes + /// + public async Task SnippetForSearchClientSetSettings59() + { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesSimpleExample + /// + public async Task SnippetForSearchClientSetSettings60() + { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { SearchableAttributes = new List { "serial_number" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// searchableAttributesSimpleExampleAlt + /// + public async Task SnippetForSearchClientSetSettings61() + { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { "serial_number", "serial_number_suffixes" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// set_searchable_attributes + /// + public async Task SnippetForSearchClientSetSettings62() + { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + SearchableAttributes = new List { - Plurals = new Dictionary - { - { "fr", false }, - { "en", false }, - { "ru", true }, - }, - Stopwords = new Dictionary { { "fr", false } }, - Compounds = new Dictionary { { "ru", true } }, + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", }, } ); @@ -5372,19 +9125,28 @@ public async Task SnippetForSearchClientSetDictionarySettings1() /// /// Snippet for the SetSettings method. /// - /// minimal parameters + /// set_searchable_attributes /// - public async Task SnippetForSearchClientSetSettings() + public async Task SnippetForSearchClientSetSettings63() { - // >SEPARATOR setSettings minimal parameters + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { PaginationLimitedTo = 10 }, - true + new IndexSettings + { + AttributesForFaceting = new List + { + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + }, + } ); // >LOG // SEPARATOR< @@ -5393,19 +9155,18 @@ public async Task SnippetForSearchClientSetSettings() /// /// Snippet for the SetSettings method. /// - /// boolean typoTolerance + /// unretrievable_attributes /// - public async Task SnippetForSearchClientSetSettings1() + public async Task SnippetForSearchClientSetSettings64() { - // >SEPARATOR setSettings boolean typoTolerance + // >SEPARATOR setSettings unretrievable_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { TypoTolerance = new TypoTolerance(true) }, - true + new IndexSettings { UnretrievableAttributes = new List { "total_number_of_sales" } } ); // >LOG // SEPARATOR< @@ -5414,19 +9175,21 @@ public async Task SnippetForSearchClientSetSettings1() /// /// Snippet for the SetSettings method. /// - /// enum typoTolerance + /// set_retrievable_attributes /// - public async Task SnippetForSearchClientSetSettings2() + public async Task SnippetForSearchClientSetSettings65() { - // >SEPARATOR setSettings enum typoTolerance + // >SEPARATOR setSettings set_retrievable_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { TypoTolerance = new TypoTolerance(Enum.Parse("Min")) }, - true + new IndexSettings + { + AttributesToRetrieve = new List { "author", "title", "content" }, + } ); // >LOG // SEPARATOR< @@ -5435,19 +9198,148 @@ public async Task SnippetForSearchClientSetSettings2() /// /// Snippet for the SetSettings method. /// - /// ignorePlurals + /// set_all_attributes_as_retrievable /// - public async Task SnippetForSearchClientSetSettings3() + public async Task SnippetForSearchClientSetSettings66() { - // >SEPARATOR setSettings ignorePlurals + // >SEPARATOR setSettings set_all_attributes_as_retrievable // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { IgnorePlurals = new IgnorePlurals(true) }, - true + new IndexSettings { AttributesToRetrieve = new List { "*" } } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// specify_attributes_not_to_retrieve + /// + public async Task SnippetForSearchClientSetSettings67() + { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesToRetrieve = new List { "*", "-SKU", "-internal_desc" }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// neural_search + /// + public async Task SnippetForSearchClientSetSettings68() + { + // >SEPARATOR setSettings neural_search + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Mode = Enum.Parse("NeuralSearch") } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// keyword_search + /// + public async Task SnippetForSearchClientSetSettings69() + { + // >SEPARATOR setSettings keyword_search + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings { Mode = Enum.Parse("KeywordSearch") } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// set_default_ranking + /// + public async Task SnippetForSearchClientSetSettings70() + { + // >SEPARATOR setSettings set_default_ranking + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + Ranking = new List + { + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + }, + } + ); + // >LOG + // SEPARATOR< + } + + /// + /// Snippet for the SetSettings method. + /// + /// set_ranking_by_attribute_asc + /// + public async Task SnippetForSearchClientSetSettings71() + { + // >SEPARATOR setSettings set_ranking_by_attribute_asc + // Initialize the client + var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); + + // Call the API + var response = await client.SetSettingsAsync( + "", + new IndexSettings + { + Ranking = new List + { + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } ); // >LOG // SEPARATOR< @@ -5456,11 +9348,11 @@ public async Task SnippetForSearchClientSetSettings3() /// /// Snippet for the SetSettings method. /// - /// list of string ignorePlurals + /// set_ranking_by_attribute_desc /// - public async Task SnippetForSearchClientSetSettings4() + public async Task SnippetForSearchClientSetSettings72() { - // >SEPARATOR setSettings list of string ignorePlurals + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -5469,11 +9361,19 @@ public async Task SnippetForSearchClientSetSettings4() "", new IndexSettings { - IgnorePlurals = new IgnorePlurals( - new List { Enum.Parse("Fr") } - ), - }, - true + Ranking = new List + { + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } ); // >LOG // SEPARATOR< @@ -5482,19 +9382,21 @@ public async Task SnippetForSearchClientSetSettings4() /// /// Snippet for the SetSettings method. /// - /// removeStopWords boolean + /// restrict_searchable_attributes /// - public async Task SnippetForSearchClientSetSettings5() + public async Task SnippetForSearchClientSetSettings73() { - // >SEPARATOR setSettings removeStopWords boolean + // >SEPARATOR setSettings restrict_searchable_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { RemoveStopWords = new RemoveStopWords(true) }, - true + new IndexSettings + { + CustomRanking = new List { "desc(popularity)", "asc(price)" }, + } ); // >LOG // SEPARATOR< @@ -5503,24 +9405,18 @@ public async Task SnippetForSearchClientSetSettings5() /// /// Snippet for the SetSettings method. /// - /// removeStopWords list of string + /// set_default_relevancy /// - public async Task SnippetForSearchClientSetSettings6() + public async Task SnippetForSearchClientSetSettings74() { - // >SEPARATOR setSettings removeStopWords list of string + // >SEPARATOR setSettings set_default_relevancy // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - RemoveStopWords = new RemoveStopWords( - new List { Enum.Parse("Fr") } - ), - }, - true + new IndexSettings { RelevancyStrictness = 90 } ); // >LOG // SEPARATOR< @@ -5529,19 +9425,21 @@ public async Task SnippetForSearchClientSetSettings6() /// /// Snippet for the SetSettings method. /// - /// boolean distinct + /// set_replicas /// - public async Task SnippetForSearchClientSetSettings7() + public async Task SnippetForSearchClientSetSettings75() { - // >SEPARATOR setSettings boolean distinct + // >SEPARATOR setSettings set_replicas // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Distinct = new Distinct(true) }, - true + new IndexSettings + { + Replicas = new List { "name_of_replica_index1", "name_of_replica_index2" }, + } ); // >LOG // SEPARATOR< @@ -5550,19 +9448,18 @@ public async Task SnippetForSearchClientSetSettings7() /// /// Snippet for the SetSettings method. /// - /// integer distinct + /// set_default_max_values_per_facet /// - public async Task SnippetForSearchClientSetSettings8() + public async Task SnippetForSearchClientSetSettings76() { - // >SEPARATOR setSettings integer distinct + // >SEPARATOR setSettings set_default_max_values_per_facet // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Distinct = new Distinct(1) }, - true + new IndexSettings { MaxValuesPerFacet = 100 } ); // >LOG // SEPARATOR< @@ -5571,18 +9468,18 @@ public async Task SnippetForSearchClientSetSettings8() /// /// Snippet for the SetSettings method. /// - /// distinct company + /// set_default_sort_facet_values_by /// - public async Task SnippetForSearchClientSetSettings9() + public async Task SnippetForSearchClientSetSettings77() { - // >SEPARATOR setSettings distinct company + // >SEPARATOR setSettings set_default_sort_facet_values_by // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributeForDistinct = "company", Distinct = new Distinct(true) } + new IndexSettings { SortFacetValuesBy = "alpha" } ); // >LOG // SEPARATOR< @@ -5591,18 +9488,21 @@ public async Task SnippetForSearchClientSetSettings9() /// /// Snippet for the SetSettings method. /// - /// distinct design + /// set_attributes_to_snippet /// - public async Task SnippetForSearchClientSetSettings10() + public async Task SnippetForSearchClientSetSettings78() { - // >SEPARATOR setSettings distinct design + // >SEPARATOR setSettings set_attributes_to_snippet // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributeForDistinct = "design", Distinct = new Distinct(true) } + new IndexSettings + { + AttributesToSnippet = new List { "content:80", "description" }, + } ); // >LOG // SEPARATOR< @@ -5611,18 +9511,18 @@ public async Task SnippetForSearchClientSetSettings10() /// /// Snippet for the SetSettings method. /// - /// distinct true + /// set_all_attributes_to_snippet /// - public async Task SnippetForSearchClientSetSettings11() + public async Task SnippetForSearchClientSetSettings79() { - // >SEPARATOR setSettings distinct true + // >SEPARATOR setSettings set_all_attributes_to_snippet // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Distinct = new Distinct(true) } + new IndexSettings { AttributesToSnippet = new List { "*:80" } } ); // >LOG // SEPARATOR< @@ -5631,18 +9531,18 @@ public async Task SnippetForSearchClientSetSettings11() /// /// Snippet for the SetSettings method. /// - /// distinct section + /// set_default_highlight_pre_tag /// - public async Task SnippetForSearchClientSetSettings12() + public async Task SnippetForSearchClientSetSettings80() { - // >SEPARATOR setSettings distinct section + // >SEPARATOR setSettings set_default_highlight_pre_tag // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributeForDistinct = "section", Distinct = new Distinct(true) } + new IndexSettings { HighlightPreTag = "" } ); // >LOG // SEPARATOR< @@ -5651,18 +9551,18 @@ public async Task SnippetForSearchClientSetSettings12() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting allergens + /// set_default_highlight_post_tag /// - public async Task SnippetForSearchClientSetSettings13() + public async Task SnippetForSearchClientSetSettings81() { - // >SEPARATOR setSettings attributesForFaceting allergens + // >SEPARATOR setSettings set_default_highlight_post_tag // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributesForFaceting = new List { "allergens" } } + new IndexSettings { HighlightPostTag = "" } ); // >LOG // SEPARATOR< @@ -5671,21 +9571,18 @@ public async Task SnippetForSearchClientSetSettings13() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting categoryPageId + /// set_default_snippet_ellipsis_text /// - public async Task SnippetForSearchClientSetSettings14() + public async Task SnippetForSearchClientSetSettings82() { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + // >SEPARATOR setSettings set_default_snippet_ellipsis_text // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - AttributesForFaceting = new List { "searchable(categoryPageId)" }, - } + new IndexSettings { SnippetEllipsisText = "…" } ); // >LOG // SEPARATOR< @@ -5694,18 +9591,18 @@ public async Task SnippetForSearchClientSetSettings14() /// /// Snippet for the SetSettings method. /// - /// unretrievableAttributes + /// enable_restrict_highlight_and_snippet_arrays_by_default /// - public async Task SnippetForSearchClientSetSettings15() + public async Task SnippetForSearchClientSetSettings83() { - // >SEPARATOR setSettings unretrievableAttributes + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { UnretrievableAttributes = new List { "visible_by" } } + new IndexSettings { RestrictHighlightAndSnippetArrays = true } ); // >LOG // SEPARATOR< @@ -5714,18 +9611,18 @@ public async Task SnippetForSearchClientSetSettings15() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting user restricted data + /// set_default_hits_per_page /// - public async Task SnippetForSearchClientSetSettings16() + public async Task SnippetForSearchClientSetSettings84() { - // >SEPARATOR setSettings attributesForFaceting user restricted data + // >SEPARATOR setSettings set_default_hits_per_page // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributesForFaceting = new List { "filterOnly(visible_by)" } } + new IndexSettings { HitsPerPage = 20 } ); // >LOG // SEPARATOR< @@ -5734,21 +9631,18 @@ public async Task SnippetForSearchClientSetSettings16() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting optional filters + /// set_pagination_limit /// - public async Task SnippetForSearchClientSetSettings17() + public async Task SnippetForSearchClientSetSettings85() { - // >SEPARATOR setSettings attributesForFaceting optional filters + // >SEPARATOR setSettings set_pagination_limit // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - AttributesForFaceting = new List { "can_deliver_quickly", "restaurant" }, - } + new IndexSettings { PaginationLimitedTo = 1000 } ); // >LOG // SEPARATOR< @@ -5757,18 +9651,18 @@ public async Task SnippetForSearchClientSetSettings17() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting redirect index + /// set_default_min_word_size_for_one_typo /// - public async Task SnippetForSearchClientSetSettings18() + public async Task SnippetForSearchClientSetSettings86() { - // >SEPARATOR setSettings attributesForFaceting redirect index + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributesForFaceting = new List { "query_terms" } } + new IndexSettings { MinWordSizefor1Typo = 4 } ); // >LOG // SEPARATOR< @@ -5777,18 +9671,18 @@ public async Task SnippetForSearchClientSetSettings18() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting multiple consequences + /// set_default_min_word_size_for_two_typos /// - public async Task SnippetForSearchClientSetSettings19() + public async Task SnippetForSearchClientSetSettings87() { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributesForFaceting = new List { "director" } } + new IndexSettings { MinWordSizefor2Typos = 4 } ); // >LOG // SEPARATOR< @@ -5797,18 +9691,18 @@ public async Task SnippetForSearchClientSetSettings19() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting in-depth optional filters + /// set_default_typo_tolerance_mode /// - public async Task SnippetForSearchClientSetSettings20() + public async Task SnippetForSearchClientSetSettings88() { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // >SEPARATOR setSettings set_default_typo_tolerance_mode // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { AttributesForFaceting = new List { "filterOnly(brand)" } } + new IndexSettings { TypoTolerance = new TypoTolerance(true) } ); // >LOG // SEPARATOR< @@ -5817,18 +9711,18 @@ public async Task SnippetForSearchClientSetSettings20() /// /// Snippet for the SetSettings method. /// - /// mode neuralSearch + /// disable_typos_on_numeric_tokens_by_default /// - public async Task SnippetForSearchClientSetSettings21() + public async Task SnippetForSearchClientSetSettings89() { - // >SEPARATOR setSettings mode neuralSearch + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Mode = Enum.Parse("NeuralSearch") } + new IndexSettings { AllowTyposOnNumericTokens = false } ); // >LOG // SEPARATOR< @@ -5837,18 +9731,21 @@ public async Task SnippetForSearchClientSetSettings21() /// /// Snippet for the SetSettings method. /// - /// mode keywordSearch + /// disable_typo_tolerance_for_words /// - public async Task SnippetForSearchClientSetSettings22() + public async Task SnippetForSearchClientSetSettings90() { - // >SEPARATOR setSettings mode keywordSearch + // >SEPARATOR setSettings disable_typo_tolerance_for_words // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Mode = Enum.Parse("KeywordSearch") } + new IndexSettings + { + DisableTypoToleranceOnWords = new List { "wheel", "1X2BCD" }, + } ); // >LOG // SEPARATOR< @@ -5857,21 +9754,18 @@ public async Task SnippetForSearchClientSetSettings22() /// /// Snippet for the SetSettings method. /// - /// searchableAttributes same priority + /// set_separators_to_index /// - public async Task SnippetForSearchClientSetSettings23() + public async Task SnippetForSearchClientSetSettings91() { - // >SEPARATOR setSettings searchableAttributes same priority + // >SEPARATOR setSettings set_separators_to_index // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - SearchableAttributes = new List { "title,comments", "ingredients" }, - } + new IndexSettings { SeparatorsToIndex = "+#" } ); // >LOG // SEPARATOR< @@ -5880,11 +9774,11 @@ public async Task SnippetForSearchClientSetSettings23() /// /// Snippet for the SetSettings method. /// - /// searchableAttributes higher priority + /// set_languages_using_querylanguages /// - public async Task SnippetForSearchClientSetSettings24() + public async Task SnippetForSearchClientSetSettings92() { - // >SEPARATOR setSettings searchableAttributes higher priority + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -5893,7 +9787,8 @@ public async Task SnippetForSearchClientSetSettings24() "", new IndexSettings { - SearchableAttributes = new List { "title", "ingredients" }, + QueryLanguages = new List { Enum.Parse("Es") }, + IgnorePlurals = new IgnorePlurals(true), } ); // >LOG @@ -5903,11 +9798,11 @@ public async Task SnippetForSearchClientSetSettings24() /// /// Snippet for the SetSettings method. /// - /// customRanking retweets + /// set_attributes_to_transliterate /// - public async Task SnippetForSearchClientSetSettings25() + public async Task SnippetForSearchClientSetSettings93() { - // >SEPARATOR setSettings customRanking retweets + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -5916,7 +9811,8 @@ public async Task SnippetForSearchClientSetSettings25() "", new IndexSettings { - CustomRanking = new List { "desc(retweets)", "desc(likes)" }, + IndexLanguages = new List { Enum.Parse("Ja") }, + AttributesToTransliterate = new List { "name", "description" }, } ); // >LOG @@ -5926,18 +9822,22 @@ public async Task SnippetForSearchClientSetSettings25() /// /// Snippet for the SetSettings method. /// - /// customRanking boosted + /// set_languages_using_querylanguages /// - public async Task SnippetForSearchClientSetSettings26() + public async Task SnippetForSearchClientSetSettings94() { - // >SEPARATOR setSettings customRanking boosted + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { CustomRanking = new List { "desc(boosted)" } } + new IndexSettings + { + QueryLanguages = new List { Enum.Parse("Es") }, + RemoveStopWords = new RemoveStopWords(true), + } ); // >LOG // SEPARATOR< @@ -5946,21 +9846,18 @@ public async Task SnippetForSearchClientSetSettings26() /// /// Snippet for the SetSettings method. /// - /// customRanking pageviews + /// set_camel_case_attributes /// - public async Task SnippetForSearchClientSetSettings27() + public async Task SnippetForSearchClientSetSettings95() { - // >SEPARATOR setSettings customRanking pageviews + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - CustomRanking = new List { "desc(pageviews)", "desc(comments)" }, - } + new IndexSettings { CamelCaseAttributes = new List { "description" } } ); // >LOG // SEPARATOR< @@ -5969,11 +9866,11 @@ public async Task SnippetForSearchClientSetSettings27() /// /// Snippet for the SetSettings method. /// - /// customRanking applying search parameters for a specific query + /// set_decompounded_attributes /// - public async Task SnippetForSearchClientSetSettings28() + public async Task SnippetForSearchClientSetSettings96() { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -5982,8 +9879,13 @@ public async Task SnippetForSearchClientSetSettings28() "", new IndexSettings { - CustomRanking = new List { "desc(nb_airline_liaisons)" }, - AttributesForFaceting = new List { "city, country" }, + DecompoundedAttributes = new Dictionary> + { + { + "de", + new List { "name" } + }, + }, } ); // >LOG @@ -5993,11 +9895,11 @@ public async Task SnippetForSearchClientSetSettings28() /// /// Snippet for the SetSettings method. /// - /// customRanking rounded pageviews + /// set_decompounded_multiple_attributes /// - public async Task SnippetForSearchClientSetSettings29() + public async Task SnippetForSearchClientSetSettings97() { - // >SEPARATOR setSettings customRanking rounded pageviews + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6006,7 +9908,17 @@ public async Task SnippetForSearchClientSetSettings29() "", new IndexSettings { - CustomRanking = new List { "desc(rounded_pageviews)", "desc(comments)" }, + DecompoundedAttributes = new Dictionary> + { + { + "de", + new List { "name_de", "description_de" } + }, + { + "fi", + new List { "name_fi", "description_fi" } + }, + }, } ); // >LOG @@ -6016,18 +9928,18 @@ public async Task SnippetForSearchClientSetSettings29() /// /// Snippet for the SetSettings method. /// - /// customRanking price + /// set_keep_diacritics_on_characters /// - public async Task SnippetForSearchClientSetSettings30() + public async Task SnippetForSearchClientSetSettings98() { - // >SEPARATOR setSettings customRanking price + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { CustomRanking = new List { "desc(price)" } } + new IndexSettings { KeepDiacriticsOnCharacters = "øé" } ); // >LOG // SEPARATOR< @@ -6036,11 +9948,11 @@ public async Task SnippetForSearchClientSetSettings30() /// /// Snippet for the SetSettings method. /// - /// ranking exhaustive + /// set_custom_normalization /// - public async Task SnippetForSearchClientSetSettings31() + public async Task SnippetForSearchClientSetSettings99() { - // >SEPARATOR setSettings ranking exhaustive + // >SEPARATOR setSettings set_custom_normalization // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6049,17 +9961,12 @@ public async Task SnippetForSearchClientSetSettings31() "", new IndexSettings { - Ranking = new List + CustomNormalization = new Dictionary> { - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + { + "default", + new Dictionary { { "ä", "ae" } } + }, }, } ); @@ -6070,18 +9977,23 @@ public async Task SnippetForSearchClientSetSettings31() /// /// Snippet for the SetSettings method. /// - /// ranking standard replica + /// set_languages_using_querylanguages /// - public async Task SnippetForSearchClientSetSettings32() + public async Task SnippetForSearchClientSetSettings100() { - // >SEPARATOR setSettings ranking standard replica + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Ranking = new List { "desc(post_date_timestamp)" } } + new IndexSettings + { + QueryLanguages = new List { Enum.Parse("Es") }, + RemoveStopWords = new RemoveStopWords(true), + IgnorePlurals = new IgnorePlurals(true), + } ); // >LOG // SEPARATOR< @@ -6090,18 +10002,21 @@ public async Task SnippetForSearchClientSetSettings32() /// /// Snippet for the SetSettings method. /// - /// ranking virtual replica + /// set_indexlanguages /// - public async Task SnippetForSearchClientSetSettings33() + public async Task SnippetForSearchClientSetSettings101() { - // >SEPARATOR setSettings ranking virtual replica + // >SEPARATOR setSettings set_indexlanguages // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { CustomRanking = new List { "desc(post_date_timestamp)" } } + new IndexSettings + { + IndexLanguages = new List { Enum.Parse("Ja") }, + } ); // >LOG // SEPARATOR< @@ -6110,32 +10025,18 @@ public async Task SnippetForSearchClientSetSettings33() /// /// Snippet for the SetSettings method. /// - /// customRanking and ranking sort alphabetically + /// enable_decompound_query_by_default /// - public async Task SnippetForSearchClientSetSettings34() + public async Task SnippetForSearchClientSetSettings102() { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - CustomRanking = new List { "asc(textual_attribute)" }, - Ranking = new List - { - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - }, - } + new IndexSettings { DecompoundQuery = true } ); // >LOG // SEPARATOR< @@ -6144,22 +10045,18 @@ public async Task SnippetForSearchClientSetSettings34() /// /// Snippet for the SetSettings method. /// - /// relevancyStrictness + /// enable_rules_syntax_by_default /// - public async Task SnippetForSearchClientSetSettings35() + public async Task SnippetForSearchClientSetSettings103() { - // >SEPARATOR setSettings relevancyStrictness + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - CustomRanking = new List { "asc(textual_attribute)" }, - RelevancyStrictness = 0, - } + new IndexSettings { EnableRules = true } ); // >LOG // SEPARATOR< @@ -6168,18 +10065,18 @@ public async Task SnippetForSearchClientSetSettings35() /// /// Snippet for the SetSettings method. /// - /// create replica index + /// enable_personalization_settings /// - public async Task SnippetForSearchClientSetSettings36() + public async Task SnippetForSearchClientSetSettings104() { - // >SEPARATOR setSettings create replica index + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Replicas = new List { "products_price_desc" } } + new IndexSettings { EnablePersonalization = true } ); // >LOG // SEPARATOR< @@ -6188,18 +10085,18 @@ public async Task SnippetForSearchClientSetSettings36() /// /// Snippet for the SetSettings method. /// - /// create virtual replica index + /// set_default_query_type /// - public async Task SnippetForSearchClientSetSettings37() + public async Task SnippetForSearchClientSetSettings105() { - // >SEPARATOR setSettings create virtual replica index + // >SEPARATOR setSettings set_default_query_type // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Replicas = new List { "virtual(products_price_desc)" } } + new IndexSettings { QueryType = Enum.Parse("PrefixLast") } ); // >LOG // SEPARATOR< @@ -6208,18 +10105,18 @@ public async Task SnippetForSearchClientSetSettings37() /// /// Snippet for the SetSettings method. /// - /// unlink replica index + /// set_default_remove_words_if_no_result /// - public async Task SnippetForSearchClientSetSettings38() + public async Task SnippetForSearchClientSetSettings106() { - // >SEPARATOR setSettings unlink replica index + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { Replicas = new List { "" } } + new IndexSettings { RemoveWordsIfNoResults = Enum.Parse("None") } ); // >LOG // SEPARATOR< @@ -6228,22 +10125,18 @@ public async Task SnippetForSearchClientSetSettings38() /// /// Snippet for the SetSettings method. /// - /// forwardToReplicas + /// enable_advanced_syntax_by_default /// - public async Task SnippetForSearchClientSetSettings39() + public async Task SnippetForSearchClientSetSettings107() { - // >SEPARATOR setSettings forwardToReplicas + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API - var response = await client.SetSettingsAsync( - "", - new IndexSettings - { - SearchableAttributes = new List { "name", "description" }, - }, - true + var response = await client.SetSettingsAsync( + "", + new IndexSettings { AdvancedSyntax = true } ); // >LOG // SEPARATOR< @@ -6252,18 +10145,21 @@ public async Task SnippetForSearchClientSetSettings39() /// /// Snippet for the SetSettings method. /// - /// maxValuesPerFacet + /// set_default_optional_words /// - public async Task SnippetForSearchClientSetSettings40() + public async Task SnippetForSearchClientSetSettings108() { - // >SEPARATOR setSettings maxValuesPerFacet + // >SEPARATOR setSettings set_default_optional_words // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { MaxValuesPerFacet = 1000 } + new IndexSettings + { + OptionalWords = new OptionalWords(new List { "blue", "iphone case" }), + } ); // >LOG // SEPARATOR< @@ -6272,18 +10168,18 @@ public async Task SnippetForSearchClientSetSettings40() /// /// Snippet for the SetSettings method. /// - /// maxFacetHits + /// disabling_prefix_search_for_some_attributes_by_default /// - public async Task SnippetForSearchClientSetSettings41() + public async Task SnippetForSearchClientSetSettings109() { - // >SEPARATOR setSettings maxFacetHits + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { MaxFacetHits = 1000 } + new IndexSettings { DisablePrefixOnAttributes = new List { "sku" } } ); // >LOG // SEPARATOR< @@ -6292,26 +10188,18 @@ public async Task SnippetForSearchClientSetSettings41() /// /// Snippet for the SetSettings method. /// - /// attributesForFaceting complex + /// disabling_exact_for_some_attributes_by_default /// - public async Task SnippetForSearchClientSetSettings42() + public async Task SnippetForSearchClientSetSettings110() { - // >SEPARATOR setSettings attributesForFaceting complex + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - AttributesForFaceting = new List - { - "actor", - "filterOnly(category)", - "searchable(publisher)", - }, - } + new IndexSettings { DisableExactOnAttributes = new List { "description" } } ); // >LOG // SEPARATOR< @@ -6320,32 +10208,18 @@ public async Task SnippetForSearchClientSetSettings42() /// /// Snippet for the SetSettings method. /// - /// ranking closest dates + /// set_default_exact_single_word_query /// - public async Task SnippetForSearchClientSetSettings43() + public async Task SnippetForSearchClientSetSettings111() { - // >SEPARATOR setSettings ranking closest dates + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - Ranking = new List - { - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - }, - } + new IndexSettings { ExactOnSingleWordQuery = Enum.Parse("Attribute") } ); // >LOG // SEPARATOR< @@ -6354,11 +10228,11 @@ public async Task SnippetForSearchClientSetSettings43() /// /// Snippet for the SetSettings method. /// - /// searchableAttributes item variation + /// set_default_aternative_as_exact /// - public async Task SnippetForSearchClientSetSettings44() + public async Task SnippetForSearchClientSetSettings112() { - // >SEPARATOR setSettings searchableAttributes item variation + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6367,7 +10241,11 @@ public async Task SnippetForSearchClientSetSettings44() "", new IndexSettings { - SearchableAttributes = new List { "design", "type", "color" }, + AlternativesAsExact = new List + { + Enum.Parse("IgnorePlurals"), + Enum.Parse("SingleWordSynonym"), + }, } ); // >LOG @@ -6377,22 +10255,18 @@ public async Task SnippetForSearchClientSetSettings44() /// /// Snippet for the SetSettings method. /// - /// searchableAttributes around location + /// enable_advanced_syntax_by_default /// - public async Task SnippetForSearchClientSetSettings45() + public async Task SnippetForSearchClientSetSettings113() { - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - SearchableAttributes = new List { "name", "country", "code", "iata_code" }, - CustomRanking = new List { "desc(links_count)" }, - } + new IndexSettings { AdvancedSyntax = true } ); // >LOG // SEPARATOR< @@ -6401,11 +10275,11 @@ public async Task SnippetForSearchClientSetSettings45() /// /// Snippet for the SetSettings method. /// - /// searchableAttributes around location + /// set_numeric_attributes_for_filtering /// - public async Task SnippetForSearchClientSetSettings46() + public async Task SnippetForSearchClientSetSettings114() { - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6414,8 +10288,7 @@ public async Task SnippetForSearchClientSetSettings46() "", new IndexSettings { - SearchableAttributes = new List { "name", "country", "code", "iata_code" }, - CustomRanking = new List { "desc(links_count)" }, + NumericAttributesForFiltering = new List { "quantity", "popularity" }, } ); // >LOG @@ -6425,18 +10298,18 @@ public async Task SnippetForSearchClientSetSettings46() /// /// Snippet for the SetSettings method. /// - /// disableTypoToleranceOnAttributes + /// enable_compression_of_integer_array /// - public async Task SnippetForSearchClientSetSettings47() + public async Task SnippetForSearchClientSetSettings115() { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } + new IndexSettings { AllowCompressionOfIntegerArray = true } ); // >LOG // SEPARATOR< @@ -6445,113 +10318,18 @@ public async Task SnippetForSearchClientSetSettings47() /// /// Snippet for the SetSettings method. /// - /// everything + /// set_attributes_for_distinct /// - public async Task SnippetForSearchClientSetSettings48() + public async Task SnippetForSearchClientSetSettings116() { - // >SEPARATOR setSettings everything + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - AdvancedSyntax = true, - AdvancedSyntaxFeatures = new List - { - Enum.Parse("ExactPhrase"), - }, - AllowCompressionOfIntegerArray = true, - AllowTyposOnNumericTokens = true, - AlternativesAsExact = new List - { - Enum.Parse("SingleWordSynonym"), - }, - AttributeCriteriaComputedByMinProximity = true, - AttributeForDistinct = "test", - AttributesForFaceting = new List { "algolia" }, - AttributesToHighlight = new List { "algolia" }, - AttributesToRetrieve = new List { "algolia" }, - AttributesToSnippet = new List { "algolia" }, - AttributesToTransliterate = new List { "algolia" }, - CamelCaseAttributes = new List { "algolia" }, - CustomNormalization = new Dictionary> - { - { - "algolia", - new Dictionary { { "aloglia", "aglolia" } } - }, - }, - CustomRanking = new List { "algolia" }, - DecompoundQuery = false, - DecompoundedAttributes = new Dictionary { { "algolia", "aloglia" } }, - DisableExactOnAttributes = new List { "algolia" }, - DisablePrefixOnAttributes = new List { "algolia" }, - DisableTypoToleranceOnAttributes = new List { "algolia" }, - DisableTypoToleranceOnWords = new List { "algolia" }, - Distinct = new Distinct(3), - EnablePersonalization = true, - EnableReRanking = false, - EnableRules = true, - ExactOnSingleWordQuery = Enum.Parse("Attribute"), - HighlightPreTag = "", - HighlightPostTag = "", - HitsPerPage = 10, - IgnorePlurals = new IgnorePlurals(false), - IndexLanguages = new List { Enum.Parse("Fr") }, - KeepDiacriticsOnCharacters = "abc", - MaxFacetHits = 20, - MaxValuesPerFacet = 30, - MinProximity = 6, - MinWordSizefor1Typo = 5, - MinWordSizefor2Typos = 11, - Mode = Enum.Parse("NeuralSearch"), - NumericAttributesForFiltering = new List { "algolia" }, - OptionalWords = new OptionalWords(new List { "myspace" }), - PaginationLimitedTo = 0, - QueryLanguages = new List { Enum.Parse("Fr") }, - QueryType = Enum.Parse("PrefixLast"), - Ranking = new List { "geo" }, - ReRankingApplyFilter = new ReRankingApplyFilter("mySearch:filters"), - RelevancyStrictness = 10, - RemoveStopWords = new RemoveStopWords(false), - RemoveWordsIfNoResults = Enum.Parse("LastWords"), - RenderingContent = new RenderingContent - { - FacetOrdering = new FacetOrdering - { - Facets = new Facets - { - Order = new List { "a", "b" }, - }, - Values = new Dictionary - { - { - "a", - new Value - { - Order = new List { "b" }, - SortRemainingBy = Enum.Parse("Count"), - } - }, - }, - }, - }, - ReplaceSynonymsInHighlight = true, - Replicas = new List { "" }, - ResponseFields = new List { "algolia" }, - RestrictHighlightAndSnippetArrays = true, - SearchableAttributes = new List { "foo" }, - SemanticSearch = new SemanticSearch { EventSources = new List { "foo" } }, - SeparatorsToIndex = "bar", - SnippetEllipsisText = "---", - SortFacetValuesBy = "date", - TypoTolerance = new TypoTolerance(false), - UnretrievableAttributes = new List { "foo" }, - UserData = new Dictionary { { "user", "data" } }, - } + new IndexSettings { AttributeForDistinct = "url" } ); // >LOG // SEPARATOR< @@ -6560,35 +10338,18 @@ public async Task SnippetForSearchClientSetSettings48() /// /// Snippet for the SetSettings method. /// - /// searchableAttributesWithCustomRankingsAndAttributesForFaceting + /// set_distinct /// - public async Task SnippetForSearchClientSetSettings49() + public async Task SnippetForSearchClientSetSettings117() { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // >SEPARATOR setSettings set_distinct // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - SearchableAttributes = new List - { - "brand", - "name", - "categories", - "unordered(description)", - }, - CustomRanking = new List { "desc(popularity)" }, - AttributesForFaceting = new List - { - "searchable(brand)", - "type", - "categories", - "price", - }, - } + new IndexSettings { Distinct = new Distinct(1), AttributeForDistinct = "url" } ); // >LOG // SEPARATOR< @@ -6597,26 +10358,18 @@ public async Task SnippetForSearchClientSetSettings49() /// /// Snippet for the SetSettings method. /// - /// searchableAttributesProductReferenceSuffixes + /// set_replace_synonyms_in_highlights /// - public async Task SnippetForSearchClientSetSettings50() + public async Task SnippetForSearchClientSetSettings118() { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - SearchableAttributes = new List - { - "name", - "product_reference", - "product_reference_suffixes", - }, - } + new IndexSettings { ReplaceSynonymsInHighlight = false } ); // >LOG // SEPARATOR< @@ -6625,22 +10378,18 @@ public async Task SnippetForSearchClientSetSettings50() /// /// Snippet for the SetSettings method. /// - /// queryLanguageAndIgnorePlurals + /// set_min_proximity /// - public async Task SnippetForSearchClientSetSettings51() + public async Task SnippetForSearchClientSetSettings119() { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // >SEPARATOR setSettings set_min_proximity // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings - { - QueryLanguages = new List { Enum.Parse("En") }, - IgnorePlurals = new IgnorePlurals(true), - } + new IndexSettings { MinProximity = 1 } ); // >LOG // SEPARATOR< @@ -6649,11 +10398,11 @@ public async Task SnippetForSearchClientSetSettings51() /// /// Snippet for the SetSettings method. /// - /// searchableAttributesInMovies + /// set_default_field /// - public async Task SnippetForSearchClientSetSettings52() + public async Task SnippetForSearchClientSetSettings120() { - // >SEPARATOR setSettings searchableAttributesInMovies + // >SEPARATOR setSettings set_default_field // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6662,7 +10411,7 @@ public async Task SnippetForSearchClientSetSettings52() "", new IndexSettings { - SearchableAttributes = new List { "title_eng", "title_fr", "title_es" }, + ResponseFields = new List { "hits", "hitsPerPage", "nbPages", "page" }, } ); // >LOG @@ -6672,18 +10421,18 @@ public async Task SnippetForSearchClientSetSettings52() /// /// Snippet for the SetSettings method. /// - /// disablePrefixOnAttributes + /// set_max_facet_hits /// - public async Task SnippetForSearchClientSetSettings53() + public async Task SnippetForSearchClientSetSettings121() { - // >SEPARATOR setSettings disablePrefixOnAttributes + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { DisablePrefixOnAttributes = new List { "serial_number" } } + new IndexSettings { MaxFacetHits = 10 } ); // >LOG // SEPARATOR< @@ -6692,18 +10441,18 @@ public async Task SnippetForSearchClientSetSettings53() /// /// Snippet for the SetSettings method. /// - /// disableTypoToleranceOnAttributes + /// set_attribute_criteria_computed_by_min_proximity /// - public async Task SnippetForSearchClientSetSettings54() + public async Task SnippetForSearchClientSetSettings122() { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } + new IndexSettings { AttributeCriteriaComputedByMinProximity = true } ); // >LOG // SEPARATOR< @@ -6712,18 +10461,24 @@ public async Task SnippetForSearchClientSetSettings54() /// /// Snippet for the SetSettings method. /// - /// searchableAttributesSimpleExample + /// set_user_data /// - public async Task SnippetForSearchClientSetSettings55() + public async Task SnippetForSearchClientSetSettings123() { - // >SEPARATOR setSettings searchableAttributesSimpleExample + // >SEPARATOR setSettings set_user_data // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); // Call the API var response = await client.SetSettingsAsync( "", - new IndexSettings { SearchableAttributes = new List { "serial_number" } } + new IndexSettings + { + UserData = new Dictionary + { + { "extraData", "This is the custom data that you want to store in your index" }, + }, + } ); // >LOG // SEPARATOR< @@ -6732,11 +10487,11 @@ public async Task SnippetForSearchClientSetSettings55() /// /// Snippet for the SetSettings method. /// - /// searchableAttributesSimpleExampleAlt + /// set_rendering_content /// - public async Task SnippetForSearchClientSetSettings56() + public async Task SnippetForSearchClientSetSettings124() { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // >SEPARATOR setSettings set_rendering_content // Initialize the client var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")); @@ -6745,7 +10500,36 @@ public async Task SnippetForSearchClientSetSettings56() "", new IndexSettings { - SearchableAttributes = new List { "serial_number", "serial_number_suffixes" }, + RenderingContent = new RenderingContent + { + FacetOrdering = new FacetOrdering + { + Facets = new Facets + { + Order = new List { "size", "brand" }, + }, + Values = new Dictionary + { + { + "brand", + new Value + { + Order = new List { "uniqlo" }, + Hide = new List { "muji" }, + SortRemainingBy = Enum.Parse("Count"), + } + }, + { + "size", + new Value + { + Order = new List { "S", "M", "L" }, + SortRemainingBy = Enum.Parse("Hidden"), + } + }, + }, + }, + }, } ); // >LOG diff --git a/docs/snippets/dart/lib/search.dart b/docs/snippets/dart/lib/search.dart index 68030e0368..9a7f5a5cc7 100644 --- a/docs/snippets/dart/lib/search.dart +++ b/docs/snippets/dart/lib/search.dart @@ -4496,8 +4496,108 @@ void snippetForsearchSingleIndex13() async { // Snippet for the searchSingleIndex method. // -// facetFiltersNeg +// facetFiltersBook void snippetForsearchSingleIndex14() async { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "category:Book", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersAND +void snippetForsearchSingleIndex15() async { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "category:Book", + "author:John Doe", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersOR +void snippetForsearchSingleIndex16() async { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + [ + "category:Book", + "author:John Doe", + ], + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersCombined +void snippetForsearchSingleIndex17() async { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "author:John Doe", + [ + "category:Book", + "category:Movie", + ], + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersNeg +void snippetForsearchSingleIndex18() async { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client final client = @@ -4517,7 +4617,7 @@ void snippetForsearchSingleIndex14() async { // Snippet for the searchSingleIndex method. // // filtersAndFacetFilters -void snippetForsearchSingleIndex15() async { +void snippetForsearchSingleIndex19() async { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client final client = @@ -4540,7 +4640,7 @@ void snippetForsearchSingleIndex15() async { // Snippet for the searchSingleIndex method. // // facet author genre -void snippetForsearchSingleIndex16() async { +void snippetForsearchSingleIndex20() async { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client final client = @@ -4563,7 +4663,7 @@ void snippetForsearchSingleIndex16() async { // Snippet for the searchSingleIndex method. // // facet wildcard -void snippetForsearchSingleIndex17() async { +void snippetForsearchSingleIndex21() async { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client final client = @@ -4585,7 +4685,7 @@ void snippetForsearchSingleIndex17() async { // Snippet for the searchSingleIndex method. // // maxValuesPerFacet -void snippetForsearchSingleIndex18() async { +void snippetForsearchSingleIndex22() async { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client final client = @@ -4605,7 +4705,7 @@ void snippetForsearchSingleIndex18() async { // Snippet for the searchSingleIndex method. // // aroundLatLng -void snippetForsearchSingleIndex19() async { +void snippetForsearchSingleIndex23() async { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client final client = @@ -4625,7 +4725,7 @@ void snippetForsearchSingleIndex19() async { // Snippet for the searchSingleIndex method. // // aroundLatLngViaIP -void snippetForsearchSingleIndex20() async { +void snippetForsearchSingleIndex24() async { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client final client = @@ -4645,7 +4745,7 @@ void snippetForsearchSingleIndex20() async { // Snippet for the searchSingleIndex method. // // aroundRadius -void snippetForsearchSingleIndex21() async { +void snippetForsearchSingleIndex25() async { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client final client = @@ -4666,7 +4766,7 @@ void snippetForsearchSingleIndex21() async { // Snippet for the searchSingleIndex method. // // insideBoundingBox -void snippetForsearchSingleIndex22() async { +void snippetForsearchSingleIndex26() async { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client final client = @@ -4693,7 +4793,7 @@ void snippetForsearchSingleIndex22() async { // Snippet for the searchSingleIndex method. // // insidePolygon -void snippetForsearchSingleIndex23() async { +void snippetForsearchSingleIndex27() async { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client final client = @@ -4728,7 +4828,7 @@ void snippetForsearchSingleIndex23() async { // Snippet for the searchSingleIndex method. // // insidePolygon -void snippetForsearchSingleIndex24() async { +void snippetForsearchSingleIndex28() async { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client final client = @@ -4763,7 +4863,7 @@ void snippetForsearchSingleIndex24() async { // Snippet for the searchSingleIndex method. // // optionalFilters -void snippetForsearchSingleIndex25() async { +void snippetForsearchSingleIndex29() async { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client final client = @@ -4785,7 +4885,7 @@ void snippetForsearchSingleIndex25() async { // Snippet for the searchSingleIndex method. // // optionalFiltersMany -void snippetForsearchSingleIndex26() async { +void snippetForsearchSingleIndex30() async { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client final client = @@ -4809,7 +4909,7 @@ void snippetForsearchSingleIndex26() async { // Snippet for the searchSingleIndex method. // // optionalFiltersSimple -void snippetForsearchSingleIndex27() async { +void snippetForsearchSingleIndex31() async { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client final client = @@ -4832,7 +4932,7 @@ void snippetForsearchSingleIndex27() async { // Snippet for the searchSingleIndex method. // // restrictSearchableAttributes -void snippetForsearchSingleIndex28() async { +void snippetForsearchSingleIndex32() async { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client final client = @@ -4854,7 +4954,7 @@ void snippetForsearchSingleIndex28() async { // Snippet for the searchSingleIndex method. // // getRankingInfo -void snippetForsearchSingleIndex29() async { +void snippetForsearchSingleIndex33() async { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client final client = @@ -4874,7 +4974,7 @@ void snippetForsearchSingleIndex29() async { // Snippet for the searchSingleIndex method. // // clickAnalytics -void snippetForsearchSingleIndex30() async { +void snippetForsearchSingleIndex34() async { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client final client = @@ -4894,7 +4994,7 @@ void snippetForsearchSingleIndex30() async { // Snippet for the searchSingleIndex method. // // clickAnalyticsUserToken -void snippetForsearchSingleIndex31() async { +void snippetForsearchSingleIndex35() async { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client final client = @@ -4915,7 +5015,7 @@ void snippetForsearchSingleIndex31() async { // Snippet for the searchSingleIndex method. // // enablePersonalization -void snippetForsearchSingleIndex32() async { +void snippetForsearchSingleIndex36() async { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client final client = @@ -4936,7 +5036,7 @@ void snippetForsearchSingleIndex32() async { // Snippet for the searchSingleIndex method. // // userToken -void snippetForsearchSingleIndex33() async { +void snippetForsearchSingleIndex37() async { // >SEPARATOR searchSingleIndex userToken // Initialize the client final client = @@ -4953,10 +5053,31 @@ void snippetForsearchSingleIndex33() async { // SEPARATOR< } +// Snippet for the searchSingleIndex method. +// +// userToken1234 +void snippetForsearchSingleIndex38() async { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + userToken: "user-1234", + ), + ); + // >LOG + // SEPARATOR< +} + // Snippet for the searchSingleIndex method. // // analyticsTag -void snippetForsearchSingleIndex34() async { +void snippetForsearchSingleIndex39() async { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client final client = @@ -4978,7 +5099,7 @@ void snippetForsearchSingleIndex34() async { // Snippet for the searchSingleIndex method. // // facetFiltersUsers -void snippetForsearchSingleIndex35() async { +void snippetForsearchSingleIndex40() async { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client final client = @@ -5001,7 +5122,7 @@ void snippetForsearchSingleIndex35() async { // Snippet for the searchSingleIndex method. // // buildTheQuery -void snippetForsearchSingleIndex36() async { +void snippetForsearchSingleIndex41() async { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client final client = @@ -5022,454 +5143,472 @@ void snippetForsearchSingleIndex36() async { // SEPARATOR< } -// Snippet for the searchSynonyms method. +// Snippet for the searchSingleIndex method. // -// searchSynonyms with minimal parameters -void snippetForsearchSynonyms() async { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters +// attributesToHighlightOverride +void snippetForsearchSingleIndex42() async { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.searchSynonyms( + final response = await client.searchSingleIndex( indexName: "", + searchParams: SearchParamsObject( + query: "query", + attributesToHighlight: [ + "title", + "content", + ], + ), ); // >LOG // SEPARATOR< } -// Snippet for the searchSynonyms method. +// Snippet for the searchSingleIndex method. // -// searchSynonyms with all parameters -void snippetForsearchSynonyms1() async { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters +// disableTypoToleranceOnAttributes +void snippetForsearchSingleIndex43() async { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.searchSynonyms( + final response = await client.searchSingleIndex( indexName: "", - searchSynonymsParams: SearchSynonymsParams( - query: "myQuery", - type: SynonymType.fromJson("altcorrection1"), - page: 10, - hitsPerPage: 10, + searchParams: SearchParamsObject( + query: "query", + disableTypoToleranceOnAttributes: [ + "serial_number", + ], ), ); // >LOG // SEPARATOR< } -// Snippet for the searchUserIds method. +// Snippet for the searchSingleIndex method. // -// searchUserIds -void snippetForsearchUserIds() async { - // >SEPARATOR searchUserIds default +// search_a_query +void snippetForsearchSingleIndex44() async { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.searchUserIds( - searchUserIdsParams: SearchUserIdsParams( - query: "test", - clusterName: "theClusterName", - page: 5, - hitsPerPage: 10, + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "shirt", ), ); // >LOG // SEPARATOR< } -// Snippet for the setClientApiKey method. +// Snippet for the searchSingleIndex method. // -// switch API key -void snippetForsetClientApiKey() async { - // >SEPARATOR setClientApiKey default +// search_everything +void snippetForsearchSingleIndex45() async { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - client.setClientApiKey( - apiKey: "updated-api-key", + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "", + ), ); // >LOG // SEPARATOR< } -// Snippet for the setDictionarySettings method. +// Snippet for the searchSingleIndex method. // -// get setDictionarySettings results with minimal parameters -void snippetForsetDictionarySettings() async { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters +// api_filtering_range_example +void snippetForsearchSingleIndex46() async { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams( - disableStandardEntries: StandardEntries( - plurals: { - 'fr': false, - 'en': false, - 'ru': true, - }, - ), + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "books", + filters: "price:10 TO 20", ), ); // >LOG // SEPARATOR< } -// Snippet for the setDictionarySettings method. +// Snippet for the searchSingleIndex method. // -// get setDictionarySettings results with all parameters -void snippetForsetDictionarySettings1() async { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters +// search_a_query +void snippetForsearchSingleIndex47() async { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams( - disableStandardEntries: StandardEntries( - plurals: { - 'fr': false, - 'en': false, - 'ru': true, - }, - stopwords: { - 'fr': false, - }, - compounds: { - 'ru': true, - }, - ), + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "", + similarQuery: + "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// minimal parameters -void snippetForsetSettings() async { - // >SEPARATOR setSettings minimal parameters +// override_retrievable_attributes +void snippetForsearchSingleIndex48() async { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - paginationLimitedTo: 10, + searchParams: SearchParamsObject( + query: "query", + attributesToRetrieve: [ + "title", + "content", + ], ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// boolean typoTolerance -void snippetForsetSettings1() async { - // >SEPARATOR setSettings boolean typoTolerance +// restrict_searchable_attributes +void snippetForsearchSingleIndex49() async { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - typoTolerance: true, - ), - forwardToReplicas: true, + searchParams: SearchParamsObject( + query: "query", + restrictSearchableAttributes: [ + "title", + "author", + ], + ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// enum typoTolerance -void snippetForsetSettings2() async { - // >SEPARATOR setSettings enum typoTolerance +// override_default_relevancy +void snippetForsearchSingleIndex50() async { + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - typoTolerance: TypoToleranceEnum.fromJson("min"), + searchParams: SearchParamsObject( + query: "query", + relevancyStrictness: 70, ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// ignorePlurals -void snippetForsetSettings3() async { - // >SEPARATOR setSettings ignorePlurals +// apply_filters +void snippetForsearchSingleIndex51() async { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - ignorePlurals: true, + searchParams: SearchParamsObject( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// list of string ignorePlurals -void snippetForsetSettings4() async { - // >SEPARATOR setSettings list of string ignorePlurals +// apply_all_filters +void snippetForsearchSingleIndex52() async { + // >SEPARATOR searchSingleIndex apply_all_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - ignorePlurals: [ - SupportedLanguage.fromJson("fr"), - ], + searchParams: SearchParamsObject( + 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\"", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// removeStopWords boolean -void snippetForsetSettings5() async { - // >SEPARATOR setSettings removeStopWords boolean +// escape_spaces +void snippetForsearchSingleIndex53() async { + // >SEPARATOR searchSingleIndex escape_spaces // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - removeStopWords: true, + searchParams: SearchParamsObject( + query: "query", + filters: "category:\"Books and Comics\"", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// removeStopWords list of string -void snippetForsetSettings6() async { - // >SEPARATOR setSettings removeStopWords list of string +// escape_keywords +void snippetForsearchSingleIndex54() async { + // >SEPARATOR searchSingleIndex escape_keywords // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - removeStopWords: [ - SupportedLanguage.fromJson("fr"), - ], + searchParams: SearchParamsObject( + query: "query", + filters: "keyword:\"OR\"", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// boolean distinct -void snippetForsetSettings7() async { - // >SEPARATOR setSettings boolean distinct +// escape_single_quotes +void snippetForsearchSingleIndex55() async { + // >SEPARATOR searchSingleIndex escape_single_quotes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - distinct: true, + searchParams: SearchParamsObject( + query: "query", + filters: "content:\"It's a wonderful day\"", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// integer distinct -void snippetForsetSettings8() async { - // >SEPARATOR setSettings integer distinct +// escape_double_quotes +void snippetForsearchSingleIndex56() async { + // >SEPARATOR searchSingleIndex escape_double_quotes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - distinct: 1, + searchParams: SearchParamsObject( + query: "query", + filters: "content:\"She said \"Hello World\"", ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// distinct company -void snippetForsetSettings9() async { - // >SEPARATOR setSettings distinct company +// apply_filters +void snippetForsearchSingleIndex57() async { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributeForDistinct: "company", - distinct: true, + searchParams: SearchParamsObject( + query: "query", + optionalFilters: [ + "category:Book", + "author:John Doe", + ], ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// distinct design -void snippetForsetSettings10() async { - // >SEPARATOR setSettings distinct design +// apply_negative_filters +void snippetForsearchSingleIndex58() async { + // >SEPARATOR searchSingleIndex apply_negative_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributeForDistinct: "design", - distinct: true, + searchParams: SearchParamsObject( + query: "query", + optionalFilters: [ + "category:Book", + "author:-John Doe", + ], ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// distinct true -void snippetForsetSettings11() async { - // >SEPARATOR setSettings distinct true +// apply_numeric_filters +void snippetForsearchSingleIndex59() async { + // >SEPARATOR searchSingleIndex apply_numeric_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - distinct: true, + searchParams: SearchParamsObject( + query: "query", + numericFilters: [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506", + ], + ], ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// distinct section -void snippetForsetSettings12() async { - // >SEPARATOR setSettings distinct section +// apply_tag_filters +void snippetForsearchSingleIndex60() async { + // >SEPARATOR searchSingleIndex apply_tag_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributeForDistinct: "section", - distinct: true, + searchParams: SearchParamsObject( + query: "query", + tagFilters: [ + "SciFi", + [ + "Book", + "Movie", + ], + ], ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting allergens -void snippetForsetSettings13() async { - // >SEPARATOR setSettings attributesForFaceting allergens +// apply_filters +void snippetForsearchSingleIndex61() async { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "allergens", - ], + searchParams: SearchParamsObject( + query: "query", + sumOrFiltersScores: true, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting categoryPageId -void snippetForsetSettings14() async { - // >SEPARATOR setSettings attributesForFaceting categoryPageId +// facets_all +void snippetForsearchSingleIndex62() async { + // >SEPARATOR searchSingleIndex facets_all // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "searchable(categoryPageId)", + searchParams: SearchParamsObject( + query: "query", + facets: [ + "*", ], ), ); @@ -5477,21 +5616,23 @@ void snippetForsetSettings14() async { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// unretrievableAttributes -void snippetForsetSettings15() async { - // >SEPARATOR setSettings unretrievableAttributes +// retrieve_only_some_facets +void snippetForsearchSingleIndex63() async { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - unretrievableAttributes: [ - "visible_by", + searchParams: SearchParamsObject( + query: "query", + facets: [ + "category", + "author", ], ), ); @@ -5499,88 +5640,86 @@ void snippetForsetSettings15() async { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting user restricted data -void snippetForsetSettings16() async { - // >SEPARATOR setSettings attributesForFaceting user restricted data +// override_default_max_values_per_facet +void snippetForsearchSingleIndex64() async { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "filterOnly(visible_by)", - ], + searchParams: SearchParamsObject( + query: "query", + maxValuesPerFacet: 20, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting optional filters -void snippetForsetSettings17() async { - // >SEPARATOR setSettings attributesForFaceting optional filters +// enable_faceting_after_distinct +void snippetForsearchSingleIndex65() async { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "can_deliver_quickly", - "restaurant", - ], + searchParams: SearchParamsObject( + query: "query", + facetingAfterDistinct: true, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting redirect index -void snippetForsetSettings18() async { - // >SEPARATOR setSettings attributesForFaceting redirect index +// sort_facet_values_alphabetically +void snippetForsearchSingleIndex66() async { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "query_terms", - ], + searchParams: SearchParamsObject( + query: "query", + sortFacetValuesBy: "count", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting multiple consequences -void snippetForsetSettings19() async { - // >SEPARATOR setSettings attributesForFaceting multiple consequences +// override_attributes_to_snippet +void snippetForsearchSingleIndex67() async { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "director", + searchParams: SearchParamsObject( + query: "query", + attributesToSnippet: [ + "title", + "content:80", ], ), ); @@ -5588,418 +5727,392 @@ void snippetForsetSettings19() async { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// attributesForFaceting in-depth optional filters -void snippetForsetSettings20() async { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters +// override_default_highlight_pre_tag +void snippetForsearchSingleIndex68() async { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: [ - "filterOnly(brand)", - ], + searchParams: SearchParamsObject( + query: "query", + highlightPreTag: "", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// mode neuralSearch -void snippetForsetSettings21() async { - // >SEPARATOR setSettings mode neuralSearch +// override_default_highlight_post_tag +void snippetForsearchSingleIndex69() async { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - mode: Mode.fromJson("neuralSearch"), + searchParams: SearchParamsObject( + query: "query", + highlightPostTag: "", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// mode keywordSearch -void snippetForsetSettings22() async { - // >SEPARATOR setSettings mode keywordSearch +// override_default_snippet_ellipsis_text +void snippetForsearchSingleIndex70() async { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - mode: Mode.fromJson("keywordSearch"), + searchParams: SearchParamsObject( + query: "query", + snippetEllipsisText: "", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// searchableAttributes same priority -void snippetForsetSettings23() async { - // >SEPARATOR setSettings searchableAttributes same priority +// enable_restrict_highlight_and_snippet_arrays +void snippetForsearchSingleIndex71() async { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - searchableAttributes: [ - "title,comments", - "ingredients", - ], + searchParams: SearchParamsObject( + query: "query", + restrictHighlightAndSnippetArrays: false, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// searchableAttributes higher priority -void snippetForsetSettings24() async { - // >SEPARATOR setSettings searchableAttributes higher priority +// access_page +void snippetForsearchSingleIndex72() async { + // >SEPARATOR searchSingleIndex access_page // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - searchableAttributes: [ - "title", - "ingredients", - ], + searchParams: SearchParamsObject( + query: "query", + page: 0, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking retweets -void snippetForsetSettings25() async { - // >SEPARATOR setSettings customRanking retweets +// override_default_hits_per_page +void snippetForsearchSingleIndex73() async { + // >SEPARATOR searchSingleIndex override_default_hits_per_page // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(retweets)", - "desc(likes)", - ], + searchParams: SearchParamsObject( + query: "query", + hitsPerPage: 10, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking boosted -void snippetForsetSettings26() async { - // >SEPARATOR setSettings customRanking boosted +// get_nth_hit +void snippetForsearchSingleIndex74() async { + // >SEPARATOR searchSingleIndex get_nth_hit // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(boosted)", - ], + searchParams: SearchParamsObject( + query: "query", + offset: 4, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking pageviews -void snippetForsetSettings27() async { - // >SEPARATOR setSettings customRanking pageviews +// get_n_results +void snippetForsearchSingleIndex75() async { + // >SEPARATOR searchSingleIndex get_n_results // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(pageviews)", - "desc(comments)", - ], + searchParams: SearchParamsObject( + query: "query", + length: 4, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking applying search parameters for a specific query -void snippetForsetSettings28() async { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query +// override_default_min_word_size_for_one_typo +void snippetForsearchSingleIndex76() async { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(nb_airline_liaisons)", - ], - attributesForFaceting: [ - "city, country", - ], + searchParams: SearchParamsObject( + query: "query", + minWordSizefor1Typo: 2, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking rounded pageviews -void snippetForsetSettings29() async { - // >SEPARATOR setSettings customRanking rounded pageviews +// override_default_min_word_size_for_two_typos +void snippetForsearchSingleIndex77() async { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(rounded_pageviews)", - "desc(comments)", - ], + searchParams: SearchParamsObject( + query: "query", + minWordSizefor2Typos: 2, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking price -void snippetForsetSettings30() async { - // >SEPARATOR setSettings customRanking price +// override_default_typo_tolerance_mode +void snippetForsearchSingleIndex78() async { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(price)", - ], + searchParams: SearchParamsObject( + query: "query", + typoTolerance: false, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// ranking exhaustive -void snippetForsetSettings31() async { - // >SEPARATOR setSettings ranking exhaustive +// disable_typos_on_numeric_tokens_at_search_time +void snippetForsearchSingleIndex79() async { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - ranking: [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + searchParams: SearchParamsObject( + query: "query", + allowTyposOnNumericTokens: false, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// ranking standard replica -void snippetForsetSettings32() async { - // >SEPARATOR setSettings ranking standard replica +// search_around_a_position +void snippetForsearchSingleIndex80() async { + // >SEPARATOR searchSingleIndex search_around_a_position // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - ranking: [ - "desc(post_date_timestamp)", - ], + searchParams: SearchParamsObject( + query: "query", + aroundLatLng: "40.71, -74.01", ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// ranking virtual replica -void snippetForsetSettings33() async { - // >SEPARATOR setSettings ranking virtual replica +// search_around_server_ip +void snippetForsearchSingleIndex81() async { + // >SEPARATOR searchSingleIndex search_around_server_ip // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "desc(post_date_timestamp)", - ], + searchParams: SearchParamsObject( + query: "query", + aroundLatLngViaIP: true, + ), + requestOptions: RequestOptions( + headers: { + 'x-forwarded-for': + '94.228.178.246 // should be replaced with the actual IP you would like to search around', + }, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// customRanking and ranking sort alphabetically -void snippetForsetSettings34() async { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically +// set_around_radius +void snippetForsearchSingleIndex82() async { + // >SEPARATOR searchSingleIndex set_around_radius // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "asc(textual_attribute)", - ], - ranking: [ - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - ], + searchParams: SearchParamsObject( + query: "query", + aroundRadius: 1000, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// relevancyStrictness -void snippetForsetSettings35() async { - // >SEPARATOR setSettings relevancyStrictness +// disable_automatic_radius +void snippetForsearchSingleIndex83() async { + // >SEPARATOR searchSingleIndex disable_automatic_radius // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - customRanking: [ - "asc(textual_attribute)", - ], - relevancyStrictness: 0, + searchParams: SearchParamsObject( + query: "query", + aroundRadius: AroundRadiusAll.fromJson("all"), ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// create replica index -void snippetForsetSettings36() async { - // >SEPARATOR setSettings create replica index +// set_geo_search_precision +void snippetForsearchSingleIndex84() async { + // >SEPARATOR searchSingleIndex set_geo_search_precision // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - replicas: [ - "products_price_desc", - ], + searchParams: SearchParamsObject( + query: "query", + aroundPrecision: 100, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// create virtual replica index -void snippetForsetSettings37() async { - // >SEPARATOR setSettings create virtual replica index +// set_geo_search_precision_non_linear +void snippetForsearchSingleIndex85() async { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - replicas: [ - "virtual(products_price_desc)", + searchParams: SearchParamsObject( + query: "query", + aroundPrecision: [ + Range( + from: 0, + value: 25, + ), + Range( + from: 2000, + value: 1000, + ), ], ), ); @@ -6007,57 +6120,3405 @@ void snippetForsetSettings37() async { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// unlink replica index -void snippetForsetSettings38() async { - // >SEPARATOR setSettings unlink replica index +// set_minimum_geo_search_radius +void snippetForsearchSingleIndex86() async { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - replicas: [ - "", - ], + searchParams: SearchParamsObject( + query: "query", + minimumAroundRadius: 1000, ), ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// forwardToReplicas -void snippetForsetSettings39() async { - // >SEPARATOR setSettings forwardToReplicas +// search_inside_rectangular_area +void snippetForsearchSingleIndex87() async { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); // Call the API - final response = await client.setSettings( + final response = await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "description", + searchParams: SearchParamsObject( + query: "query", + insideBoundingBox: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], ], ), - forwardToReplicas: true, ); // >LOG // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// maxValuesPerFacet -void snippetForsetSettings40() async { - // >SEPARATOR setSettings maxValuesPerFacet +// search_inside_multiple_rectangular_areas +void snippetForsearchSingleIndex88() async { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + insideBoundingBox: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + ], + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_polygon_area +void snippetForsearchSingleIndex89() async { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + insidePolygon: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ], + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_multiple_polygon_areas +void snippetForsearchSingleIndex90() async { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + 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, + ], + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +void snippetForsearchSingleIndex91() async { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + ignorePlurals: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +void snippetForsearchSingleIndex92() async { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + removeStopWords: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +void snippetForsearchSingleIndex93() async { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + removeStopWords: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_with_japanese_query +void snippetForsearchSingleIndex94() async { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + queryLanguages: [ + SupportedLanguage.fromJson("ja"), + SupportedLanguage.fromJson("en"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_natural_languages +void snippetForsearchSingleIndex95() async { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "", + naturalLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_natural_languages_with_query +void snippetForsearchSingleIndex96() async { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "", + naturalLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("firstWords"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_decompound_query_search_time +void snippetForsearchSingleIndex97() async { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + decompoundQuery: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_rules_search_time +void snippetForsearchSingleIndex98() async { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enableRules: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_rule_contexts +void snippetForsearchSingleIndex99() async { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + ruleContexts: [ + "front_end", + "website2", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_personalization +void snippetForsearchSingleIndex100() async { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_personalization_with_user_token +void snippetForsearchSingleIndex101() async { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + userToken: "123456", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// personalization_impact +void snippetForsearchSingleIndex102() async { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + personalizationImpact: 20, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_user_token +void snippetForsearchSingleIndex103() async { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + userToken: "123456", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_user_token_with_personalization +void snippetForsearchSingleIndex104() async { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + userToken: "123456", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_query_type +void snippetForsearchSingleIndex105() async { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + queryType: QueryType.fromJson("prefixAll"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_remove_words_if_no_results +void snippetForsearchSingleIndex106() async { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_search_time +void snippetForsearchSingleIndex107() async { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// overide_default_optional_words +void snippetForsearchSingleIndex108() async { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + optionalWords: [ + "toyota", + "2020 2021", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disabling_exact_for_some_attributes_search_time +void snippetForsearchSingleIndex109() async { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + disableExactOnAttributes: [ + "description", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_exact_single_word_query +void snippetForsearchSingleIndex110() async { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("none"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_aternative_as_exact +void snippetForsearchSingleIndex111() async { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + alternativesAsExact: [ + AlternativesAsExact.fromJson("multiWordsSynonym"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_exact_phrase +void snippetForsearchSingleIndex112() async { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("exactPhrase"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_exclude_words +void snippetForsearchSingleIndex113() async { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("excludeWords"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_distinct +void snippetForsearchSingleIndex114() async { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + distinct: 0, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// get_ranking_info +void snippetForsearchSingleIndex115() async { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + getRankingInfo: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_click_analytics +void snippetForsearchSingleIndex116() async { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + clickAnalytics: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_click_analytics +void snippetForsearchSingleIndex117() async { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + clickAnalytics: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_analytics +void snippetForsearchSingleIndex118() async { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + analytics: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// add_analytics_tags +void snippetForsearchSingleIndex119() async { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + analyticsTags: [ + "front_end", + "website2", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_synonyms +void snippetForsearchSingleIndex120() async { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + synonyms: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_replace_synonyms_in_highlights +void snippetForsearchSingleIndex121() async { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + replaceSynonymsInHighlight: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_min_proximity +void snippetForsearchSingleIndex122() async { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + minProximity: 2, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_field +void snippetForsearchSingleIndex123() async { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + responseFields: [ + "hits", + "facets", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_percentile_computation +void snippetForsearchSingleIndex124() async { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + percentileComputation: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_ab_test +void snippetForsearchSingleIndex125() async { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enableABTest: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_enable_re_ranking +void snippetForsearchSingleIndex126() async { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSingleIndex( + indexName: "", + searchParams: SearchParamsObject( + query: "query", + enableReRanking: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSynonyms method. +// +// searchSynonyms with minimal parameters +void snippetForsearchSynonyms() async { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSynonyms( + indexName: "", + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchSynonyms method. +// +// searchSynonyms with all parameters +void snippetForsearchSynonyms1() async { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchSynonyms( + indexName: "", + searchSynonymsParams: SearchSynonymsParams( + query: "myQuery", + type: SynonymType.fromJson("altcorrection1"), + page: 10, + hitsPerPage: 10, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the searchUserIds method. +// +// searchUserIds +void snippetForsearchUserIds() async { + // >SEPARATOR searchUserIds default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.searchUserIds( + searchUserIdsParams: SearchUserIdsParams( + query: "test", + clusterName: "theClusterName", + page: 5, + hitsPerPage: 10, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setClientApiKey method. +// +// switch API key +void snippetForsetClientApiKey() async { + // >SEPARATOR setClientApiKey default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + client.setClientApiKey( + apiKey: "updated-api-key", + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setDictionarySettings method. +// +// get setDictionarySettings results with minimal parameters +void snippetForsetDictionarySettings() async { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams( + disableStandardEntries: StandardEntries( + plurals: { + 'fr': false, + 'en': false, + 'ru': true, + }, + ), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setDictionarySettings method. +// +// get setDictionarySettings results with all parameters +void snippetForsetDictionarySettings1() async { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams( + disableStandardEntries: StandardEntries( + plurals: { + 'fr': false, + 'en': false, + 'ru': true, + }, + stopwords: { + 'fr': false, + }, + compounds: { + 'ru': true, + }, + ), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// minimal parameters +void snippetForsetSettings() async { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + paginationLimitedTo: 10, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// boolean typoTolerance +void snippetForsetSettings1() async { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + typoTolerance: true, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enum typoTolerance +void snippetForsetSettings2() async { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + typoTolerance: TypoToleranceEnum.fromJson("min"), + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ignorePlurals +void snippetForsetSettings3() async { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ignorePlurals: true, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// list of string ignorePlurals +void snippetForsetSettings4() async { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ignorePlurals: [ + SupportedLanguage.fromJson("fr"), + ], + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// removeStopWords boolean +void snippetForsetSettings5() async { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + removeStopWords: true, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// removeStopWords list of string +void snippetForsetSettings6() async { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + removeStopWords: [ + SupportedLanguage.fromJson("fr"), + ], + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// boolean distinct +void snippetForsetSettings7() async { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + distinct: true, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// integer distinct +void snippetForsetSettings8() async { + // >SEPARATOR setSettings integer distinct + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + distinct: 1, + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct company +void snippetForsetSettings9() async { + // >SEPARATOR setSettings distinct company + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributeForDistinct: "company", + distinct: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct design +void snippetForsetSettings10() async { + // >SEPARATOR setSettings distinct design + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributeForDistinct: "design", + distinct: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct true +void snippetForsetSettings11() async { + // >SEPARATOR setSettings distinct true + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + distinct: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct section +void snippetForsetSettings12() async { + // >SEPARATOR setSettings distinct section + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributeForDistinct: "section", + distinct: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting allergens +void snippetForsetSettings13() async { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "allergens", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_faceting +void snippetForsetSettings14() async { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "genre", + "author", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_faceting_searchable +void snippetForsetSettings15() async { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "genre", + "searchable(author)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_filter_only +void snippetForsetSettings16() async { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(genre)", + "author", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting categoryPageId +void snippetForsetSettings17() async { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "searchable(categoryPageId)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// unretrievableAttributes +void snippetForsetSettings18() async { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + unretrievableAttributes: [ + "visible_by", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting user restricted data +void snippetForsetSettings19() async { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(visible_by)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting optional filters +void snippetForsetSettings20() async { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "can_deliver_quickly", + "restaurant", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting redirect index +void snippetForsetSettings21() async { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "query_terms", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting multiple consequences +void snippetForsetSettings22() async { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "director", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting in-depth optional filters +void snippetForsetSettings23() async { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(brand)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// mode neuralSearch +void snippetForsetSettings24() async { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + mode: Mode.fromJson("neuralSearch"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// mode keywordSearch +void snippetForsetSettings25() async { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + mode: Mode.fromJson("keywordSearch"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes same priority +void snippetForsetSettings26() async { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "title,comments", + "ingredients", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes higher priority +void snippetForsetSettings27() async { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "title", + "ingredients", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking retweets +void snippetForsetSettings28() async { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(retweets)", + "desc(likes)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking boosted +void snippetForsetSettings29() async { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(boosted)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking pageviews +void snippetForsetSettings30() async { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(pageviews)", + "desc(comments)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking applying search parameters for a specific query +void snippetForsetSettings31() async { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(nb_airline_liaisons)", + ], + attributesForFaceting: [ + "city, country", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking rounded pageviews +void snippetForsetSettings32() async { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(rounded_pageviews)", + "desc(comments)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking price +void snippetForsetSettings33() async { + // >SEPARATOR setSettings customRanking price + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(price)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking exhaustive +void snippetForsetSettings34() async { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking standard replica +void snippetForsetSettings35() async { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "desc(post_date_timestamp)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking virtual replica +void snippetForsetSettings36() async { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(post_date_timestamp)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking and ranking sort alphabetically +void snippetForsetSettings37() async { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "asc(textual_attribute)", + ], + ranking: [ + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// relevancyStrictness +void snippetForsetSettings38() async { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "asc(textual_attribute)", + ], + relevancyStrictness: 0, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create replica index +void snippetForsetSettings39() async { + // >SEPARATOR setSettings create replica index + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + replicas: [ + "products_price_desc", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create replica index articles +void snippetForsetSettings40() async { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + replicas: [ + "articles_date_desc", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create virtual replica index +void snippetForsetSettings41() async { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + replicas: [ + "virtual(products_price_desc)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// unlink replica index +void snippetForsetSettings42() async { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + replicas: [ + "", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// forwardToReplicas +void snippetForsetSettings43() async { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "description", + ], + ), + forwardToReplicas: true, + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// maxValuesPerFacet +void snippetForsetSettings44() async { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + maxValuesPerFacet: 1000, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// maxFacetHits +void snippetForsetSettings45() async { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + maxFacetHits: 1000, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting complex +void snippetForsetSettings46() async { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking closest dates +void snippetForsetSettings47() async { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes item variation +void snippetForsetSettings48() async { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "design", + "type", + "color", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes around location +void snippetForsetSettings49() async { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "country", + "code", + "iata_code", + ], + customRanking: [ + "desc(links_count)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesToHighlight +void snippetForsetSettings50() async { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToHighlight: [ + "author", + "title", + "content", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesToHighlightStar +void snippetForsetSettings51() async { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToHighlight: [ + "*", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// everything +void snippetForsetSettings52() async { + // >SEPARATOR setSettings everything + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("exactPhrase"), + ], + allowCompressionOfIntegerArray: true, + allowTyposOnNumericTokens: true, + alternativesAsExact: [ + AlternativesAsExact.fromJson("singleWordSynonym"), + ], + attributeCriteriaComputedByMinProximity: true, + attributeForDistinct: "test", + attributesForFaceting: [ + "algolia", + ], + attributesToHighlight: [ + "algolia", + ], + attributesToRetrieve: [ + "algolia", + ], + attributesToSnippet: [ + "algolia", + ], + attributesToTransliterate: [ + "algolia", + ], + camelCaseAttributes: [ + "algolia", + ], + customNormalization: { + 'algolia': { + 'aloglia': "aglolia", + }, + }, + customRanking: [ + "algolia", + ], + decompoundQuery: false, + decompoundedAttributes: { + 'algolia': "aloglia", + }, + disableExactOnAttributes: [ + "algolia", + ], + disablePrefixOnAttributes: [ + "algolia", + ], + disableTypoToleranceOnAttributes: [ + "algolia", + ], + disableTypoToleranceOnWords: [ + "algolia", + ], + distinct: 3, + enablePersonalization: true, + enableReRanking: false, + enableRules: true, + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), + highlightPreTag: "", + highlightPostTag: "", + hitsPerPage: 10, + ignorePlurals: false, + indexLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + keepDiacriticsOnCharacters: "abc", + maxFacetHits: 20, + maxValuesPerFacet: 30, + minProximity: 6, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + mode: Mode.fromJson("neuralSearch"), + numericAttributesForFiltering: [ + "algolia", + ], + optionalWords: [ + "myspace", + ], + paginationLimitedTo: 0, + queryLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + queryType: QueryType.fromJson("prefixLast"), + ranking: [ + "geo", + ], + reRankingApplyFilter: "mySearch:filters", + relevancyStrictness: 10, + removeStopWords: false, + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), + renderingContent: RenderingContent( + facetOrdering: FacetOrdering( + facets: Facets( + order: [ + "a", + "b", + ], + ), + values: { + 'a': Value( + order: [ + "b", + ], + sortRemainingBy: SortRemainingBy.fromJson("count"), + ), + }, + ), + ), + replaceSynonymsInHighlight: true, + replicas: [ + "", + ], + responseFields: [ + "algolia", + ], + restrictHighlightAndSnippetArrays: true, + searchableAttributes: [ + "foo", + ], + semanticSearch: SemanticSearch( + eventSources: [ + "foo", + ], + ), + separatorsToIndex: "bar", + snippetEllipsisText: "---", + sortFacetValuesBy: "date", + typoTolerance: false, + unretrievableAttributes: [ + "foo", + ], + userData: { + 'user': "data", + }, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesWithCustomRankingsAndAttributesForFaceting +void snippetForsetSettings53() async { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "brand", + "name", + "categories", + "unordered(description)", + ], + customRanking: [ + "desc(popularity)", + ], + attributesForFaceting: [ + "searchable(brand)", + "type", + "categories", + "price", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesOrdering +void snippetForsetSettings54() async { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "unordered(title)", + "cast", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesProductReferenceSuffixes +void snippetForsetSettings55() async { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "product_reference", + "product_reference_suffixes", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// queryLanguageAndIgnorePlurals +void snippetForsetSettings56() async { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + queryLanguages: [ + SupportedLanguage.fromJson("en"), + ], + ignorePlurals: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesInMovies +void snippetForsetSettings57() async { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "title_eng", + "title_fr", + "title_es", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disablePrefixOnAttributes +void snippetForsetSettings58() async { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + disablePrefixOnAttributes: [ + "serial_number", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disableTypoToleranceOnAttributes +void snippetForsetSettings59() async { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + disableTypoToleranceOnAttributes: [ + "serial_number", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesSimpleExample +void snippetForsetSettings60() async { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "serial_number", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesSimpleExampleAlt +void snippetForsetSettings61() async { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "serial_number", + "serial_number_suffixes", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_searchable_attributes +void snippetForsetSettings62() async { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_searchable_attributes +void snippetForsetSettings63() async { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// unretrievable_attributes +void snippetForsetSettings64() async { + // >SEPARATOR setSettings unretrievable_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + unretrievableAttributes: [ + "total_number_of_sales", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_retrievable_attributes +void snippetForsetSettings65() async { + // >SEPARATOR setSettings set_retrievable_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToRetrieve: [ + "author", + "title", + "content", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_all_attributes_as_retrievable +void snippetForsetSettings66() async { + // >SEPARATOR setSettings set_all_attributes_as_retrievable + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToRetrieve: [ + "*", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// specify_attributes_not_to_retrieve +void snippetForsetSettings67() async { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToRetrieve: [ + "*", + "-SKU", + "-internal_desc", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// neural_search +void snippetForsetSettings68() async { + // >SEPARATOR setSettings neural_search + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + mode: Mode.fromJson("neuralSearch"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// keyword_search +void snippetForsetSettings69() async { + // >SEPARATOR setSettings keyword_search + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + mode: Mode.fromJson("keywordSearch"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_ranking +void snippetForsetSettings70() async { + // >SEPARATOR setSettings set_default_ranking + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_ranking_by_attribute_asc +void snippetForsetSettings71() async { + // >SEPARATOR setSettings set_ranking_by_attribute_asc + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_ranking_by_attribute_desc +void snippetForsetSettings72() async { + // >SEPARATOR setSettings set_ranking_by_attribute_desc + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// restrict_searchable_attributes +void snippetForsetSettings73() async { + // >SEPARATOR setSettings restrict_searchable_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: [ + "desc(popularity)", + "asc(price)", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_relevancy +void snippetForsetSettings74() async { + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + relevancyStrictness: 90, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_replicas +void snippetForsetSettings75() async { + // >SEPARATOR setSettings set_replicas + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + replicas: [ + "name_of_replica_index1", + "name_of_replica_index2", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_max_values_per_facet +void snippetForsetSettings76() async { + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + maxValuesPerFacet: 100, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_sort_facet_values_by +void snippetForsetSettings77() async { + // >SEPARATOR setSettings set_default_sort_facet_values_by + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + sortFacetValuesBy: "alpha", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_attributes_to_snippet +void snippetForsetSettings78() async { + // >SEPARATOR setSettings set_attributes_to_snippet + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToSnippet: [ + "content:80", + "description", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_all_attributes_to_snippet +void snippetForsetSettings79() async { + // >SEPARATOR setSettings set_all_attributes_to_snippet + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesToSnippet: [ + "*:80", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_highlight_pre_tag +void snippetForsetSettings80() async { + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + highlightPreTag: "", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_highlight_post_tag +void snippetForsetSettings81() async { + // >SEPARATOR setSettings set_default_highlight_post_tag + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + highlightPostTag: "", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_snippet_ellipsis_text +void snippetForsetSettings82() async { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + snippetEllipsisText: "…", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enable_restrict_highlight_and_snippet_arrays_by_default +void snippetForsetSettings83() async { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + restrictHighlightAndSnippetArrays: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_hits_per_page +void snippetForsetSettings84() async { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + hitsPerPage: 20, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_pagination_limit +void snippetForsetSettings85() async { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + paginationLimitedTo: 1000, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_min_word_size_for_one_typo +void snippetForsetSettings86() async { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + minWordSizefor1Typo: 4, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_min_word_size_for_two_typos +void snippetForsetSettings87() async { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + minWordSizefor2Typos: 4, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_typo_tolerance_mode +void snippetForsetSettings88() async { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + typoTolerance: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disable_typos_on_numeric_tokens_by_default +void snippetForsetSettings89() async { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + allowTyposOnNumericTokens: false, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disable_typo_tolerance_for_words +void snippetForsetSettings90() async { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + disableTypoToleranceOnWords: [ + "wheel", + "1X2BCD", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_separators_to_index +void snippetForsetSettings91() async { + // >SEPARATOR setSettings set_separators_to_index + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + separatorsToIndex: "+#", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_languages_using_querylanguages +void snippetForsetSettings92() async { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + queryLanguages: [ + SupportedLanguage.fromJson("es"), + ], + ignorePlurals: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_attributes_to_transliterate +void snippetForsetSettings93() async { + // >SEPARATOR setSettings set_attributes_to_transliterate + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + indexLanguages: [ + SupportedLanguage.fromJson("ja"), + ], + attributesToTransliterate: [ + "name", + "description", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_languages_using_querylanguages +void snippetForsetSettings94() async { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + queryLanguages: [ + SupportedLanguage.fromJson("es"), + ], + removeStopWords: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_camel_case_attributes +void snippetForsetSettings95() async { + // >SEPARATOR setSettings set_camel_case_attributes + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + camelCaseAttributes: [ + "description", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_decompounded_attributes +void snippetForsetSettings96() async { + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6066,7 +9527,11 @@ void snippetForsetSettings40() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - maxValuesPerFacet: 1000, + decompoundedAttributes: { + 'de': [ + "name", + ], + }, ), ); // >LOG @@ -6075,9 +9540,9 @@ void snippetForsetSettings40() async { // Snippet for the setSettings method. // -// maxFacetHits -void snippetForsetSettings41() async { - // >SEPARATOR setSettings maxFacetHits +// set_decompounded_multiple_attributes +void snippetForsetSettings97() async { + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6086,7 +9551,16 @@ void snippetForsetSettings41() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - maxFacetHits: 1000, + decompoundedAttributes: { + 'de': [ + "name_de", + "description_de", + ], + 'fi': [ + "name_fi", + "description_fi", + ], + }, ), ); // >LOG @@ -6095,9 +9569,9 @@ void snippetForsetSettings41() async { // Snippet for the setSettings method. // -// attributesForFaceting complex -void snippetForsetSettings42() async { - // >SEPARATOR setSettings attributesForFaceting complex +// set_keep_diacritics_on_characters +void snippetForsetSettings98() async { + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6106,11 +9580,55 @@ void snippetForsetSettings42() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - attributesForFaceting: [ - "actor", - "filterOnly(category)", - "searchable(publisher)", + keepDiacriticsOnCharacters: "øé", + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_custom_normalization +void snippetForsetSettings99() async { + // >SEPARATOR setSettings set_custom_normalization + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customNormalization: { + 'default': { + 'ä': "ae", + }, + }, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_languages_using_querylanguages +void snippetForsetSettings100() async { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + queryLanguages: [ + SupportedLanguage.fromJson("es"), ], + removeStopWords: true, + ignorePlurals: true, ), ); // >LOG @@ -6119,9 +9637,9 @@ void snippetForsetSettings42() async { // Snippet for the setSettings method. // -// ranking closest dates -void snippetForsetSettings43() async { - // >SEPARATOR setSettings ranking closest dates +// set_indexlanguages +void snippetForsetSettings101() async { + // >SEPARATOR setSettings set_indexlanguages // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6130,16 +9648,8 @@ void snippetForsetSettings43() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - ranking: [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + indexLanguages: [ + SupportedLanguage.fromJson("ja"), ], ), ); @@ -6149,9 +9659,9 @@ void snippetForsetSettings43() async { // Snippet for the setSettings method. // -// searchableAttributes item variation -void snippetForsetSettings44() async { - // >SEPARATOR setSettings searchableAttributes item variation +// enable_decompound_query_by_default +void snippetForsetSettings102() async { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6160,10 +9670,129 @@ void snippetForsetSettings44() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "design", - "type", - "color", + decompoundQuery: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enable_rules_syntax_by_default +void snippetForsetSettings103() async { + // >SEPARATOR setSettings enable_rules_syntax_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + enableRules: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enable_personalization_settings +void snippetForsetSettings104() async { + // >SEPARATOR setSettings enable_personalization_settings + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + enablePersonalization: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_query_type +void snippetForsetSettings105() async { + // >SEPARATOR setSettings set_default_query_type + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + queryType: QueryType.fromJson("prefixLast"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_remove_words_if_no_result +void snippetForsetSettings106() async { + // >SEPARATOR setSettings set_default_remove_words_if_no_result + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("none"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enable_advanced_syntax_by_default +void snippetForsetSettings107() async { + // >SEPARATOR setSettings enable_advanced_syntax_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + advancedSyntax: true, + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_optional_words +void snippetForsetSettings108() async { + // >SEPARATOR setSettings set_default_optional_words + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + optionalWords: [ + "blue", + "iphone case", ], ), ); @@ -6173,9 +9802,96 @@ void snippetForsetSettings44() async { // Snippet for the setSettings method. // -// searchableAttributes around location -void snippetForsetSettings45() async { - // >SEPARATOR setSettings searchableAttributes around location +// disabling_prefix_search_for_some_attributes_by_default +void snippetForsetSettings109() async { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + disablePrefixOnAttributes: [ + "sku", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disabling_exact_for_some_attributes_by_default +void snippetForsetSettings110() async { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + disableExactOnAttributes: [ + "description", + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_exact_single_word_query +void snippetForsetSettings111() async { + // >SEPARATOR setSettings set_default_exact_single_word_query + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_aternative_as_exact +void snippetForsetSettings112() async { + // >SEPARATOR setSettings set_default_aternative_as_exact + // Initialize the client + final client = + SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); + + // Call the API + final response = await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + alternativesAsExact: [ + AlternativesAsExact.fromJson("ignorePlurals"), + AlternativesAsExact.fromJson("singleWordSynonym"), + ], + ), + ); + // >LOG + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enable_advanced_syntax_by_default +void snippetForsetSettings113() async { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6184,15 +9900,7 @@ void snippetForsetSettings45() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "country", - "code", - "iata_code", - ], - customRanking: [ - "desc(links_count)", - ], + advancedSyntax: true, ), ); // >LOG @@ -6201,9 +9909,9 @@ void snippetForsetSettings45() async { // Snippet for the setSettings method. // -// searchableAttributes around location -void snippetForsetSettings46() async { - // >SEPARATOR setSettings searchableAttributes around location +// set_numeric_attributes_for_filtering +void snippetForsetSettings114() async { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6212,14 +9920,9 @@ void snippetForsetSettings46() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "country", - "code", - "iata_code", - ], - customRanking: [ - "desc(links_count)", + numericAttributesForFiltering: [ + "quantity", + "popularity", ], ), ); @@ -6229,9 +9932,9 @@ void snippetForsetSettings46() async { // Snippet for the setSettings method. // -// disableTypoToleranceOnAttributes -void snippetForsetSettings47() async { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes +// enable_compression_of_integer_array +void snippetForsetSettings115() async { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6240,9 +9943,7 @@ void snippetForsetSettings47() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - disableTypoToleranceOnAttributes: [ - "serial_number", - ], + allowCompressionOfIntegerArray: true, ), ); // >LOG @@ -6251,9 +9952,9 @@ void snippetForsetSettings47() async { // Snippet for the setSettings method. // -// everything -void snippetForsetSettings48() async { - // >SEPARATOR setSettings everything +// set_attributes_for_distinct +void snippetForsetSettings116() async { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6262,140 +9963,7 @@ void snippetForsetSettings48() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - advancedSyntax: true, - advancedSyntaxFeatures: [ - AdvancedSyntaxFeatures.fromJson("exactPhrase"), - ], - allowCompressionOfIntegerArray: true, - allowTyposOnNumericTokens: true, - alternativesAsExact: [ - AlternativesAsExact.fromJson("singleWordSynonym"), - ], - attributeCriteriaComputedByMinProximity: true, - attributeForDistinct: "test", - attributesForFaceting: [ - "algolia", - ], - attributesToHighlight: [ - "algolia", - ], - attributesToRetrieve: [ - "algolia", - ], - attributesToSnippet: [ - "algolia", - ], - attributesToTransliterate: [ - "algolia", - ], - camelCaseAttributes: [ - "algolia", - ], - customNormalization: { - 'algolia': { - 'aloglia': "aglolia", - }, - }, - customRanking: [ - "algolia", - ], - decompoundQuery: false, - decompoundedAttributes: { - 'algolia': "aloglia", - }, - disableExactOnAttributes: [ - "algolia", - ], - disablePrefixOnAttributes: [ - "algolia", - ], - disableTypoToleranceOnAttributes: [ - "algolia", - ], - disableTypoToleranceOnWords: [ - "algolia", - ], - distinct: 3, - enablePersonalization: true, - enableReRanking: false, - enableRules: true, - exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), - highlightPreTag: "", - highlightPostTag: "", - hitsPerPage: 10, - ignorePlurals: false, - indexLanguages: [ - SupportedLanguage.fromJson("fr"), - ], - keepDiacriticsOnCharacters: "abc", - maxFacetHits: 20, - maxValuesPerFacet: 30, - minProximity: 6, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - mode: Mode.fromJson("neuralSearch"), - numericAttributesForFiltering: [ - "algolia", - ], - optionalWords: [ - "myspace", - ], - paginationLimitedTo: 0, - queryLanguages: [ - SupportedLanguage.fromJson("fr"), - ], - queryType: QueryType.fromJson("prefixLast"), - ranking: [ - "geo", - ], - reRankingApplyFilter: "mySearch:filters", - relevancyStrictness: 10, - removeStopWords: false, - removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), - renderingContent: RenderingContent( - facetOrdering: FacetOrdering( - facets: Facets( - order: [ - "a", - "b", - ], - ), - values: { - 'a': Value( - order: [ - "b", - ], - sortRemainingBy: SortRemainingBy.fromJson("count"), - ), - }, - ), - ), - replaceSynonymsInHighlight: true, - replicas: [ - "", - ], - responseFields: [ - "algolia", - ], - restrictHighlightAndSnippetArrays: true, - searchableAttributes: [ - "foo", - ], - semanticSearch: SemanticSearch( - eventSources: [ - "foo", - ], - ), - separatorsToIndex: "bar", - snippetEllipsisText: "---", - sortFacetValuesBy: "date", - typoTolerance: false, - unretrievableAttributes: [ - "foo", - ], - userData: { - 'user': "data", - }, + attributeForDistinct: "url", ), ); // >LOG @@ -6404,9 +9972,9 @@ void snippetForsetSettings48() async { // Snippet for the setSettings method. // -// searchableAttributesWithCustomRankingsAndAttributesForFaceting -void snippetForsetSettings49() async { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting +// set_distinct +void snippetForsetSettings117() async { + // >SEPARATOR setSettings set_distinct // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6415,21 +9983,8 @@ void snippetForsetSettings49() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "brand", - "name", - "categories", - "unordered(description)", - ], - customRanking: [ - "desc(popularity)", - ], - attributesForFaceting: [ - "searchable(brand)", - "type", - "categories", - "price", - ], + distinct: 1, + attributeForDistinct: "url", ), ); // >LOG @@ -6438,9 +9993,9 @@ void snippetForsetSettings49() async { // Snippet for the setSettings method. // -// searchableAttributesProductReferenceSuffixes -void snippetForsetSettings50() async { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes +// set_replace_synonyms_in_highlights +void snippetForsetSettings118() async { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6449,11 +10004,7 @@ void snippetForsetSettings50() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "product_reference", - "product_reference_suffixes", - ], + replaceSynonymsInHighlight: false, ), ); // >LOG @@ -6462,9 +10013,9 @@ void snippetForsetSettings50() async { // Snippet for the setSettings method. // -// queryLanguageAndIgnorePlurals -void snippetForsetSettings51() async { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals +// set_min_proximity +void snippetForsetSettings119() async { + // >SEPARATOR setSettings set_min_proximity // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6473,10 +10024,7 @@ void snippetForsetSettings51() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - queryLanguages: [ - SupportedLanguage.fromJson("en"), - ], - ignorePlurals: true, + minProximity: 1, ), ); // >LOG @@ -6485,9 +10033,9 @@ void snippetForsetSettings51() async { // Snippet for the setSettings method. // -// searchableAttributesInMovies -void snippetForsetSettings52() async { - // >SEPARATOR setSettings searchableAttributesInMovies +// set_default_field +void snippetForsetSettings120() async { + // >SEPARATOR setSettings set_default_field // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6496,10 +10044,11 @@ void snippetForsetSettings52() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "title_eng", - "title_fr", - "title_es", + responseFields: [ + "hits", + "hitsPerPage", + "nbPages", + "page", ], ), ); @@ -6509,9 +10058,9 @@ void snippetForsetSettings52() async { // Snippet for the setSettings method. // -// disablePrefixOnAttributes -void snippetForsetSettings53() async { - // >SEPARATOR setSettings disablePrefixOnAttributes +// set_max_facet_hits +void snippetForsetSettings121() async { + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6520,9 +10069,7 @@ void snippetForsetSettings53() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - disablePrefixOnAttributes: [ - "serial_number", - ], + maxFacetHits: 10, ), ); // >LOG @@ -6531,9 +10078,9 @@ void snippetForsetSettings53() async { // Snippet for the setSettings method. // -// disableTypoToleranceOnAttributes -void snippetForsetSettings54() async { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes +// set_attribute_criteria_computed_by_min_proximity +void snippetForsetSettings122() async { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6542,9 +10089,7 @@ void snippetForsetSettings54() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - disableTypoToleranceOnAttributes: [ - "serial_number", - ], + attributeCriteriaComputedByMinProximity: true, ), ); // >LOG @@ -6553,9 +10098,9 @@ void snippetForsetSettings54() async { // Snippet for the setSettings method. // -// searchableAttributesSimpleExample -void snippetForsetSettings55() async { - // >SEPARATOR setSettings searchableAttributesSimpleExample +// set_user_data +void snippetForsetSettings123() async { + // >SEPARATOR setSettings set_user_data // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6564,9 +10109,10 @@ void snippetForsetSettings55() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "serial_number", - ], + userData: { + 'extraData': + "This is the custom data that you want to store in your index", + }, ), ); // >LOG @@ -6575,9 +10121,9 @@ void snippetForsetSettings55() async { // Snippet for the setSettings method. // -// searchableAttributesSimpleExampleAlt -void snippetForsetSettings56() async { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt +// set_rendering_content +void snippetForsetSettings124() async { + // >SEPARATOR setSettings set_rendering_content // Initialize the client final client = SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'); @@ -6586,10 +10132,35 @@ void snippetForsetSettings56() async { final response = await client.setSettings( indexName: "", indexSettings: IndexSettings( - searchableAttributes: [ - "serial_number", - "serial_number_suffixes", - ], + renderingContent: RenderingContent( + facetOrdering: FacetOrdering( + facets: Facets( + order: [ + "size", + "brand", + ], + ), + values: { + 'brand': Value( + order: [ + "uniqlo", + ], + hide: [ + "muji", + ], + sortRemainingBy: SortRemainingBy.fromJson("count"), + ), + 'size': Value( + order: [ + "S", + "M", + "L", + ], + sortRemainingBy: SortRemainingBy.fromJson("hidden"), + ), + }, + ), + ), ), ); // >LOG diff --git a/docs/snippets/go/src/search.go b/docs/snippets/go/src/search.go index 2cafe2f2a8..bf4c508c86 100644 --- a/docs/snippets/go/src/search.go +++ b/docs/snippets/go/src/search.go @@ -5000,6 +5000,128 @@ func SnippetForSearchSingleIndexOfSearch13() { // SEPARATOR< } func SnippetForSearchSingleIndexOfSearch14() { + /* + Snippet for the searchSingleIndex method. + + facetFiltersBook + */ + + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch15() { + /* + Snippet for the searchSingleIndex method. + + facetFiltersAND + */ + + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("author:John Doe")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch16() { + /* + Snippet for the searchSingleIndex method. + + facetFiltersOR + */ + + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("author:John Doe")})}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch17() { + /* + Snippet for the searchSingleIndex method. + + facetFiltersCombined + */ + + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("author:John Doe"), *search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("category:Movie")})}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch18() { /* Snippet for the searchSingleIndex method. @@ -5028,7 +5150,7 @@ func SnippetForSearchSingleIndexOfSearch14() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch15() { +func SnippetForSearchSingleIndexOfSearch19() { /* Snippet for the searchSingleIndex method. @@ -5058,7 +5180,7 @@ func SnippetForSearchSingleIndexOfSearch15() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch16() { +func SnippetForSearchSingleIndexOfSearch20() { /* Snippet for the searchSingleIndex method. @@ -5088,7 +5210,7 @@ func SnippetForSearchSingleIndexOfSearch16() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch17() { +func SnippetForSearchSingleIndexOfSearch21() { /* Snippet for the searchSingleIndex method. @@ -5118,7 +5240,7 @@ func SnippetForSearchSingleIndexOfSearch17() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch18() { +func SnippetForSearchSingleIndexOfSearch22() { /* Snippet for the searchSingleIndex method. @@ -5147,7 +5269,7 @@ func SnippetForSearchSingleIndexOfSearch18() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch19() { +func SnippetForSearchSingleIndexOfSearch23() { /* Snippet for the searchSingleIndex method. @@ -5176,7 +5298,7 @@ func SnippetForSearchSingleIndexOfSearch19() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch20() { +func SnippetForSearchSingleIndexOfSearch24() { /* Snippet for the searchSingleIndex method. @@ -5205,7 +5327,7 @@ func SnippetForSearchSingleIndexOfSearch20() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch21() { +func SnippetForSearchSingleIndexOfSearch25() { /* Snippet for the searchSingleIndex method. @@ -5234,7 +5356,7 @@ func SnippetForSearchSingleIndexOfSearch21() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch22() { +func SnippetForSearchSingleIndexOfSearch26() { /* Snippet for the searchSingleIndex method. @@ -5265,7 +5387,7 @@ func SnippetForSearchSingleIndexOfSearch22() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch23() { +func SnippetForSearchSingleIndexOfSearch27() { /* Snippet for the searchSingleIndex method. @@ -5296,7 +5418,7 @@ func SnippetForSearchSingleIndexOfSearch23() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch24() { +func SnippetForSearchSingleIndexOfSearch28() { /* Snippet for the searchSingleIndex method. @@ -5327,7 +5449,7 @@ func SnippetForSearchSingleIndexOfSearch24() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch25() { +func SnippetForSearchSingleIndexOfSearch29() { /* Snippet for the searchSingleIndex method. @@ -5357,7 +5479,7 @@ func SnippetForSearchSingleIndexOfSearch25() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch26() { +func SnippetForSearchSingleIndexOfSearch30() { /* Snippet for the searchSingleIndex method. @@ -5387,7 +5509,7 @@ func SnippetForSearchSingleIndexOfSearch26() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch27() { +func SnippetForSearchSingleIndexOfSearch31() { /* Snippet for the searchSingleIndex method. @@ -5417,7 +5539,7 @@ func SnippetForSearchSingleIndexOfSearch27() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch28() { +func SnippetForSearchSingleIndexOfSearch32() { /* Snippet for the searchSingleIndex method. @@ -5447,7 +5569,7 @@ func SnippetForSearchSingleIndexOfSearch28() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch29() { +func SnippetForSearchSingleIndexOfSearch33() { /* Snippet for the searchSingleIndex method. @@ -5476,7 +5598,7 @@ func SnippetForSearchSingleIndexOfSearch29() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch30() { +func SnippetForSearchSingleIndexOfSearch34() { /* Snippet for the searchSingleIndex method. @@ -5505,7 +5627,7 @@ func SnippetForSearchSingleIndexOfSearch30() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch31() { +func SnippetForSearchSingleIndexOfSearch35() { /* Snippet for the searchSingleIndex method. @@ -5534,7 +5656,7 @@ func SnippetForSearchSingleIndexOfSearch31() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch32() { +func SnippetForSearchSingleIndexOfSearch36() { /* Snippet for the searchSingleIndex method. @@ -5563,7 +5685,7 @@ func SnippetForSearchSingleIndexOfSearch32() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch33() { +func SnippetForSearchSingleIndexOfSearch37() { /* Snippet for the searchSingleIndex method. @@ -5592,7 +5714,36 @@ func SnippetForSearchSingleIndexOfSearch33() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch34() { +func SnippetForSearchSingleIndexOfSearch38() { + /* + Snippet for the searchSingleIndex method. + + userToken1234 + */ + + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetUserToken("user-1234")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch39() { /* Snippet for the searchSingleIndex method. @@ -5622,7 +5773,7 @@ func SnippetForSearchSingleIndexOfSearch34() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch35() { +func SnippetForSearchSingleIndexOfSearch40() { /* Snippet for the searchSingleIndex method. @@ -5652,7 +5803,7 @@ func SnippetForSearchSingleIndexOfSearch35() { print(response) // SEPARATOR< } -func SnippetForSearchSingleIndexOfSearch36() { +func SnippetForSearchSingleIndexOfSearch41() { /* Snippet for the searchSingleIndex method. @@ -5682,14 +5833,14 @@ func SnippetForSearchSingleIndexOfSearch36() { print(response) // SEPARATOR< } -func SnippetForSearchSynonymsOfSearch() { +func SnippetForSearchSingleIndexOfSearch42() { /* - Snippet for the searchSynonyms method. + Snippet for the searchSingleIndex method. - searchSynonyms with minimal parameters + attributesToHighlightOverride */ - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5698,8 +5849,10 @@ func SnippetForSearchSynonymsOfSearch() { } // Call the API - response, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( - "")) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToHighlight( + []string{"title", "content"})))) if err != nil { // handle the eventual error panic(err) @@ -5710,14 +5863,14 @@ func SnippetForSearchSynonymsOfSearch() { print(response) // SEPARATOR< } -func SnippetForSearchSynonymsOfSearch1() { +func SnippetForSearchSingleIndexOfSearch43() { /* - Snippet for the searchSynonyms method. + Snippet for the searchSingleIndex method. - searchSynonyms with all parameters + disableTypoToleranceOnAttributes */ - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5726,9 +5879,10 @@ func SnippetForSearchSynonymsOfSearch1() { } // Call the API - response, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( - "").WithSearchSynonymsParams( - search.NewEmptySearchSynonymsParams().SetQuery("myQuery").SetType(search.SynonymType("altcorrection1")).SetPage(10).SetHitsPerPage(10))) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDisableTypoToleranceOnAttributes( + []string{"serial_number"})))) if err != nil { // handle the eventual error panic(err) @@ -5739,14 +5893,14 @@ func SnippetForSearchSynonymsOfSearch1() { print(response) // SEPARATOR< } -func SnippetForSearchUserIdsOfSearch() { +func SnippetForSearchSingleIndexOfSearch44() { /* - Snippet for the searchUserIds method. + Snippet for the searchSingleIndex method. - searchUserIds + search_a_query */ - // >SEPARATOR searchUserIds default + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5755,9 +5909,9 @@ func SnippetForSearchUserIdsOfSearch() { } // Call the API - response, err := client.SearchUserIds(client.NewApiSearchUserIdsRequest( - - search.NewEmptySearchUserIdsParams().SetQuery("test").SetClusterName("theClusterName").SetPage(5).SetHitsPerPage(10))) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("shirt")))) if err != nil { // handle the eventual error panic(err) @@ -5768,14 +5922,14 @@ func SnippetForSearchUserIdsOfSearch() { print(response) // SEPARATOR< } -func SnippetForSetClientApiKeyOfSearch() { +func SnippetForSearchSingleIndexOfSearch45() { /* - Snippet for the setClientApiKey method. + Snippet for the searchSingleIndex method. - switch API key + search_everything */ - // >SEPARATOR setClientApiKey default + // >SEPARATOR searchSingleIndex search_everything // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5784,24 +5938,27 @@ func SnippetForSetClientApiKeyOfSearch() { } // Call the API - err = client.SetClientApiKey( - "updated-api-key") + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("")))) if err != nil { // handle the eventual error panic(err) } // >LOG + // use the model directly + print(response) // SEPARATOR< } -func SnippetForSetDictionarySettingsOfSearch() { +func SnippetForSearchSingleIndexOfSearch46() { /* - Snippet for the setDictionarySettings method. + Snippet for the searchSingleIndex method. - get setDictionarySettings results with minimal parameters + api_filtering_range_example */ - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5810,10 +5967,9 @@ func SnippetForSetDictionarySettingsOfSearch() { } // Call the API - response, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( - - search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( - search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true})))) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("books").SetFilters("price:10 TO 20")))) if err != nil { // handle the eventual error panic(err) @@ -5824,14 +5980,14 @@ func SnippetForSetDictionarySettingsOfSearch() { print(response) // SEPARATOR< } -func SnippetForSetDictionarySettingsOfSearch1() { +func SnippetForSearchSingleIndexOfSearch47() { /* - Snippet for the setDictionarySettings method. + Snippet for the searchSingleIndex method. - get setDictionarySettings results with all parameters + search_a_query */ - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5840,10 +5996,9 @@ func SnippetForSetDictionarySettingsOfSearch1() { } // Call the API - response, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( - - search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( - search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true}).SetStopwords(map[string]bool{"fr": false}).SetCompounds(map[string]bool{"ru": true})))) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetSimilarQuery("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen").SetFilters("year:1991 TO 2001")))) if err != nil { // handle the eventual error panic(err) @@ -5854,14 +6009,14 @@ func SnippetForSetDictionarySettingsOfSearch1() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch() { +func SnippetForSearchSingleIndexOfSearch48() { /* - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - minimal parameters + override_retrievable_attributes */ - // >SEPARATOR setSettings minimal parameters + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5870,9 +6025,10 @@ func SnippetForSetSettingsOfSearch() { } // Call the API - response, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetPaginationLimitedTo(10)).WithForwardToReplicas(true)) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToRetrieve( + []string{"title", "content"})))) if err != nil { // handle the eventual error panic(err) @@ -5883,14 +6039,14 @@ func SnippetForSetSettingsOfSearch() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch1() { +func SnippetForSearchSingleIndexOfSearch49() { /* - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - boolean typoTolerance + restrict_searchable_attributes */ - // >SEPARATOR setSettings boolean typoTolerance + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5899,9 +6055,10 @@ func SnippetForSetSettingsOfSearch1() { } // Call the API - response, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))).WithForwardToReplicas(true)) + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRestrictSearchableAttributes( + []string{"title", "author"})))) if err != nil { // handle the eventual error panic(err) @@ -5912,11 +6069,2508 @@ func SnippetForSetSettingsOfSearch1() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch2() { +func SnippetForSearchSingleIndexOfSearch50() { /* - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - enum typoTolerance + override_default_relevancy + */ + + // >SEPARATOR searchSingleIndex override_default_relevancy + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRelevancyStrictness(70)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch51() { + /* + Snippet for the searchSingleIndex method. + + apply_filters + */ + + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("(category:Book OR category:Ebook) AND _tags:published")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch52() { + /* + Snippet for the searchSingleIndex method. + + apply_all_filters + */ + + // >SEPARATOR searchSingleIndex apply_all_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("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\"")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch53() { + /* + Snippet for the searchSingleIndex method. + + escape_spaces + */ + + // >SEPARATOR searchSingleIndex escape_spaces + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("category:\"Books and Comics\"")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch54() { + /* + Snippet for the searchSingleIndex method. + + escape_keywords + */ + + // >SEPARATOR searchSingleIndex escape_keywords + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("keyword:\"OR\"")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch55() { + /* + Snippet for the searchSingleIndex method. + + escape_single_quotes + */ + + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("content:\"It's a wonderful day\"")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch56() { + /* + Snippet for the searchSingleIndex method. + + escape_double_quotes + */ + + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("content:\"She said \"Hello World\"")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch57() { + /* + Snippet for the searchSingleIndex method. + + apply_filters + */ + + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalFilters(search.ArrayOfOptionalFiltersAsOptionalFilters( + []search.OptionalFilters{*search.StringAsOptionalFilters("category:Book"), *search.StringAsOptionalFilters("author:John Doe")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch58() { + /* + Snippet for the searchSingleIndex method. + + apply_negative_filters + */ + + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalFilters(search.ArrayOfOptionalFiltersAsOptionalFilters( + []search.OptionalFilters{*search.StringAsOptionalFilters("category:Book"), *search.StringAsOptionalFilters("author:-John Doe")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch59() { + /* + Snippet for the searchSingleIndex method. + + apply_numeric_filters + */ + + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetNumericFilters(search.ArrayOfNumericFiltersAsNumericFilters( + []search.NumericFilters{*search.StringAsNumericFilters("price < 1000"), *search.ArrayOfNumericFiltersAsNumericFilters( + []search.NumericFilters{*search.StringAsNumericFilters("inStock = 1"), *search.StringAsNumericFilters("deliveryDate < 1441755506")})}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch60() { + /* + Snippet for the searchSingleIndex method. + + apply_tag_filters + */ + + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetTagFilters(search.ArrayOfTagFiltersAsTagFilters( + []search.TagFilters{*search.StringAsTagFilters("SciFi"), *search.ArrayOfTagFiltersAsTagFilters( + []search.TagFilters{*search.StringAsTagFilters("Book"), *search.StringAsTagFilters("Movie")})}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch61() { + /* + Snippet for the searchSingleIndex method. + + apply_filters + */ + + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSumOrFiltersScores(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch62() { + /* + Snippet for the searchSingleIndex method. + + facets_all + */ + + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacets( + []string{"*"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch63() { + /* + Snippet for the searchSingleIndex method. + + retrieve_only_some_facets + */ + + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacets( + []string{"category", "author"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch64() { + /* + Snippet for the searchSingleIndex method. + + override_default_max_values_per_facet + */ + + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMaxValuesPerFacet(20)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch65() { + /* + Snippet for the searchSingleIndex method. + + enable_faceting_after_distinct + */ + + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetingAfterDistinct(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch66() { + /* + Snippet for the searchSingleIndex method. + + sort_facet_values_alphabetically + */ + + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSortFacetValuesBy("count")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch67() { + /* + Snippet for the searchSingleIndex method. + + override_attributes_to_snippet + */ + + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToSnippet( + []string{"title", "content:80"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch68() { + /* + Snippet for the searchSingleIndex method. + + override_default_highlight_pre_tag + */ + + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHighlightPreTag("")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch69() { + /* + Snippet for the searchSingleIndex method. + + override_default_highlight_post_tag + */ + + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHighlightPostTag("")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch70() { + /* + Snippet for the searchSingleIndex method. + + override_default_snippet_ellipsis_text + */ + + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSnippetEllipsisText("")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch71() { + /* + Snippet for the searchSingleIndex method. + + enable_restrict_highlight_and_snippet_arrays + */ + + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRestrictHighlightAndSnippetArrays(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch72() { + /* + Snippet for the searchSingleIndex method. + + access_page + */ + + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPage(0)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch73() { + /* + Snippet for the searchSingleIndex method. + + override_default_hits_per_page + */ + + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHitsPerPage(10)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch74() { + /* + Snippet for the searchSingleIndex method. + + get_nth_hit + */ + + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOffset(4)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch75() { + /* + Snippet for the searchSingleIndex method. + + get_n_results + */ + + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetLength(4)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch76() { + /* + Snippet for the searchSingleIndex method. + + override_default_min_word_size_for_one_typo + */ + + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinWordSizefor1Typo(2)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch77() { + /* + Snippet for the searchSingleIndex method. + + override_default_min_word_size_for_two_typos + */ + + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinWordSizefor2Typos(2)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch78() { + /* + Snippet for the searchSingleIndex method. + + override_default_typo_tolerance_mode + */ + + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetTypoTolerance(search.BoolAsTypoTolerance(false))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch79() { + /* + Snippet for the searchSingleIndex method. + + disable_typos_on_numeric_tokens_at_search_time + */ + + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAllowTyposOnNumericTokens(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch80() { + /* + Snippet for the searchSingleIndex method. + + search_around_a_position + */ + + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundLatLng("40.71, -74.01")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch81() { + /* + Snippet for the searchSingleIndex method. + + search_around_server_ip + */ + + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundLatLngViaIP(true))), search.WithHeaderParam("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to search around")) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch82() { + /* + Snippet for the searchSingleIndex method. + + set_around_radius + */ + + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundRadius(search.Int32AsAroundRadius(1000))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch83() { + /* + Snippet for the searchSingleIndex method. + + disable_automatic_radius + */ + + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundRadius(search.AroundRadiusAllAsAroundRadius(search.AroundRadiusAll("all")))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch84() { + /* + Snippet for the searchSingleIndex method. + + set_geo_search_precision + */ + + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundPrecision(search.Int32AsAroundPrecision(100))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch85() { + /* + Snippet for the searchSingleIndex method. + + set_geo_search_precision_non_linear + */ + + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundPrecision(search.ArrayOfModelRangeAsAroundPrecision( + []search.ModelRange{*search.NewEmptyModelRange().SetFrom(0).SetValue(25), *search.NewEmptyModelRange().SetFrom(2000).SetValue(1000)}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch86() { + /* + Snippet for the searchSingleIndex method. + + set_minimum_geo_search_radius + */ + + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinimumAroundRadius(1000)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch87() { + /* + Snippet for the searchSingleIndex method. + + search_inside_rectangular_area + */ + + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625}}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch88() { + /* + Snippet for the searchSingleIndex method. + + search_inside_multiple_rectangular_areas + */ + + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625}, + []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875}}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch89() { + /* + Snippet for the searchSingleIndex method. + + search_inside_polygon_area + */ + + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsidePolygon( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625}})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch90() { + /* + Snippet for the searchSingleIndex method. + + search_inside_multiple_polygon_areas + */ + + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsidePolygon( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625}, + []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625}})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch91() { + /* + Snippet for the searchSingleIndex method. + + set_querylanguages_override + */ + + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch92() { + /* + Snippet for the searchSingleIndex method. + + set_querylanguages_override + */ + + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch93() { + /* + Snippet for the searchSingleIndex method. + + set_querylanguages_override + */ + + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch94() { + /* + Snippet for the searchSingleIndex method. + + set_querylanguages_with_japanese_query + */ + + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja"), search.SupportedLanguage("en")})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch95() { + /* + Snippet for the searchSingleIndex method. + + set_natural_languages + */ + + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetNaturalLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch96() { + /* + Snippet for the searchSingleIndex method. + + override_natural_languages_with_query + */ + + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetNaturalLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("firstWords"))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch97() { + /* + Snippet for the searchSingleIndex method. + + enable_decompound_query_search_time + */ + + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDecompoundQuery(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch98() { + /* + Snippet for the searchSingleIndex method. + + enable_rules_search_time + */ + + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableRules(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch99() { + /* + Snippet for the searchSingleIndex method. + + set_rule_contexts + */ + + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRuleContexts( + []string{"front_end", "website2"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch100() { + /* + Snippet for the searchSingleIndex method. + + enable_personalization + */ + + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch101() { + /* + Snippet for the searchSingleIndex method. + + enable_personalization_with_user_token + */ + + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true).SetUserToken("123456")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch102() { + /* + Snippet for the searchSingleIndex method. + + personalization_impact + */ + + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPersonalizationImpact(20)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch103() { + /* + Snippet for the searchSingleIndex method. + + set_user_token + */ + + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetUserToken("123456")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch104() { + /* + Snippet for the searchSingleIndex method. + + set_user_token_with_personalization + */ + + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true).SetUserToken("123456")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch105() { + /* + Snippet for the searchSingleIndex method. + + override_default_query_type + */ + + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetQueryType(search.QueryType("prefixAll"))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch106() { + /* + Snippet for the searchSingleIndex method. + + override_default_remove_words_if_no_results + */ + + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords"))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch107() { + /* + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_search_time + */ + + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch108() { + /* + Snippet for the searchSingleIndex method. + + overide_default_optional_words + */ + + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"toyota", "2020 2021"}))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch109() { + /* + Snippet for the searchSingleIndex method. + + disabling_exact_for_some_attributes_search_time + */ + + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDisableExactOnAttributes( + []string{"description"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch110() { + /* + Snippet for the searchSingleIndex method. + + override_default_exact_single_word_query + */ + + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("none"))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch111() { + /* + Snippet for the searchSingleIndex method. + + override_default_aternative_as_exact + */ + + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("multiWordsSynonym")})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch112() { + /* + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_exact_phrase + */ + + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch113() { + /* + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_exclude_words + */ + + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("excludeWords")})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch114() { + /* + Snippet for the searchSingleIndex method. + + override_distinct + */ + + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDistinct(search.Int32AsDistinct(0))))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch115() { + /* + Snippet for the searchSingleIndex method. + + get_ranking_info + */ + + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetGetRankingInfo(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch116() { + /* + Snippet for the searchSingleIndex method. + + disable_click_analytics + */ + + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetClickAnalytics(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch117() { + /* + Snippet for the searchSingleIndex method. + + enable_click_analytics + */ + + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetClickAnalytics(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch118() { + /* + Snippet for the searchSingleIndex method. + + disable_analytics + */ + + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAnalytics(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch119() { + /* + Snippet for the searchSingleIndex method. + + add_analytics_tags + */ + + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAnalyticsTags( + []string{"front_end", "website2"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch120() { + /* + Snippet for the searchSingleIndex method. + + disable_synonyms + */ + + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSynonyms(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch121() { + /* + Snippet for the searchSingleIndex method. + + override_replace_synonyms_in_highlights + */ + + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetReplaceSynonymsInHighlight(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch122() { + /* + Snippet for the searchSingleIndex method. + + override_min_proximity + */ + + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinProximity(2)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch123() { + /* + Snippet for the searchSingleIndex method. + + override_default_field + */ + + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetResponseFields( + []string{"hits", "facets"})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch124() { + /* + Snippet for the searchSingleIndex method. + + override_percentile_computation + */ + + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPercentileComputation(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch125() { + /* + Snippet for the searchSingleIndex method. + + set_ab_test + */ + + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableABTest(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSingleIndexOfSearch126() { + /* + Snippet for the searchSingleIndex method. + + set_enable_re_ranking + */ + + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableReRanking(false)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSynonymsOfSearch() { + /* + Snippet for the searchSynonyms method. + + searchSynonyms with minimal parameters + */ + + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( + "")) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchSynonymsOfSearch1() { + /* + Snippet for the searchSynonyms method. + + searchSynonyms with all parameters + */ + + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( + "").WithSearchSynonymsParams( + search.NewEmptySearchSynonymsParams().SetQuery("myQuery").SetType(search.SynonymType("altcorrection1")).SetPage(10).SetHitsPerPage(10))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSearchUserIdsOfSearch() { + /* + Snippet for the searchUserIds method. + + searchUserIds + */ + + // >SEPARATOR searchUserIds default + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SearchUserIds(client.NewApiSearchUserIdsRequest( + + search.NewEmptySearchUserIdsParams().SetQuery("test").SetClusterName("theClusterName").SetPage(5).SetHitsPerPage(10))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetClientApiKeyOfSearch() { + /* + Snippet for the setClientApiKey method. + + switch API key + */ + + // >SEPARATOR setClientApiKey default + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + err = client.SetClientApiKey( + "updated-api-key") + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // SEPARATOR< +} +func SnippetForSetDictionarySettingsOfSearch() { + /* + Snippet for the setDictionarySettings method. + + get setDictionarySettings results with minimal parameters + */ + + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( + + search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( + search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetDictionarySettingsOfSearch1() { + /* + Snippet for the setDictionarySettings method. + + get setDictionarySettings results with all parameters + */ + + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( + + search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( + search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true}).SetStopwords(map[string]bool{"fr": false}).SetCompounds(map[string]bool{"ru": true})))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch() { + /* + Snippet for the setSettings method. + + minimal parameters + */ + + // >SEPARATOR setSettings minimal parameters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetPaginationLimitedTo(10)).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch1() { + /* + Snippet for the setSettings method. + + boolean typoTolerance + */ + + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch2() { + /* + Snippet for the setSettings method. + + enum typoTolerance */ // >SEPARATOR setSettings enum typoTolerance @@ -5930,7 +8584,1828 @@ func SnippetForSetSettingsOfSearch2() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetTypoTolerance(search.TypoToleranceEnumAsTypoTolerance(search.TypoToleranceEnum("min")))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetTypoTolerance(search.TypoToleranceEnumAsTypoTolerance(search.TypoToleranceEnum("min")))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch3() { + /* + Snippet for the setSettings method. + + ignorePlurals + */ + + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetIgnorePlurals(search.BoolAsIgnorePlurals(true))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch4() { + /* + Snippet for the setSettings method. + + list of string ignorePlurals + */ + + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( + []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch5() { + /* + Snippet for the setSettings method. + + removeStopWords boolean + */ + + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRemoveStopWords(search.BoolAsRemoveStopWords(true))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch6() { + /* + Snippet for the setSettings method. + + removeStopWords list of string + */ + + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch7() { + /* + Snippet for the setSettings method. + + boolean distinct + */ + + // >SEPARATOR setSettings boolean distinct + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch8() { + /* + Snippet for the setSettings method. + + integer distinct + */ + + // >SEPARATOR setSettings integer distinct + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1))).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch9() { + /* + Snippet for the setSettings method. + + distinct company + */ + + // >SEPARATOR setSettings distinct company + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributeForDistinct("company").SetDistinct(search.BoolAsDistinct(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch10() { + /* + Snippet for the setSettings method. + + distinct design + */ + + // >SEPARATOR setSettings distinct design + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributeForDistinct("design").SetDistinct(search.BoolAsDistinct(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch11() { + /* + Snippet for the setSettings method. + + distinct true + */ + + // >SEPARATOR setSettings distinct true + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch12() { + /* + Snippet for the setSettings method. + + distinct section + */ + + // >SEPARATOR setSettings distinct section + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributeForDistinct("section").SetDistinct(search.BoolAsDistinct(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch13() { + /* + Snippet for the setSettings method. + + attributesForFaceting allergens + */ + + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"allergens"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch14() { + /* + Snippet for the setSettings method. + + api_attributes_for_faceting + */ + + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"genre", "author"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch15() { + /* + Snippet for the setSettings method. + + api_attributes_for_faceting_searchable + */ + + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"genre", "searchable(author)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch16() { + /* + Snippet for the setSettings method. + + api_attributes_for_filter_only + */ + + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(genre)", "author"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch17() { + /* + Snippet for the setSettings method. + + attributesForFaceting categoryPageId + */ + + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"searchable(categoryPageId)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch18() { + /* + Snippet for the setSettings method. + + unretrievableAttributes + */ + + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetUnretrievableAttributes( + []string{"visible_by"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch19() { + /* + Snippet for the setSettings method. + + attributesForFaceting user restricted data + */ + + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(visible_by)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch20() { + /* + Snippet for the setSettings method. + + attributesForFaceting optional filters + */ + + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"can_deliver_quickly", "restaurant"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch21() { + /* + Snippet for the setSettings method. + + attributesForFaceting redirect index + */ + + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"query_terms"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch22() { + /* + Snippet for the setSettings method. + + attributesForFaceting multiple consequences + */ + + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"director"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch23() { + /* + Snippet for the setSettings method. + + attributesForFaceting in-depth optional filters + */ + + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(brand)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch24() { + /* + Snippet for the setSettings method. + + mode neuralSearch + */ + + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch25() { + /* + Snippet for the setSettings method. + + mode keywordSearch + */ + + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch26() { + /* + Snippet for the setSettings method. + + searchableAttributes same priority + */ + + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title,comments", "ingredients"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch27() { + /* + Snippet for the setSettings method. + + searchableAttributes higher priority + */ + + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title", "ingredients"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch28() { + /* + Snippet for the setSettings method. + + customRanking retweets + */ + + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(retweets)", "desc(likes)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch29() { + /* + Snippet for the setSettings method. + + customRanking boosted + */ + + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(boosted)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch30() { + /* + Snippet for the setSettings method. + + customRanking pageviews + */ + + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(pageviews)", "desc(comments)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch31() { + /* + Snippet for the setSettings method. + + customRanking applying search parameters for a specific query + */ + + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(nb_airline_liaisons)"}).SetAttributesForFaceting( + []string{"city, country"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch32() { + /* + Snippet for the setSettings method. + + customRanking rounded pageviews + */ + + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(rounded_pageviews)", "desc(comments)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch33() { + /* + Snippet for the setSettings method. + + customRanking price + */ + + // >SEPARATOR setSettings customRanking price + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(price)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch34() { + /* + Snippet for the setSettings method. + + ranking exhaustive + */ + + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch35() { + /* + Snippet for the setSettings method. + + ranking standard replica + */ + + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(post_date_timestamp)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch36() { + /* + Snippet for the setSettings method. + + ranking virtual replica + */ + + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(post_date_timestamp)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch37() { + /* + Snippet for the setSettings method. + + customRanking and ranking sort alphabetically + */ + + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"asc(textual_attribute)"}).SetRanking( + []string{"custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch38() { + /* + Snippet for the setSettings method. + + relevancyStrictness + */ + + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"asc(textual_attribute)"}).SetRelevancyStrictness(0))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch39() { + /* + Snippet for the setSettings method. + + create replica index + */ + + // >SEPARATOR setSettings create replica index + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetReplicas( + []string{"products_price_desc"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch40() { + /* + Snippet for the setSettings method. + + create replica index articles + */ + + // >SEPARATOR setSettings create replica index articles + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetReplicas( + []string{"articles_date_desc"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch41() { + /* + Snippet for the setSettings method. + + create virtual replica index + */ + + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetReplicas( + []string{"virtual(products_price_desc)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch42() { + /* + Snippet for the setSettings method. + + unlink replica index + */ + + // >SEPARATOR setSettings unlink replica index + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetReplicas( + []string{""}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch43() { + /* + Snippet for the setSettings method. + + forwardToReplicas + */ + + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "description"})).WithForwardToReplicas(true)) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch44() { + /* + Snippet for the setSettings method. + + maxValuesPerFacet + */ + + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetMaxValuesPerFacet(1000))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch45() { + /* + Snippet for the setSettings method. + + maxFacetHits + */ + + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetMaxFacetHits(1000))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch46() { + /* + Snippet for the setSettings method. + + attributesForFaceting complex + */ + + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"actor", "filterOnly(category)", "searchable(publisher)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch47() { + /* + Snippet for the setSettings method. + + ranking closest dates + */ + + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRanking( + []string{"asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch48() { + /* + Snippet for the setSettings method. + + searchableAttributes item variation + */ + + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"design", "type", "color"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch49() { + /* + Snippet for the setSettings method. + + searchableAttributes around location + */ + + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "country", "code", "iata_code"}).SetCustomRanking( + []string{"desc(links_count)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch50() { + /* + Snippet for the setSettings method. + + attributesToHighlight + */ + + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesToHighlight( + []string{"author", "title", "content"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch51() { + /* + Snippet for the setSettings method. + + attributesToHighlightStar + */ + + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesToHighlight( + []string{"*"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch52() { + /* + Snippet for the setSettings method. + + everything + */ + + // >SEPARATOR setSettings everything + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")}).SetAllowCompressionOfIntegerArray(true).SetAllowTyposOnNumericTokens(true).SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("singleWordSynonym")}).SetAttributeCriteriaComputedByMinProximity(true).SetAttributeForDistinct("test").SetAttributesForFaceting( + []string{"algolia"}).SetAttributesToHighlight( + []string{"algolia"}).SetAttributesToRetrieve( + []string{"algolia"}).SetAttributesToSnippet( + []string{"algolia"}).SetAttributesToTransliterate( + []string{"algolia"}).SetCamelCaseAttributes( + []string{"algolia"}).SetCustomNormalization(map[string]map[string]string{"algolia": map[string]string{"aloglia": "aglolia"}}).SetCustomRanking( + []string{"algolia"}).SetDecompoundQuery(false).SetDecompoundedAttributes(map[string]any{"algolia": "aloglia"}).SetDisableExactOnAttributes( + []string{"algolia"}).SetDisablePrefixOnAttributes( + []string{"algolia"}).SetDisableTypoToleranceOnAttributes( + []string{"algolia"}).SetDisableTypoToleranceOnWords( + []string{"algolia"}).SetDistinct(search.Int32AsDistinct(3)).SetEnablePersonalization(true).SetEnableReRanking(false).SetEnableRules(true).SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")).SetHighlightPreTag("").SetHighlightPostTag("").SetHitsPerPage(10).SetIgnorePlurals(search.BoolAsIgnorePlurals(false)).SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetKeepDiacriticsOnCharacters("abc").SetMaxFacetHits(20).SetMaxValuesPerFacet(30).SetMinProximity(6).SetMinWordSizefor1Typo(5).SetMinWordSizefor2Typos(11).SetMode(search.Mode("neuralSearch")).SetNumericAttributesForFiltering( + []string{"algolia"}).SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"myspace"})).SetPaginationLimitedTo(0).SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetQueryType(search.QueryType("prefixLast")).SetRanking( + []string{"geo"}).SetReRankingApplyFilter(search.StringAsReRankingApplyFilter("mySearch:filters")).SetRelevancyStrictness(10).SetRemoveStopWords(search.BoolAsRemoveStopWords(false)).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords")).SetRenderingContent( + search.NewEmptyRenderingContent().SetFacetOrdering( + search.NewEmptyFacetOrdering().SetFacets( + search.NewEmptyFacets().SetOrder( + []string{"a", "b"})).SetValues(map[string]search.Value{"a": *search.NewEmptyValue().SetOrder( + []string{"b"}).SetSortRemainingBy(search.SortRemainingBy("count"))}))).SetReplaceSynonymsInHighlight(true).SetReplicas( + []string{""}).SetResponseFields( + []string{"algolia"}).SetRestrictHighlightAndSnippetArrays(true).SetSearchableAttributes( + []string{"foo"}).SetSemanticSearch( + search.NewEmptySemanticSearch().SetEventSources( + []string{"foo"})).SetSeparatorsToIndex("bar").SetSnippetEllipsisText("---").SetSortFacetValuesBy("date").SetTypoTolerance(search.BoolAsTypoTolerance(false)).SetUnretrievableAttributes( + []string{"foo"}).SetUserData(map[string]any{"user": "data"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch53() { + /* + Snippet for the setSettings method. + + searchableAttributesWithCustomRankingsAndAttributesForFaceting + */ + + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"brand", "name", "categories", "unordered(description)"}).SetCustomRanking( + []string{"desc(popularity)"}).SetAttributesForFaceting( + []string{"searchable(brand)", "type", "categories", "price"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch54() { + /* + Snippet for the setSettings method. + + searchableAttributesOrdering + */ + + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"unordered(title)", "cast"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch55() { + /* + Snippet for the setSettings method. + + searchableAttributesProductReferenceSuffixes + */ + + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "product_reference", "product_reference_suffixes"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch56() { + /* + Snippet for the setSettings method. + + queryLanguageAndIgnorePlurals + */ + + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("en")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch57() { + /* + Snippet for the setSettings method. + + searchableAttributesInMovies + */ + + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title_eng", "title_fr", "title_es"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch58() { + /* + Snippet for the setSettings method. + + disablePrefixOnAttributes + */ + + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( + []string{"serial_number"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch59() { + /* + Snippet for the setSettings method. + + disableTypoToleranceOnAttributes + */ + + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( + []string{"serial_number"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch60() { + /* + Snippet for the setSettings method. + + searchableAttributesSimpleExample + */ + + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"serial_number"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch61() { + /* + Snippet for the setSettings method. + + searchableAttributesSimpleExampleAlt + */ + + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"serial_number", "serial_number_suffixes"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch62() { + /* + Snippet for the setSettings method. + + set_searchable_attributes + */ + + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title,alternative_title", "author", "unordered(text)", "emails.personal"}))) if err != nil { // handle the eventual error panic(err) @@ -5941,14 +10416,14 @@ func SnippetForSetSettingsOfSearch2() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch3() { +func SnippetForSetSettingsOfSearch63() { /* Snippet for the setSettings method. - ignorePlurals + set_searchable_attributes */ - // >SEPARATOR setSettings ignorePlurals + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5959,7 +10434,8 @@ func SnippetForSetSettingsOfSearch3() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetIgnorePlurals(search.BoolAsIgnorePlurals(true))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"author", "filterOnly(isbn)", "searchable(edition)", "afterDistinct(category)", "afterDistinct(searchable(publisher))"}))) if err != nil { // handle the eventual error panic(err) @@ -5970,14 +10446,14 @@ func SnippetForSetSettingsOfSearch3() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch4() { +func SnippetForSetSettingsOfSearch64() { /* Snippet for the setSettings method. - list of string ignorePlurals + unretrievable_attributes */ - // >SEPARATOR setSettings list of string ignorePlurals + // >SEPARATOR setSettings unretrievable_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -5988,8 +10464,8 @@ func SnippetForSetSettingsOfSearch4() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( - []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetUnretrievableAttributes( + []string{"total_number_of_sales"}))) if err != nil { // handle the eventual error panic(err) @@ -6000,14 +10476,14 @@ func SnippetForSetSettingsOfSearch4() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch5() { +func SnippetForSetSettingsOfSearch65() { /* Snippet for the setSettings method. - removeStopWords boolean + set_retrievable_attributes */ - // >SEPARATOR setSettings removeStopWords boolean + // >SEPARATOR setSettings set_retrievable_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6018,7 +10494,8 @@ func SnippetForSetSettingsOfSearch5() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetRemoveStopWords(search.BoolAsRemoveStopWords(true))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"author", "title", "content"}))) if err != nil { // handle the eventual error panic(err) @@ -6029,14 +10506,14 @@ func SnippetForSetSettingsOfSearch5() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch6() { +func SnippetForSetSettingsOfSearch66() { /* Snippet for the setSettings method. - removeStopWords list of string + set_all_attributes_as_retrievable */ - // >SEPARATOR setSettings removeStopWords list of string + // >SEPARATOR setSettings set_all_attributes_as_retrievable // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6047,8 +10524,8 @@ func SnippetForSetSettingsOfSearch6() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( - []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"*"}))) if err != nil { // handle the eventual error panic(err) @@ -6059,14 +10536,14 @@ func SnippetForSetSettingsOfSearch6() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch7() { +func SnippetForSetSettingsOfSearch67() { /* Snippet for the setSettings method. - boolean distinct + specify_attributes_not_to_retrieve */ - // >SEPARATOR setSettings boolean distinct + // >SEPARATOR setSettings specify_attributes_not_to_retrieve // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6077,7 +10554,8 @@ func SnippetForSetSettingsOfSearch7() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"*", "-SKU", "-internal_desc"}))) if err != nil { // handle the eventual error panic(err) @@ -6088,14 +10566,14 @@ func SnippetForSetSettingsOfSearch7() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch8() { +func SnippetForSetSettingsOfSearch68() { /* Snippet for the setSettings method. - integer distinct + neural_search */ - // >SEPARATOR setSettings integer distinct + // >SEPARATOR setSettings neural_search // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6106,7 +10584,7 @@ func SnippetForSetSettingsOfSearch8() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) if err != nil { // handle the eventual error panic(err) @@ -6117,14 +10595,14 @@ func SnippetForSetSettingsOfSearch8() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch9() { +func SnippetForSetSettingsOfSearch69() { /* Snippet for the setSettings method. - distinct company + keyword_search */ - // >SEPARATOR setSettings distinct company + // >SEPARATOR setSettings keyword_search // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6135,7 +10613,7 @@ func SnippetForSetSettingsOfSearch9() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributeForDistinct("company").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) if err != nil { // handle the eventual error panic(err) @@ -6146,14 +10624,14 @@ func SnippetForSetSettingsOfSearch9() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch10() { +func SnippetForSetSettingsOfSearch70() { /* Snippet for the setSettings method. - distinct design + set_default_ranking */ - // >SEPARATOR setSettings distinct design + // >SEPARATOR setSettings set_default_ranking // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6164,7 +10642,8 @@ func SnippetForSetSettingsOfSearch10() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributeForDistinct("design").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetRanking( + []string{"typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"}))) if err != nil { // handle the eventual error panic(err) @@ -6175,14 +10654,14 @@ func SnippetForSetSettingsOfSearch10() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch11() { +func SnippetForSetSettingsOfSearch71() { /* Snippet for the setSettings method. - distinct true + set_ranking_by_attribute_asc */ - // >SEPARATOR setSettings distinct true + // >SEPARATOR setSettings set_ranking_by_attribute_asc // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6193,7 +10672,8 @@ func SnippetForSetSettingsOfSearch11() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetRanking( + []string{"asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) if err != nil { // handle the eventual error panic(err) @@ -6204,14 +10684,14 @@ func SnippetForSetSettingsOfSearch11() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch12() { +func SnippetForSetSettingsOfSearch72() { /* Snippet for the setSettings method. - distinct section + set_ranking_by_attribute_desc */ - // >SEPARATOR setSettings distinct section + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6222,7 +10702,8 @@ func SnippetForSetSettingsOfSearch12() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributeForDistinct("section").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) if err != nil { // handle the eventual error panic(err) @@ -6233,14 +10714,250 @@ func SnippetForSetSettingsOfSearch12() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch13() { +func SnippetForSetSettingsOfSearch73() { + /* + Snippet for the setSettings method. + + restrict_searchable_attributes + */ + + // >SEPARATOR setSettings restrict_searchable_attributes + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(popularity)", "asc(price)"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch74() { + /* + Snippet for the setSettings method. + + set_default_relevancy + */ + + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetRelevancyStrictness(90))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch75() { + /* + Snippet for the setSettings method. + + set_replicas + */ + + // >SEPARATOR setSettings set_replicas + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetReplicas( + []string{"name_of_replica_index1", "name_of_replica_index2"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch76() { + /* + Snippet for the setSettings method. + + set_default_max_values_per_facet + */ + + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetMaxValuesPerFacet(100))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch77() { + /* + Snippet for the setSettings method. + + set_default_sort_facet_values_by + */ + + // >SEPARATOR setSettings set_default_sort_facet_values_by + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetSortFacetValuesBy("alpha"))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch78() { + /* + Snippet for the setSettings method. + + set_attributes_to_snippet + */ + + // >SEPARATOR setSettings set_attributes_to_snippet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesToSnippet( + []string{"content:80", "description"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch79() { + /* + Snippet for the setSettings method. + + set_all_attributes_to_snippet + */ + + // >SEPARATOR setSettings set_all_attributes_to_snippet + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesToSnippet( + []string{"*:80"}))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch80() { + /* + Snippet for the setSettings method. + + set_default_highlight_pre_tag + */ + + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + if err != nil { + // The client can fail to initialize if you pass an invalid parameter. + panic(err) + } + + // Call the API + response, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetHighlightPreTag(""))) + if err != nil { + // handle the eventual error + panic(err) + } + + // >LOG + // use the model directly + print(response) + // SEPARATOR< +} +func SnippetForSetSettingsOfSearch81() { /* Snippet for the setSettings method. - attributesForFaceting allergens + set_default_highlight_post_tag */ - // >SEPARATOR setSettings attributesForFaceting allergens + // >SEPARATOR setSettings set_default_highlight_post_tag // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6251,8 +10968,7 @@ func SnippetForSetSettingsOfSearch13() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"allergens"}))) + search.NewEmptyIndexSettings().SetHighlightPostTag(""))) if err != nil { // handle the eventual error panic(err) @@ -6263,14 +10979,14 @@ func SnippetForSetSettingsOfSearch13() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch14() { +func SnippetForSetSettingsOfSearch82() { /* Snippet for the setSettings method. - attributesForFaceting categoryPageId + set_default_snippet_ellipsis_text */ - // >SEPARATOR setSettings attributesForFaceting categoryPageId + // >SEPARATOR setSettings set_default_snippet_ellipsis_text // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6281,8 +10997,7 @@ func SnippetForSetSettingsOfSearch14() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"searchable(categoryPageId)"}))) + search.NewEmptyIndexSettings().SetSnippetEllipsisText("…"))) if err != nil { // handle the eventual error panic(err) @@ -6293,14 +11008,14 @@ func SnippetForSetSettingsOfSearch14() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch15() { +func SnippetForSetSettingsOfSearch83() { /* Snippet for the setSettings method. - unretrievableAttributes + enable_restrict_highlight_and_snippet_arrays_by_default */ - // >SEPARATOR setSettings unretrievableAttributes + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6311,8 +11026,7 @@ func SnippetForSetSettingsOfSearch15() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetUnretrievableAttributes( - []string{"visible_by"}))) + search.NewEmptyIndexSettings().SetRestrictHighlightAndSnippetArrays(true))) if err != nil { // handle the eventual error panic(err) @@ -6323,14 +11037,14 @@ func SnippetForSetSettingsOfSearch15() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch16() { +func SnippetForSetSettingsOfSearch84() { /* Snippet for the setSettings method. - attributesForFaceting user restricted data + set_default_hits_per_page */ - // >SEPARATOR setSettings attributesForFaceting user restricted data + // >SEPARATOR setSettings set_default_hits_per_page // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6341,8 +11055,7 @@ func SnippetForSetSettingsOfSearch16() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"filterOnly(visible_by)"}))) + search.NewEmptyIndexSettings().SetHitsPerPage(20))) if err != nil { // handle the eventual error panic(err) @@ -6353,14 +11066,14 @@ func SnippetForSetSettingsOfSearch16() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch17() { +func SnippetForSetSettingsOfSearch85() { /* Snippet for the setSettings method. - attributesForFaceting optional filters + set_pagination_limit */ - // >SEPARATOR setSettings attributesForFaceting optional filters + // >SEPARATOR setSettings set_pagination_limit // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6371,8 +11084,7 @@ func SnippetForSetSettingsOfSearch17() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"can_deliver_quickly", "restaurant"}))) + search.NewEmptyIndexSettings().SetPaginationLimitedTo(1000))) if err != nil { // handle the eventual error panic(err) @@ -6383,14 +11095,14 @@ func SnippetForSetSettingsOfSearch17() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch18() { +func SnippetForSetSettingsOfSearch86() { /* Snippet for the setSettings method. - attributesForFaceting redirect index + set_default_min_word_size_for_one_typo */ - // >SEPARATOR setSettings attributesForFaceting redirect index + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6401,8 +11113,7 @@ func SnippetForSetSettingsOfSearch18() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"query_terms"}))) + search.NewEmptyIndexSettings().SetMinWordSizefor1Typo(4))) if err != nil { // handle the eventual error panic(err) @@ -6413,14 +11124,14 @@ func SnippetForSetSettingsOfSearch18() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch19() { +func SnippetForSetSettingsOfSearch87() { /* Snippet for the setSettings method. - attributesForFaceting multiple consequences + set_default_min_word_size_for_two_typos */ - // >SEPARATOR setSettings attributesForFaceting multiple consequences + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6431,8 +11142,7 @@ func SnippetForSetSettingsOfSearch19() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"director"}))) + search.NewEmptyIndexSettings().SetMinWordSizefor2Typos(4))) if err != nil { // handle the eventual error panic(err) @@ -6443,14 +11153,14 @@ func SnippetForSetSettingsOfSearch19() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch20() { +func SnippetForSetSettingsOfSearch88() { /* Snippet for the setSettings method. - attributesForFaceting in-depth optional filters + set_default_typo_tolerance_mode */ - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // >SEPARATOR setSettings set_default_typo_tolerance_mode // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6461,8 +11171,7 @@ func SnippetForSetSettingsOfSearch20() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"filterOnly(brand)"}))) + search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true)))) if err != nil { // handle the eventual error panic(err) @@ -6473,14 +11182,14 @@ func SnippetForSetSettingsOfSearch20() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch21() { +func SnippetForSetSettingsOfSearch89() { /* Snippet for the setSettings method. - mode neuralSearch + disable_typos_on_numeric_tokens_by_default */ - // >SEPARATOR setSettings mode neuralSearch + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6491,7 +11200,7 @@ func SnippetForSetSettingsOfSearch21() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) + search.NewEmptyIndexSettings().SetAllowTyposOnNumericTokens(false))) if err != nil { // handle the eventual error panic(err) @@ -6502,14 +11211,14 @@ func SnippetForSetSettingsOfSearch21() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch22() { +func SnippetForSetSettingsOfSearch90() { /* Snippet for the setSettings method. - mode keywordSearch + disable_typo_tolerance_for_words */ - // >SEPARATOR setSettings mode keywordSearch + // >SEPARATOR setSettings disable_typo_tolerance_for_words // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6520,7 +11229,8 @@ func SnippetForSetSettingsOfSearch22() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) + search.NewEmptyIndexSettings().SetDisableTypoToleranceOnWords( + []string{"wheel", "1X2BCD"}))) if err != nil { // handle the eventual error panic(err) @@ -6531,14 +11241,14 @@ func SnippetForSetSettingsOfSearch22() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch23() { +func SnippetForSetSettingsOfSearch91() { /* Snippet for the setSettings method. - searchableAttributes same priority + set_separators_to_index */ - // >SEPARATOR setSettings searchableAttributes same priority + // >SEPARATOR setSettings set_separators_to_index // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6549,8 +11259,7 @@ func SnippetForSetSettingsOfSearch23() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title,comments", "ingredients"}))) + search.NewEmptyIndexSettings().SetSeparatorsToIndex("+#"))) if err != nil { // handle the eventual error panic(err) @@ -6561,14 +11270,14 @@ func SnippetForSetSettingsOfSearch23() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch24() { +func SnippetForSetSettingsOfSearch92() { /* Snippet for the setSettings method. - searchableAttributes higher priority + set_languages_using_querylanguages */ - // >SEPARATOR setSettings searchableAttributes higher priority + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6579,8 +11288,8 @@ func SnippetForSetSettingsOfSearch24() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title", "ingredients"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) if err != nil { // handle the eventual error panic(err) @@ -6591,14 +11300,14 @@ func SnippetForSetSettingsOfSearch24() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch25() { +func SnippetForSetSettingsOfSearch93() { /* Snippet for the setSettings method. - customRanking retweets + set_attributes_to_transliterate */ - // >SEPARATOR setSettings customRanking retweets + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6609,8 +11318,9 @@ func SnippetForSetSettingsOfSearch25() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(retweets)", "desc(likes)"}))) + search.NewEmptyIndexSettings().SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja")}).SetAttributesToTransliterate( + []string{"name", "description"}))) if err != nil { // handle the eventual error panic(err) @@ -6621,14 +11331,14 @@ func SnippetForSetSettingsOfSearch25() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch26() { +func SnippetForSetSettingsOfSearch94() { /* Snippet for the setSettings method. - customRanking boosted + set_languages_using_querylanguages */ - // >SEPARATOR setSettings customRanking boosted + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6639,8 +11349,8 @@ func SnippetForSetSettingsOfSearch26() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(boosted)"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetRemoveStopWords(search.BoolAsRemoveStopWords(true)))) if err != nil { // handle the eventual error panic(err) @@ -6651,14 +11361,14 @@ func SnippetForSetSettingsOfSearch26() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch27() { +func SnippetForSetSettingsOfSearch95() { /* Snippet for the setSettings method. - customRanking pageviews + set_camel_case_attributes */ - // >SEPARATOR setSettings customRanking pageviews + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6669,8 +11379,8 @@ func SnippetForSetSettingsOfSearch27() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(pageviews)", "desc(comments)"}))) + search.NewEmptyIndexSettings().SetCamelCaseAttributes( + []string{"description"}))) if err != nil { // handle the eventual error panic(err) @@ -6681,14 +11391,14 @@ func SnippetForSetSettingsOfSearch27() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch28() { +func SnippetForSetSettingsOfSearch96() { /* Snippet for the setSettings method. - customRanking applying search parameters for a specific query + set_decompounded_attributes */ - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6699,9 +11409,7 @@ func SnippetForSetSettingsOfSearch28() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(nb_airline_liaisons)"}).SetAttributesForFaceting( - []string{"city, country"}))) + search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{"de": []string{"name"}}))) if err != nil { // handle the eventual error panic(err) @@ -6712,14 +11420,14 @@ func SnippetForSetSettingsOfSearch28() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch29() { +func SnippetForSetSettingsOfSearch97() { /* Snippet for the setSettings method. - customRanking rounded pageviews + set_decompounded_multiple_attributes */ - // >SEPARATOR setSettings customRanking rounded pageviews + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6730,8 +11438,7 @@ func SnippetForSetSettingsOfSearch29() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(rounded_pageviews)", "desc(comments)"}))) + search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{"de": []string{"name_de", "description_de"}, "fi": []string{"name_fi", "description_fi"}}))) if err != nil { // handle the eventual error panic(err) @@ -6742,14 +11449,14 @@ func SnippetForSetSettingsOfSearch29() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch30() { +func SnippetForSetSettingsOfSearch98() { /* Snippet for the setSettings method. - customRanking price + set_keep_diacritics_on_characters */ - // >SEPARATOR setSettings customRanking price + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6760,8 +11467,7 @@ func SnippetForSetSettingsOfSearch30() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(price)"}))) + search.NewEmptyIndexSettings().SetKeepDiacriticsOnCharacters("øé"))) if err != nil { // handle the eventual error panic(err) @@ -6772,14 +11478,14 @@ func SnippetForSetSettingsOfSearch30() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch31() { +func SnippetForSetSettingsOfSearch99() { /* Snippet for the setSettings method. - ranking exhaustive + set_custom_normalization */ - // >SEPARATOR setSettings ranking exhaustive + // >SEPARATOR setSettings set_custom_normalization // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6790,8 +11496,7 @@ func SnippetForSetSettingsOfSearch31() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetRanking( - []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + search.NewEmptyIndexSettings().SetCustomNormalization(map[string]map[string]string{"default": map[string]string{"ä": "ae"}}))) if err != nil { // handle the eventual error panic(err) @@ -6802,14 +11507,14 @@ func SnippetForSetSettingsOfSearch31() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch32() { +func SnippetForSetSettingsOfSearch100() { /* Snippet for the setSettings method. - ranking standard replica + set_languages_using_querylanguages */ - // >SEPARATOR setSettings ranking standard replica + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6820,8 +11525,8 @@ func SnippetForSetSettingsOfSearch32() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetRanking( - []string{"desc(post_date_timestamp)"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetRemoveStopWords(search.BoolAsRemoveStopWords(true)).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) if err != nil { // handle the eventual error panic(err) @@ -6832,14 +11537,14 @@ func SnippetForSetSettingsOfSearch32() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch33() { +func SnippetForSetSettingsOfSearch101() { /* Snippet for the setSettings method. - ranking virtual replica + set_indexlanguages */ - // >SEPARATOR setSettings ranking virtual replica + // >SEPARATOR setSettings set_indexlanguages // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6850,8 +11555,8 @@ func SnippetForSetSettingsOfSearch33() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(post_date_timestamp)"}))) + search.NewEmptyIndexSettings().SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja")}))) if err != nil { // handle the eventual error panic(err) @@ -6862,14 +11567,14 @@ func SnippetForSetSettingsOfSearch33() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch34() { +func SnippetForSetSettingsOfSearch102() { /* Snippet for the setSettings method. - customRanking and ranking sort alphabetically + enable_decompound_query_by_default */ - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6880,9 +11585,7 @@ func SnippetForSetSettingsOfSearch34() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"asc(textual_attribute)"}).SetRanking( - []string{"custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"}))) + search.NewEmptyIndexSettings().SetDecompoundQuery(true))) if err != nil { // handle the eventual error panic(err) @@ -6893,14 +11596,14 @@ func SnippetForSetSettingsOfSearch34() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch35() { +func SnippetForSetSettingsOfSearch103() { /* Snippet for the setSettings method. - relevancyStrictness + enable_rules_syntax_by_default */ - // >SEPARATOR setSettings relevancyStrictness + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6911,8 +11614,7 @@ func SnippetForSetSettingsOfSearch35() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"asc(textual_attribute)"}).SetRelevancyStrictness(0))) + search.NewEmptyIndexSettings().SetEnableRules(true))) if err != nil { // handle the eventual error panic(err) @@ -6923,14 +11625,14 @@ func SnippetForSetSettingsOfSearch35() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch36() { +func SnippetForSetSettingsOfSearch104() { /* Snippet for the setSettings method. - create replica index + enable_personalization_settings */ - // >SEPARATOR setSettings create replica index + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6941,8 +11643,7 @@ func SnippetForSetSettingsOfSearch36() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetReplicas( - []string{"products_price_desc"}))) + search.NewEmptyIndexSettings().SetEnablePersonalization(true))) if err != nil { // handle the eventual error panic(err) @@ -6953,14 +11654,14 @@ func SnippetForSetSettingsOfSearch36() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch37() { +func SnippetForSetSettingsOfSearch105() { /* Snippet for the setSettings method. - create virtual replica index + set_default_query_type */ - // >SEPARATOR setSettings create virtual replica index + // >SEPARATOR setSettings set_default_query_type // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -6971,8 +11672,7 @@ func SnippetForSetSettingsOfSearch37() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetReplicas( - []string{"virtual(products_price_desc)"}))) + search.NewEmptyIndexSettings().SetQueryType(search.QueryType("prefixLast")))) if err != nil { // handle the eventual error panic(err) @@ -6983,14 +11683,14 @@ func SnippetForSetSettingsOfSearch37() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch38() { +func SnippetForSetSettingsOfSearch106() { /* Snippet for the setSettings method. - unlink replica index + set_default_remove_words_if_no_result */ - // >SEPARATOR setSettings unlink replica index + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7001,8 +11701,7 @@ func SnippetForSetSettingsOfSearch38() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetReplicas( - []string{""}))) + search.NewEmptyIndexSettings().SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("none")))) if err != nil { // handle the eventual error panic(err) @@ -7013,14 +11712,14 @@ func SnippetForSetSettingsOfSearch38() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch39() { +func SnippetForSetSettingsOfSearch107() { /* Snippet for the setSettings method. - forwardToReplicas + enable_advanced_syntax_by_default */ - // >SEPARATOR setSettings forwardToReplicas + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7031,8 +11730,7 @@ func SnippetForSetSettingsOfSearch39() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "description"})).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAdvancedSyntax(true))) if err != nil { // handle the eventual error panic(err) @@ -7043,14 +11741,14 @@ func SnippetForSetSettingsOfSearch39() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch40() { +func SnippetForSetSettingsOfSearch108() { /* Snippet for the setSettings method. - maxValuesPerFacet + set_default_optional_words */ - // >SEPARATOR setSettings maxValuesPerFacet + // >SEPARATOR setSettings set_default_optional_words // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7061,7 +11759,8 @@ func SnippetForSetSettingsOfSearch40() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetMaxValuesPerFacet(1000))) + search.NewEmptyIndexSettings().SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"blue", "iphone case"})))) if err != nil { // handle the eventual error panic(err) @@ -7072,14 +11771,14 @@ func SnippetForSetSettingsOfSearch40() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch41() { +func SnippetForSetSettingsOfSearch109() { /* Snippet for the setSettings method. - maxFacetHits + disabling_prefix_search_for_some_attributes_by_default */ - // >SEPARATOR setSettings maxFacetHits + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7090,7 +11789,8 @@ func SnippetForSetSettingsOfSearch41() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetMaxFacetHits(1000))) + search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( + []string{"sku"}))) if err != nil { // handle the eventual error panic(err) @@ -7101,14 +11801,14 @@ func SnippetForSetSettingsOfSearch41() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch42() { +func SnippetForSetSettingsOfSearch110() { /* Snippet for the setSettings method. - attributesForFaceting complex + disabling_exact_for_some_attributes_by_default */ - // >SEPARATOR setSettings attributesForFaceting complex + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7119,8 +11819,8 @@ func SnippetForSetSettingsOfSearch42() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"actor", "filterOnly(category)", "searchable(publisher)"}))) + search.NewEmptyIndexSettings().SetDisableExactOnAttributes( + []string{"description"}))) if err != nil { // handle the eventual error panic(err) @@ -7131,14 +11831,14 @@ func SnippetForSetSettingsOfSearch42() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch43() { +func SnippetForSetSettingsOfSearch111() { /* Snippet for the setSettings method. - ranking closest dates + set_default_exact_single_word_query */ - // >SEPARATOR setSettings ranking closest dates + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7149,8 +11849,7 @@ func SnippetForSetSettingsOfSearch43() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetRanking( - []string{"asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + search.NewEmptyIndexSettings().SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")))) if err != nil { // handle the eventual error panic(err) @@ -7161,14 +11860,14 @@ func SnippetForSetSettingsOfSearch43() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch44() { +func SnippetForSetSettingsOfSearch112() { /* Snippet for the setSettings method. - searchableAttributes item variation + set_default_aternative_as_exact */ - // >SEPARATOR setSettings searchableAttributes item variation + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7179,8 +11878,8 @@ func SnippetForSetSettingsOfSearch44() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"design", "type", "color"}))) + search.NewEmptyIndexSettings().SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("ignorePlurals"), search.AlternativesAsExact("singleWordSynonym")}))) if err != nil { // handle the eventual error panic(err) @@ -7191,14 +11890,14 @@ func SnippetForSetSettingsOfSearch44() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch45() { +func SnippetForSetSettingsOfSearch113() { /* Snippet for the setSettings method. - searchableAttributes around location + enable_advanced_syntax_by_default */ - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7209,9 +11908,7 @@ func SnippetForSetSettingsOfSearch45() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "country", "code", "iata_code"}).SetCustomRanking( - []string{"desc(links_count)"}))) + search.NewEmptyIndexSettings().SetAdvancedSyntax(true))) if err != nil { // handle the eventual error panic(err) @@ -7222,14 +11919,14 @@ func SnippetForSetSettingsOfSearch45() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch46() { +func SnippetForSetSettingsOfSearch114() { /* Snippet for the setSettings method. - searchableAttributes around location + set_numeric_attributes_for_filtering */ - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7240,9 +11937,8 @@ func SnippetForSetSettingsOfSearch46() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "country", "code", "iata_code"}).SetCustomRanking( - []string{"desc(links_count)"}))) + search.NewEmptyIndexSettings().SetNumericAttributesForFiltering( + []string{"quantity", "popularity"}))) if err != nil { // handle the eventual error panic(err) @@ -7253,14 +11949,14 @@ func SnippetForSetSettingsOfSearch46() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch47() { +func SnippetForSetSettingsOfSearch115() { /* Snippet for the setSettings method. - disableTypoToleranceOnAttributes + enable_compression_of_integer_array */ - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7271,8 +11967,7 @@ func SnippetForSetSettingsOfSearch47() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetAllowCompressionOfIntegerArray(true))) if err != nil { // handle the eventual error panic(err) @@ -7283,14 +11978,14 @@ func SnippetForSetSettingsOfSearch47() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch48() { +func SnippetForSetSettingsOfSearch116() { /* Snippet for the setSettings method. - everything + set_attributes_for_distinct */ - // >SEPARATOR setSettings everything + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7301,36 +11996,7 @@ func SnippetForSetSettingsOfSearch48() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( - []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")}).SetAllowCompressionOfIntegerArray(true).SetAllowTyposOnNumericTokens(true).SetAlternativesAsExact( - []search.AlternativesAsExact{search.AlternativesAsExact("singleWordSynonym")}).SetAttributeCriteriaComputedByMinProximity(true).SetAttributeForDistinct("test").SetAttributesForFaceting( - []string{"algolia"}).SetAttributesToHighlight( - []string{"algolia"}).SetAttributesToRetrieve( - []string{"algolia"}).SetAttributesToSnippet( - []string{"algolia"}).SetAttributesToTransliterate( - []string{"algolia"}).SetCamelCaseAttributes( - []string{"algolia"}).SetCustomNormalization(map[string]map[string]string{"algolia": map[string]string{"aloglia": "aglolia"}}).SetCustomRanking( - []string{"algolia"}).SetDecompoundQuery(false).SetDecompoundedAttributes(map[string]any{"algolia": "aloglia"}).SetDisableExactOnAttributes( - []string{"algolia"}).SetDisablePrefixOnAttributes( - []string{"algolia"}).SetDisableTypoToleranceOnAttributes( - []string{"algolia"}).SetDisableTypoToleranceOnWords( - []string{"algolia"}).SetDistinct(search.Int32AsDistinct(3)).SetEnablePersonalization(true).SetEnableReRanking(false).SetEnableRules(true).SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")).SetHighlightPreTag("").SetHighlightPostTag("").SetHitsPerPage(10).SetIgnorePlurals(search.BoolAsIgnorePlurals(false)).SetIndexLanguages( - []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetKeepDiacriticsOnCharacters("abc").SetMaxFacetHits(20).SetMaxValuesPerFacet(30).SetMinProximity(6).SetMinWordSizefor1Typo(5).SetMinWordSizefor2Typos(11).SetMode(search.Mode("neuralSearch")).SetNumericAttributesForFiltering( - []string{"algolia"}).SetOptionalWords(search.ArrayOfStringAsOptionalWords( - []string{"myspace"})).SetPaginationLimitedTo(0).SetQueryLanguages( - []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetQueryType(search.QueryType("prefixLast")).SetRanking( - []string{"geo"}).SetReRankingApplyFilter(search.StringAsReRankingApplyFilter("mySearch:filters")).SetRelevancyStrictness(10).SetRemoveStopWords(search.BoolAsRemoveStopWords(false)).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords")).SetRenderingContent( - search.NewEmptyRenderingContent().SetFacetOrdering( - search.NewEmptyFacetOrdering().SetFacets( - search.NewEmptyFacets().SetOrder( - []string{"a", "b"})).SetValues(map[string]search.Value{"a": *search.NewEmptyValue().SetOrder( - []string{"b"}).SetSortRemainingBy(search.SortRemainingBy("count"))}))).SetReplaceSynonymsInHighlight(true).SetReplicas( - []string{""}).SetResponseFields( - []string{"algolia"}).SetRestrictHighlightAndSnippetArrays(true).SetSearchableAttributes( - []string{"foo"}).SetSemanticSearch( - search.NewEmptySemanticSearch().SetEventSources( - []string{"foo"})).SetSeparatorsToIndex("bar").SetSnippetEllipsisText("---").SetSortFacetValuesBy("date").SetTypoTolerance(search.BoolAsTypoTolerance(false)).SetUnretrievableAttributes( - []string{"foo"}).SetUserData(map[string]any{"user": "data"}))) + search.NewEmptyIndexSettings().SetAttributeForDistinct("url"))) if err != nil { // handle the eventual error panic(err) @@ -7341,14 +12007,14 @@ func SnippetForSetSettingsOfSearch48() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch49() { +func SnippetForSetSettingsOfSearch117() { /* Snippet for the setSettings method. - searchableAttributesWithCustomRankingsAndAttributesForFaceting + set_distinct */ - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // >SEPARATOR setSettings set_distinct // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7359,10 +12025,7 @@ func SnippetForSetSettingsOfSearch49() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"brand", "name", "categories", "unordered(description)"}).SetCustomRanking( - []string{"desc(popularity)"}).SetAttributesForFaceting( - []string{"searchable(brand)", "type", "categories", "price"}))) + search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1)).SetAttributeForDistinct("url"))) if err != nil { // handle the eventual error panic(err) @@ -7373,14 +12036,14 @@ func SnippetForSetSettingsOfSearch49() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch50() { +func SnippetForSetSettingsOfSearch118() { /* Snippet for the setSettings method. - searchableAttributesProductReferenceSuffixes + set_replace_synonyms_in_highlights */ - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7391,8 +12054,7 @@ func SnippetForSetSettingsOfSearch50() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "product_reference", "product_reference_suffixes"}))) + search.NewEmptyIndexSettings().SetReplaceSynonymsInHighlight(false))) if err != nil { // handle the eventual error panic(err) @@ -7403,14 +12065,14 @@ func SnippetForSetSettingsOfSearch50() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch51() { +func SnippetForSetSettingsOfSearch119() { /* Snippet for the setSettings method. - queryLanguageAndIgnorePlurals + set_min_proximity */ - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // >SEPARATOR setSettings set_min_proximity // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7421,8 +12083,7 @@ func SnippetForSetSettingsOfSearch51() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetQueryLanguages( - []search.SupportedLanguage{search.SupportedLanguage("en")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) + search.NewEmptyIndexSettings().SetMinProximity(1))) if err != nil { // handle the eventual error panic(err) @@ -7433,14 +12094,14 @@ func SnippetForSetSettingsOfSearch51() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch52() { +func SnippetForSetSettingsOfSearch120() { /* Snippet for the setSettings method. - searchableAttributesInMovies + set_default_field */ - // >SEPARATOR setSettings searchableAttributesInMovies + // >SEPARATOR setSettings set_default_field // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7451,8 +12112,8 @@ func SnippetForSetSettingsOfSearch52() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title_eng", "title_fr", "title_es"}))) + search.NewEmptyIndexSettings().SetResponseFields( + []string{"hits", "hitsPerPage", "nbPages", "page"}))) if err != nil { // handle the eventual error panic(err) @@ -7463,14 +12124,14 @@ func SnippetForSetSettingsOfSearch52() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch53() { +func SnippetForSetSettingsOfSearch121() { /* Snippet for the setSettings method. - disablePrefixOnAttributes + set_max_facet_hits */ - // >SEPARATOR setSettings disablePrefixOnAttributes + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7481,8 +12142,7 @@ func SnippetForSetSettingsOfSearch53() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetMaxFacetHits(10))) if err != nil { // handle the eventual error panic(err) @@ -7493,14 +12153,14 @@ func SnippetForSetSettingsOfSearch53() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch54() { +func SnippetForSetSettingsOfSearch122() { /* Snippet for the setSettings method. - disableTypoToleranceOnAttributes + set_attribute_criteria_computed_by_min_proximity */ - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7511,8 +12171,7 @@ func SnippetForSetSettingsOfSearch54() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetAttributeCriteriaComputedByMinProximity(true))) if err != nil { // handle the eventual error panic(err) @@ -7523,14 +12182,14 @@ func SnippetForSetSettingsOfSearch54() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch55() { +func SnippetForSetSettingsOfSearch123() { /* Snippet for the setSettings method. - searchableAttributesSimpleExample + set_user_data */ - // >SEPARATOR setSettings searchableAttributesSimpleExample + // >SEPARATOR setSettings set_user_data // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7541,8 +12200,7 @@ func SnippetForSetSettingsOfSearch55() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetUserData(map[string]any{"extraData": "This is the custom data that you want to store in your index"}))) if err != nil { // handle the eventual error panic(err) @@ -7553,14 +12211,14 @@ func SnippetForSetSettingsOfSearch55() { print(response) // SEPARATOR< } -func SnippetForSetSettingsOfSearch56() { +func SnippetForSetSettingsOfSearch124() { /* Snippet for the setSettings method. - searchableAttributesSimpleExampleAlt + set_rendering_content */ - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // >SEPARATOR setSettings set_rendering_content // Initialize the client client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") if err != nil { @@ -7571,8 +12229,14 @@ func SnippetForSetSettingsOfSearch56() { // Call the API response, err := client.SetSettings(client.NewApiSetSettingsRequest( "", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"serial_number", "serial_number_suffixes"}))) + search.NewEmptyIndexSettings().SetRenderingContent( + search.NewEmptyRenderingContent().SetFacetOrdering( + search.NewEmptyFacetOrdering().SetFacets( + search.NewEmptyFacets().SetOrder( + []string{"size", "brand"})).SetValues(map[string]search.Value{"brand": *search.NewEmptyValue().SetOrder( + []string{"uniqlo"}).SetHide( + []string{"muji"}).SetSortRemainingBy(search.SortRemainingBy("count")), "size": *search.NewEmptyValue().SetOrder( + []string{"S", "M", "L"}).SetSortRemainingBy(search.SortRemainingBy("hidden"))}))))) if err != nil { // handle the eventual error panic(err) diff --git a/docs/snippets/java/src/test/java/com/algolia/Search.java b/docs/snippets/java/src/test/java/com/algolia/Search.java index ca204d4953..003802d76c 100644 --- a/docs/snippets/java/src/test/java/com/algolia/Search.java +++ b/docs/snippets/java/src/test/java/com/algolia/Search.java @@ -3741,8 +3741,97 @@ void snippetForSearchSingleIndex13() throws Exception { // Snippet for the searchSingleIndex method. // - // facetFiltersNeg + // facetFiltersBook void snippetForSearchSingleIndex14() throws Exception { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book")))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // facetFiltersAND + void snippetForSearchSingleIndex15() throws Exception { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe")))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // facetFiltersOR + void snippetForSearchSingleIndex16() throws Exception { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters( + FacetFilters.of( + Arrays.asList(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe")))) + ) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // facetFiltersCombined + void snippetForSearchSingleIndex17() throws Exception { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters( + FacetFilters.of( + Arrays.asList( + FacetFilters.of("author:John Doe"), + FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("category:Movie"))) + ) + ) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // facetFiltersNeg + void snippetForSearchSingleIndex18() throws Exception { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3756,7 +3845,7 @@ void snippetForSearchSingleIndex14() throws Exception { // Snippet for the searchSingleIndex method. // // filtersAndFacetFilters - void snippetForSearchSingleIndex15() throws Exception { + void snippetForSearchSingleIndex19() throws Exception { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3776,7 +3865,7 @@ void snippetForSearchSingleIndex15() throws Exception { // Snippet for the searchSingleIndex method. // // facet author genre - void snippetForSearchSingleIndex16() throws Exception { + void snippetForSearchSingleIndex20() throws Exception { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3790,7 +3879,7 @@ void snippetForSearchSingleIndex16() throws Exception { // Snippet for the searchSingleIndex method. // // facet wildcard - void snippetForSearchSingleIndex17() throws Exception { + void snippetForSearchSingleIndex21() throws Exception { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3804,7 +3893,7 @@ void snippetForSearchSingleIndex17() throws Exception { // Snippet for the searchSingleIndex method. // // maxValuesPerFacet - void snippetForSearchSingleIndex18() throws Exception { + void snippetForSearchSingleIndex22() throws Exception { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3818,7 +3907,7 @@ void snippetForSearchSingleIndex18() throws Exception { // Snippet for the searchSingleIndex method. // // aroundLatLng - void snippetForSearchSingleIndex19() throws Exception { + void snippetForSearchSingleIndex23() throws Exception { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3832,7 +3921,7 @@ void snippetForSearchSingleIndex19() throws Exception { // Snippet for the searchSingleIndex method. // // aroundLatLngViaIP - void snippetForSearchSingleIndex20() throws Exception { + void snippetForSearchSingleIndex24() throws Exception { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3846,7 +3935,7 @@ void snippetForSearchSingleIndex20() throws Exception { // Snippet for the searchSingleIndex method. // // aroundRadius - void snippetForSearchSingleIndex21() throws Exception { + void snippetForSearchSingleIndex25() throws Exception { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3864,7 +3953,7 @@ void snippetForSearchSingleIndex21() throws Exception { // Snippet for the searchSingleIndex method. // // insideBoundingBox - void snippetForSearchSingleIndex22() throws Exception { + void snippetForSearchSingleIndex26() throws Exception { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3885,7 +3974,7 @@ void snippetForSearchSingleIndex22() throws Exception { // Snippet for the searchSingleIndex method. // // insidePolygon - void snippetForSearchSingleIndex23() throws Exception { + void snippetForSearchSingleIndex27() throws Exception { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3921,7 +4010,7 @@ void snippetForSearchSingleIndex23() throws Exception { // Snippet for the searchSingleIndex method. // // insidePolygon - void snippetForSearchSingleIndex24() throws Exception { + void snippetForSearchSingleIndex28() throws Exception { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3957,7 +4046,7 @@ void snippetForSearchSingleIndex24() throws Exception { // Snippet for the searchSingleIndex method. // // optionalFilters - void snippetForSearchSingleIndex25() throws Exception { + void snippetForSearchSingleIndex29() throws Exception { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -3975,7 +4064,7 @@ void snippetForSearchSingleIndex25() throws Exception { // Snippet for the searchSingleIndex method. // // optionalFiltersMany - void snippetForSearchSingleIndex26() throws Exception { + void snippetForSearchSingleIndex30() throws Exception { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4002,7 +4091,7 @@ void snippetForSearchSingleIndex26() throws Exception { // Snippet for the searchSingleIndex method. // // optionalFiltersSimple - void snippetForSearchSingleIndex27() throws Exception { + void snippetForSearchSingleIndex31() throws Exception { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4023,7 +4112,7 @@ void snippetForSearchSingleIndex27() throws Exception { // Snippet for the searchSingleIndex method. // // restrictSearchableAttributes - void snippetForSearchSingleIndex28() throws Exception { + void snippetForSearchSingleIndex32() throws Exception { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4041,7 +4130,7 @@ void snippetForSearchSingleIndex28() throws Exception { // Snippet for the searchSingleIndex method. // // getRankingInfo - void snippetForSearchSingleIndex29() throws Exception { + void snippetForSearchSingleIndex33() throws Exception { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4055,7 +4144,7 @@ void snippetForSearchSingleIndex29() throws Exception { // Snippet for the searchSingleIndex method. // // clickAnalytics - void snippetForSearchSingleIndex30() throws Exception { + void snippetForSearchSingleIndex34() throws Exception { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4069,7 +4158,7 @@ void snippetForSearchSingleIndex30() throws Exception { // Snippet for the searchSingleIndex method. // // clickAnalyticsUserToken - void snippetForSearchSingleIndex31() throws Exception { + void snippetForSearchSingleIndex35() throws Exception { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4083,7 +4172,7 @@ void snippetForSearchSingleIndex31() throws Exception { // Snippet for the searchSingleIndex method. // // enablePersonalization - void snippetForSearchSingleIndex32() throws Exception { + void snippetForSearchSingleIndex36() throws Exception { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4101,7 +4190,7 @@ void snippetForSearchSingleIndex32() throws Exception { // Snippet for the searchSingleIndex method. // // userToken - void snippetForSearchSingleIndex33() throws Exception { + void snippetForSearchSingleIndex37() throws Exception { // >SEPARATOR searchSingleIndex userToken // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4112,10 +4201,24 @@ void snippetForSearchSingleIndex33() throws Exception { // SEPARATOR< } + // Snippet for the searchSingleIndex method. + // + // userToken1234 + void snippetForSearchSingleIndex38() throws Exception { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setUserToken("user-1234"), Hit.class); + // >LOG + // SEPARATOR< + } + // Snippet for the searchSingleIndex method. // // analyticsTag - void snippetForSearchSingleIndex34() throws Exception { + void snippetForSearchSingleIndex39() throws Exception { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4133,7 +4236,7 @@ void snippetForSearchSingleIndex34() throws Exception { // Snippet for the searchSingleIndex method. // // facetFiltersUsers - void snippetForSearchSingleIndex35() throws Exception { + void snippetForSearchSingleIndex40() throws Exception { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4152,7 +4255,7 @@ void snippetForSearchSingleIndex35() throws Exception { // Snippet for the searchSingleIndex method. // // buildTheQuery - void snippetForSearchSingleIndex36() throws Exception { + void snippetForSearchSingleIndex41() throws Exception { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4170,639 +4273,3095 @@ void snippetForSearchSingleIndex36() throws Exception { // SEPARATOR< } - // Snippet for the searchSynonyms method. + // Snippet for the searchSingleIndex method. // - // searchSynonyms with minimal parameters - void snippetForSearchSynonyms() throws Exception { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // attributesToHighlightOverride + void snippetForSearchSingleIndex42() throws Exception { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.searchSynonyms(""); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAttributesToHighlight(Arrays.asList("title", "content")), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the searchSynonyms method. + // Snippet for the searchSingleIndex method. // - // searchSynonyms with all parameters - void snippetForSearchSynonyms1() throws Exception { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // disableTypoToleranceOnAttributes + void snippetForSearchSingleIndex43() throws Exception { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.searchSynonyms( + client.searchSingleIndex( "", - new SearchSynonymsParams().setQuery("myQuery").setType(SynonymType.ALTCORRECTION_1).setPage(10).setHitsPerPage(10) + new SearchParamsObject().setQuery("query").setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number")), + Hit.class ); // >LOG // SEPARATOR< } - // Snippet for the searchUserIds method. + // Snippet for the searchSingleIndex method. // - // searchUserIds - void snippetForSearchUserIds() throws Exception { - // >SEPARATOR searchUserIds default + // search_a_query + void snippetForSearchSingleIndex44() throws Exception { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.searchUserIds(new SearchUserIdsParams().setQuery("test").setClusterName("theClusterName").setPage(5).setHitsPerPage(10)); + client.searchSingleIndex("", new SearchParamsObject().setQuery("shirt"), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setClientApiKey method. + // Snippet for the searchSingleIndex method. // - // switch API key - void snippetForSetClientApiKey() throws Exception { - // >SEPARATOR setClientApiKey default + // search_everything + void snippetForSearchSingleIndex45() throws Exception { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setClientApiKey("updated-api-key"); + client.searchSingleIndex("", new SearchParamsObject().setQuery(""), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setDictionarySettings method. + // Snippet for the searchSingleIndex method. // - // get setDictionarySettings results with minimal parameters - void snippetForSetDictionarySettings() throws Exception { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // api_filtering_range_example + void snippetForSearchSingleIndex46() throws Exception { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setDictionarySettings( - new DictionarySettingsParams() - .setDisableStandardEntries( - new StandardEntries() - .setPlurals( - new HashMap() { - { - put("fr", false); - put("en", false); - put("ru", true); - } - } - ) - ) - ); + client.searchSingleIndex("", new SearchParamsObject().setQuery("books").setFilters("price:10 TO 20"), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setDictionarySettings method. + // Snippet for the searchSingleIndex method. // - // get setDictionarySettings results with all parameters - void snippetForSetDictionarySettings1() throws Exception { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // search_a_query + void snippetForSearchSingleIndex47() throws Exception { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setDictionarySettings( - new DictionarySettingsParams() - .setDisableStandardEntries( - new StandardEntries() - .setPlurals( - new HashMap() { - { - put("fr", false); - put("en", false); - put("ru", true); - } - } - ) - .setStopwords( - new HashMap() { - { - put("fr", false); - } - } - ) - .setCompounds( - new HashMap() { - { - put("ru", true); - } - } - ) - ) + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("") + .setSimilarQuery("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen") + .setFilters("year:1991 TO 2001"), + Hit.class ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // minimal parameters - void snippetForSetSettings() throws Exception { - // >SEPARATOR setSettings minimal parameters + // override_retrievable_attributes + void snippetForSearchSingleIndex48() throws Exception { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setPaginationLimitedTo(10), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAttributesToRetrieve(Arrays.asList("title", "content")), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // boolean typoTolerance - void snippetForSetSettings1() throws Exception { - // >SEPARATOR setSettings boolean typoTolerance + // restrict_searchable_attributes + void snippetForSearchSingleIndex49() throws Exception { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setRestrictSearchableAttributes(Arrays.asList("title", "author")), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // enum typoTolerance - void snippetForSetSettings2() throws Exception { - // >SEPARATOR setSettings enum typoTolerance + // override_default_relevancy + void snippetForSearchSingleIndex50() throws Exception { + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setTypoTolerance(TypoToleranceEnum.MIN), true); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setRelevancyStrictness(70), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // ignorePlurals - void snippetForSetSettings3() throws Exception { - // >SEPARATOR setSettings ignorePlurals + // apply_filters + void snippetForSearchSingleIndex51() throws Exception { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(true)), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFilters("(category:Book OR category:Ebook) AND _tags:published"), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // list of string ignorePlurals - void snippetForSetSettings4() throws Exception { - // >SEPARATOR setSettings list of string ignorePlurals + // apply_all_filters + void snippetForSearchSingleIndex52() throws Exception { + // >SEPARATOR searchSingleIndex apply_all_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( + client.searchSingleIndex( "", - new IndexSettings().setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.FR))), - true + new SearchParamsObject() + .setQuery("query") + .setFilters( + "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\"" + ), + Hit.class ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // removeStopWords boolean - void snippetForSetSettings5() throws Exception { - // >SEPARATOR setSettings removeStopWords boolean + // escape_spaces + void snippetForSearchSingleIndex53() throws Exception { + // >SEPARATOR searchSingleIndex escape_spaces // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setRemoveStopWords(RemoveStopWords.of(true)), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFilters("category:\"Books and Comics\""), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // removeStopWords list of string - void snippetForSetSettings6() throws Exception { - // >SEPARATOR setSettings removeStopWords list of string + // escape_keywords + void snippetForSearchSingleIndex54() throws Exception { + // >SEPARATOR searchSingleIndex escape_keywords // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.FR))), - true - ); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setFilters("keyword:\"OR\""), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // boolean distinct - void snippetForSetSettings7() throws Exception { - // >SEPARATOR setSettings boolean distinct + // escape_single_quotes + void snippetForSearchSingleIndex55() throws Exception { + // >SEPARATOR searchSingleIndex escape_single_quotes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDistinct(Distinct.of(true)), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFilters("content:\"It's a wonderful day\""), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // integer distinct - void snippetForSetSettings8() throws Exception { - // >SEPARATOR setSettings integer distinct + // escape_double_quotes + void snippetForSearchSingleIndex56() throws Exception { + // >SEPARATOR searchSingleIndex escape_double_quotes // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDistinct(Distinct.of(1)), true); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFilters("content:\"She said \"Hello World\""), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // distinct company - void snippetForSetSettings9() throws Exception { - // >SEPARATOR setSettings distinct company + // apply_filters + void snippetForSearchSingleIndex57() throws Exception { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributeForDistinct("company").setDistinct(Distinct.of(true))); + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setOptionalFilters(OptionalFilters.of(Arrays.asList(OptionalFilters.of("category:Book"), OptionalFilters.of("author:John Doe")))), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // distinct design - void snippetForSetSettings10() throws Exception { - // >SEPARATOR setSettings distinct design + // apply_negative_filters + void snippetForSearchSingleIndex58() throws Exception { + // >SEPARATOR searchSingleIndex apply_negative_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributeForDistinct("design").setDistinct(Distinct.of(true))); + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setOptionalFilters(OptionalFilters.of(Arrays.asList(OptionalFilters.of("category:Book"), OptionalFilters.of("author:-John Doe")))), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // distinct true - void snippetForSetSettings11() throws Exception { - // >SEPARATOR setSettings distinct true + // apply_numeric_filters + void snippetForSearchSingleIndex59() throws Exception { + // >SEPARATOR searchSingleIndex apply_numeric_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDistinct(Distinct.of(true))); + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setNumericFilters( + NumericFilters.of( + Arrays.asList( + NumericFilters.of("price < 1000"), + NumericFilters.of(Arrays.asList(NumericFilters.of("inStock = 1"), NumericFilters.of("deliveryDate < 1441755506"))) + ) + ) + ), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // distinct section - void snippetForSetSettings12() throws Exception { - // >SEPARATOR setSettings distinct section + // apply_tag_filters + void snippetForSearchSingleIndex60() throws Exception { + // >SEPARATOR searchSingleIndex apply_tag_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributeForDistinct("section").setDistinct(Distinct.of(true))); + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setTagFilters( + TagFilters.of(Arrays.asList(TagFilters.of("SciFi"), TagFilters.of(Arrays.asList(TagFilters.of("Book"), TagFilters.of("Movie"))))) + ), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting allergens - void snippetForSetSettings13() throws Exception { - // >SEPARATOR setSettings attributesForFaceting allergens + // apply_filters + void snippetForSearchSingleIndex61() throws Exception { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("allergens"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setSumOrFiltersScores(true), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting categoryPageId - void snippetForSetSettings14() throws Exception { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + // facets_all + void snippetForSearchSingleIndex62() throws Exception { + // >SEPARATOR searchSingleIndex facets_all // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("searchable(categoryPageId)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setFacets(Arrays.asList("*")), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // unretrievableAttributes - void snippetForSetSettings15() throws Exception { - // >SEPARATOR setSettings unretrievableAttributes + // retrieve_only_some_facets + void snippetForSearchSingleIndex63() throws Exception { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setUnretrievableAttributes(Arrays.asList("visible_by"))); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setFacets(Arrays.asList("category", "author")), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting user restricted data - void snippetForSetSettings16() throws Exception { - // >SEPARATOR setSettings attributesForFaceting user restricted data + // override_default_max_values_per_facet + void snippetForSearchSingleIndex64() throws Exception { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(visible_by)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setMaxValuesPerFacet(20), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting optional filters - void snippetForSetSettings17() throws Exception { - // >SEPARATOR setSettings attributesForFaceting optional filters + // enable_faceting_after_distinct + void snippetForSearchSingleIndex65() throws Exception { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setAttributesForFaceting(Arrays.asList("can_deliver_quickly", "restaurant")) - ); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setFacetingAfterDistinct(true), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting redirect index - void snippetForSetSettings18() throws Exception { - // >SEPARATOR setSettings attributesForFaceting redirect index + // sort_facet_values_alphabetically + void snippetForSearchSingleIndex66() throws Exception { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("query_terms"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setSortFacetValuesBy("count"), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting multiple consequences - void snippetForSetSettings19() throws Exception { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + // override_attributes_to_snippet + void snippetForSearchSingleIndex67() throws Exception { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("director"))); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAttributesToSnippet(Arrays.asList("title", "content:80")), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // attributesForFaceting in-depth optional filters - void snippetForSetSettings20() throws Exception { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // override_default_highlight_pre_tag + void snippetForSearchSingleIndex68() throws Exception { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(brand)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setHighlightPreTag(""), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // mode neuralSearch - void snippetForSetSettings21() throws Exception { - // >SEPARATOR setSettings mode neuralSearch + // override_default_highlight_post_tag + void snippetForSearchSingleIndex69() throws Exception { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setHighlightPostTag(""), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // mode keywordSearch - void snippetForSetSettings22() throws Exception { - // >SEPARATOR setSettings mode keywordSearch + // override_default_snippet_ellipsis_text + void snippetForSearchSingleIndex70() throws Exception { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setSnippetEllipsisText(""), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // searchableAttributes same priority - void snippetForSetSettings23() throws Exception { - // >SEPARATOR setSettings searchableAttributes same priority + // enable_restrict_highlight_and_snippet_arrays + void snippetForSearchSingleIndex71() throws Exception { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("title,comments", "ingredients"))); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setRestrictHighlightAndSnippetArrays(false), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // searchableAttributes higher priority - void snippetForSetSettings24() throws Exception { - // >SEPARATOR setSettings searchableAttributes higher priority + // access_page + void snippetForSearchSingleIndex72() throws Exception { + // >SEPARATOR searchSingleIndex access_page // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("title", "ingredients"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setPage(0), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking retweets - void snippetForSetSettings25() throws Exception { - // >SEPARATOR setSettings customRanking retweets + // override_default_hits_per_page + void snippetForSearchSingleIndex73() throws Exception { + // >SEPARATOR searchSingleIndex override_default_hits_per_page // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(retweets)", "desc(likes)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setHitsPerPage(10), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking boosted - void snippetForSetSettings26() throws Exception { - // >SEPARATOR setSettings customRanking boosted + // get_nth_hit + void snippetForSearchSingleIndex74() throws Exception { + // >SEPARATOR searchSingleIndex get_nth_hit // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(boosted)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setOffset(4), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking pageviews - void snippetForSetSettings27() throws Exception { - // >SEPARATOR setSettings customRanking pageviews + // get_n_results + void snippetForSearchSingleIndex75() throws Exception { + // >SEPARATOR searchSingleIndex get_n_results // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(pageviews)", "desc(comments)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setLength(4), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking applying search parameters for a specific query - void snippetForSetSettings28() throws Exception { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // override_default_min_word_size_for_one_typo + void snippetForSearchSingleIndex76() throws Exception { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings() - .setCustomRanking(Arrays.asList("desc(nb_airline_liaisons)")) - .setAttributesForFaceting(Arrays.asList("city, country")) - ); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setMinWordSizefor1Typo(2), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking rounded pageviews - void snippetForSetSettings29() throws Exception { - // >SEPARATOR setSettings customRanking rounded pageviews + // override_default_min_word_size_for_two_typos + void snippetForSearchSingleIndex77() throws Exception { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setCustomRanking(Arrays.asList("desc(rounded_pageviews)", "desc(comments)")) - ); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setMinWordSizefor2Typos(2), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // customRanking price - void snippetForSetSettings30() throws Exception { - // >SEPARATOR setSettings customRanking price + // override_default_typo_tolerance_mode + void snippetForSearchSingleIndex78() throws Exception { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(price)"))); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setTypoTolerance(TypoTolerance.of(false)), + Hit.class + ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // ranking exhaustive - void snippetForSetSettings31() throws Exception { - // >SEPARATOR setSettings ranking exhaustive + // disable_typos_on_numeric_tokens_at_search_time + void snippetForSearchSingleIndex79() throws Exception { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( + client.searchSingleIndex( "", - new IndexSettings() - .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + new SearchParamsObject().setQuery("query").setAllowTyposOnNumericTokens(false), + Hit.class ); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // ranking standard replica - void snippetForSetSettings32() throws Exception { - // >SEPARATOR setSettings ranking standard replica + // search_around_a_position + void snippetForSearchSingleIndex80() throws Exception { + // >SEPARATOR searchSingleIndex search_around_a_position // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setRanking(Arrays.asList("desc(post_date_timestamp)"))); + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setAroundLatLng("40.71, -74.01"), Hit.class); // >LOG // SEPARATOR< } - // Snippet for the setSettings method. + // Snippet for the searchSingleIndex method. // - // ranking virtual replica - void snippetForSetSettings33() throws Exception { - // >SEPARATOR setSettings ranking virtual replica + // search_around_server_ip + void snippetForSearchSingleIndex81() throws Exception { + // >SEPARATOR searchSingleIndex search_around_server_ip // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(post_date_timestamp)"))); + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAroundLatLngViaIP(true), + Hit.class, + new RequestOptions() + .addExtraHeader("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to search" + " around") + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_around_radius + void snippetForSearchSingleIndex82() throws Exception { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAroundRadius(AroundRadius.of(1000)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // disable_automatic_radius + void snippetForSearchSingleIndex83() throws Exception { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAroundRadius(AroundRadiusAll.ALL), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_geo_search_precision + void snippetForSearchSingleIndex84() throws Exception { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAroundPrecision(AroundPrecision.of(100)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_geo_search_precision_non_linear + void snippetForSearchSingleIndex85() throws Exception { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setAroundPrecision( + AroundPrecision.of(Arrays.asList(new Range().setFrom(0).setValue(25), new Range().setFrom(2000).setValue(1000))) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_minimum_geo_search_radius + void snippetForSearchSingleIndex86() throws Exception { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setMinimumAroundRadius(1000), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // search_inside_rectangular_area + void snippetForSearchSingleIndex87() throws Exception { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setInsideBoundingBox( + InsideBoundingBox.of(Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // search_inside_multiple_rectangular_areas + void snippetForSearchSingleIndex88() throws Exception { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setInsideBoundingBox( + InsideBoundingBox.of( + Arrays.asList( + Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), + Arrays.asList(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875) + ) + ) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // search_inside_polygon_area + void snippetForSearchSingleIndex89() throws Exception { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setInsidePolygon( + Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // search_inside_multiple_polygon_areas + void snippetForSearchSingleIndex90() throws Exception { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setInsidePolygon( + Arrays.asList( + Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), + Arrays.asList( + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625 + ) + ) + ), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_querylanguages_override + void snippetForSearchSingleIndex91() throws Exception { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_querylanguages_override + void snippetForSearchSingleIndex92() throws Exception { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_querylanguages_override + void snippetForSearchSingleIndex93() throws Exception { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_querylanguages_with_japanese_query + void snippetForSearchSingleIndex94() throws Exception { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setQueryLanguages(Arrays.asList(SupportedLanguage.JA, SupportedLanguage.EN)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_natural_languages + void snippetForSearchSingleIndex95() throws Exception { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("").setNaturalLanguages(Arrays.asList(SupportedLanguage.FR)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_natural_languages_with_query + void snippetForSearchSingleIndex96() throws Exception { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("") + .setNaturalLanguages(Arrays.asList(SupportedLanguage.FR)) + .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.FIRST_WORDS), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_decompound_query_search_time + void snippetForSearchSingleIndex97() throws Exception { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setDecompoundQuery(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_rules_search_time + void snippetForSearchSingleIndex98() throws Exception { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setEnableRules(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_rule_contexts + void snippetForSearchSingleIndex99() throws Exception { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setRuleContexts(Arrays.asList("front_end", "website2")), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_personalization + void snippetForSearchSingleIndex100() throws Exception { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setEnablePersonalization(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_personalization_with_user_token + void snippetForSearchSingleIndex101() throws Exception { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setEnablePersonalization(true).setUserToken("123456"), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // personalization_impact + void snippetForSearchSingleIndex102() throws Exception { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setPersonalizationImpact(20), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_user_token + void snippetForSearchSingleIndex103() throws Exception { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setUserToken("123456"), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_user_token_with_personalization + void snippetForSearchSingleIndex104() throws Exception { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setEnablePersonalization(true).setUserToken("123456"), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_default_query_type + void snippetForSearchSingleIndex105() throws Exception { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setQueryType(QueryType.PREFIX_ALL), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_default_remove_words_if_no_results + void snippetForSearchSingleIndex106() throws Exception { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_advanced_syntax_search_time + void snippetForSearchSingleIndex107() throws Exception { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setAdvancedSyntax(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // overide_default_optional_words + void snippetForSearchSingleIndex108() throws Exception { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setOptionalWords(OptionalWords.of(Arrays.asList("toyota", "2020 2021"))), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // disabling_exact_for_some_attributes_search_time + void snippetForSearchSingleIndex109() throws Exception { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setDisableExactOnAttributes(Arrays.asList("description")), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_default_exact_single_word_query + void snippetForSearchSingleIndex110() throws Exception { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setExactOnSingleWordQuery(ExactOnSingleWordQuery.NONE), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_default_aternative_as_exact + void snippetForSearchSingleIndex111() throws Exception { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAlternativesAsExact(Arrays.asList(AlternativesAsExact.MULTI_WORDS_SYNONYM)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_advanced_syntax_exact_phrase + void snippetForSearchSingleIndex112() throws Exception { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_advanced_syntax_exclude_words + void snippetForSearchSingleIndex113() throws Exception { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject() + .setQuery("query") + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXCLUDE_WORDS)), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_distinct + void snippetForSearchSingleIndex114() throws Exception { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setDistinct(Distinct.of(0)), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // get_ranking_info + void snippetForSearchSingleIndex115() throws Exception { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setGetRankingInfo(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // disable_click_analytics + void snippetForSearchSingleIndex116() throws Exception { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setClickAnalytics(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // enable_click_analytics + void snippetForSearchSingleIndex117() throws Exception { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setClickAnalytics(true), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // disable_analytics + void snippetForSearchSingleIndex118() throws Exception { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setAnalytics(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // add_analytics_tags + void snippetForSearchSingleIndex119() throws Exception { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setAnalyticsTags(Arrays.asList("front_end", "website2")), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // disable_synonyms + void snippetForSearchSingleIndex120() throws Exception { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setSynonyms(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_replace_synonyms_in_highlights + void snippetForSearchSingleIndex121() throws Exception { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setReplaceSynonymsInHighlight(true), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_min_proximity + void snippetForSearchSingleIndex122() throws Exception { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setMinProximity(2), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_default_field + void snippetForSearchSingleIndex123() throws Exception { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex( + "", + new SearchParamsObject().setQuery("query").setResponseFields(Arrays.asList("hits", "facets")), + Hit.class + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // override_percentile_computation + void snippetForSearchSingleIndex124() throws Exception { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setPercentileComputation(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_ab_test + void snippetForSearchSingleIndex125() throws Exception { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setEnableABTest(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSingleIndex method. + // + // set_enable_re_ranking + void snippetForSearchSingleIndex126() throws Exception { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSingleIndex("", new SearchParamsObject().setQuery("query").setEnableReRanking(false), Hit.class); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSynonyms method. + // + // searchSynonyms with minimal parameters + void snippetForSearchSynonyms() throws Exception { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSynonyms(""); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchSynonyms method. + // + // searchSynonyms with all parameters + void snippetForSearchSynonyms1() throws Exception { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchSynonyms( + "", + new SearchSynonymsParams().setQuery("myQuery").setType(SynonymType.ALTCORRECTION_1).setPage(10).setHitsPerPage(10) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the searchUserIds method. + // + // searchUserIds + void snippetForSearchUserIds() throws Exception { + // >SEPARATOR searchUserIds default + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.searchUserIds(new SearchUserIdsParams().setQuery("test").setClusterName("theClusterName").setPage(5).setHitsPerPage(10)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setClientApiKey method. + // + // switch API key + void snippetForSetClientApiKey() throws Exception { + // >SEPARATOR setClientApiKey default + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setClientApiKey("updated-api-key"); + // >LOG + // SEPARATOR< + } + + // Snippet for the setDictionarySettings method. + // + // get setDictionarySettings results with minimal parameters + void snippetForSetDictionarySettings() throws Exception { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setDictionarySettings( + new DictionarySettingsParams() + .setDisableStandardEntries( + new StandardEntries() + .setPlurals( + new HashMap() { + { + put("fr", false); + put("en", false); + put("ru", true); + } + } + ) + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setDictionarySettings method. + // + // get setDictionarySettings results with all parameters + void snippetForSetDictionarySettings1() throws Exception { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setDictionarySettings( + new DictionarySettingsParams() + .setDisableStandardEntries( + new StandardEntries() + .setPlurals( + new HashMap() { + { + put("fr", false); + put("en", false); + put("ru", true); + } + } + ) + .setStopwords( + new HashMap() { + { + put("fr", false); + } + } + ) + .setCompounds( + new HashMap() { + { + put("ru", true); + } + } + ) + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // minimal parameters + void snippetForSetSettings() throws Exception { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setPaginationLimitedTo(10), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // boolean typoTolerance + void snippetForSetSettings1() throws Exception { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // enum typoTolerance + void snippetForSetSettings2() throws Exception { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setTypoTolerance(TypoToleranceEnum.MIN), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // ignorePlurals + void snippetForSetSettings3() throws Exception { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(true)), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // list of string ignorePlurals + void snippetForSetSettings4() throws Exception { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.FR))), + true + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // removeStopWords boolean + void snippetForSetSettings5() throws Exception { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setRemoveStopWords(RemoveStopWords.of(true)), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // removeStopWords list of string + void snippetForSetSettings6() throws Exception { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.FR))), + true + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // boolean distinct + void snippetForSetSettings7() throws Exception { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDistinct(Distinct.of(true)), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // integer distinct + void snippetForSetSettings8() throws Exception { + // >SEPARATOR setSettings integer distinct + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDistinct(Distinct.of(1)), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // distinct company + void snippetForSetSettings9() throws Exception { + // >SEPARATOR setSettings distinct company + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributeForDistinct("company").setDistinct(Distinct.of(true))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // distinct design + void snippetForSetSettings10() throws Exception { + // >SEPARATOR setSettings distinct design + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributeForDistinct("design").setDistinct(Distinct.of(true))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // distinct true + void snippetForSetSettings11() throws Exception { + // >SEPARATOR setSettings distinct true + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDistinct(Distinct.of(true))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // distinct section + void snippetForSetSettings12() throws Exception { + // >SEPARATOR setSettings distinct section + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributeForDistinct("section").setDistinct(Distinct.of(true))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting allergens + void snippetForSetSettings13() throws Exception { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("allergens"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // api_attributes_for_faceting + void snippetForSetSettings14() throws Exception { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("genre", "author"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // api_attributes_for_faceting_searchable + void snippetForSetSettings15() throws Exception { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("genre", "searchable(author)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // api_attributes_for_filter_only + void snippetForSetSettings16() throws Exception { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(genre)", "author"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting categoryPageId + void snippetForSetSettings17() throws Exception { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("searchable(categoryPageId)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // unretrievableAttributes + void snippetForSetSettings18() throws Exception { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setUnretrievableAttributes(Arrays.asList("visible_by"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting user restricted data + void snippetForSetSettings19() throws Exception { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(visible_by)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting optional filters + void snippetForSetSettings20() throws Exception { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setAttributesForFaceting(Arrays.asList("can_deliver_quickly", "restaurant")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting redirect index + void snippetForSetSettings21() throws Exception { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("query_terms"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting multiple consequences + void snippetForSetSettings22() throws Exception { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("director"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting in-depth optional filters + void snippetForSetSettings23() throws Exception { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(brand)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // mode neuralSearch + void snippetForSetSettings24() throws Exception { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // mode keywordSearch + void snippetForSetSettings25() throws Exception { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributes same priority + void snippetForSetSettings26() throws Exception { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("title,comments", "ingredients"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributes higher priority + void snippetForSetSettings27() throws Exception { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("title", "ingredients"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking retweets + void snippetForSetSettings28() throws Exception { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(retweets)", "desc(likes)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking boosted + void snippetForSetSettings29() throws Exception { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(boosted)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking pageviews + void snippetForSetSettings30() throws Exception { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(pageviews)", "desc(comments)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking applying search parameters for a specific query + void snippetForSetSettings31() throws Exception { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setCustomRanking(Arrays.asList("desc(nb_airline_liaisons)")) + .setAttributesForFaceting(Arrays.asList("city, country")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking rounded pageviews + void snippetForSetSettings32() throws Exception { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setCustomRanking(Arrays.asList("desc(rounded_pageviews)", "desc(comments)")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking price + void snippetForSetSettings33() throws Exception { + // >SEPARATOR setSettings customRanking price + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(price)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // ranking exhaustive + void snippetForSetSettings34() throws Exception { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // ranking standard replica + void snippetForSetSettings35() throws Exception { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setRanking(Arrays.asList("desc(post_date_timestamp)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // ranking virtual replica + void snippetForSetSettings36() throws Exception { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(post_date_timestamp)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // customRanking and ranking sort alphabetically + void snippetForSetSettings37() throws Exception { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setCustomRanking(Arrays.asList("asc(textual_attribute)")) + .setRanking(Arrays.asList("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // relevancyStrictness + void snippetForSetSettings38() throws Exception { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setCustomRanking(Arrays.asList("asc(textual_attribute)")).setRelevancyStrictness(0) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // create replica index + void snippetForSetSettings39() throws Exception { + // >SEPARATOR setSettings create replica index + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setReplicas(Arrays.asList("products_price_desc"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // create replica index articles + void snippetForSetSettings40() throws Exception { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setReplicas(Arrays.asList("articles_date_desc"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // create virtual replica index + void snippetForSetSettings41() throws Exception { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setReplicas(Arrays.asList("virtual(products_price_desc)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // unlink replica index + void snippetForSetSettings42() throws Exception { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setReplicas(Arrays.asList(""))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // forwardToReplicas + void snippetForSetSettings43() throws Exception { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("name", "description")), true); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // maxValuesPerFacet + void snippetForSetSettings44() throws Exception { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMaxValuesPerFacet(1000)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // maxFacetHits + void snippetForSetSettings45() throws Exception { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMaxFacetHits(1000)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesForFaceting complex + void snippetForSetSettings46() throws Exception { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setAttributesForFaceting(Arrays.asList("actor", "filterOnly(category)", "searchable(publisher)")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // ranking closest dates + void snippetForSetSettings47() throws Exception { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setRanking(Arrays.asList("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributes item variation + void snippetForSetSettings48() throws Exception { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("design", "type", "color"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributes around location + void snippetForSetSettings49() throws Exception { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) + .setCustomRanking(Arrays.asList("desc(links_count)")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesToHighlight + void snippetForSetSettings50() throws Exception { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToHighlight(Arrays.asList("author", "title", "content"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // attributesToHighlightStar + void snippetForSetSettings51() throws Exception { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToHighlight(Arrays.asList("*"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // everything + void snippetForSetSettings52() throws Exception { + // >SEPARATOR setSettings everything + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)) + .setAllowCompressionOfIntegerArray(true) + .setAllowTyposOnNumericTokens(true) + .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.SINGLE_WORD_SYNONYM)) + .setAttributeCriteriaComputedByMinProximity(true) + .setAttributeForDistinct("test") + .setAttributesForFaceting(Arrays.asList("algolia")) + .setAttributesToHighlight(Arrays.asList("algolia")) + .setAttributesToRetrieve(Arrays.asList("algolia")) + .setAttributesToSnippet(Arrays.asList("algolia")) + .setAttributesToTransliterate(Arrays.asList("algolia")) + .setCamelCaseAttributes(Arrays.asList("algolia")) + .setCustomNormalization( + new HashMap() { + { + put( + "algolia", + new HashMap() { + { + put("aloglia", "aglolia"); + } + } + ); + } + } + ) + .setCustomRanking(Arrays.asList("algolia")) + .setDecompoundQuery(false) + .setDecompoundedAttributes( + new HashMap() { + { + put("algolia", "aloglia"); + } + } + ) + .setDisableExactOnAttributes(Arrays.asList("algolia")) + .setDisablePrefixOnAttributes(Arrays.asList("algolia")) + .setDisableTypoToleranceOnAttributes(Arrays.asList("algolia")) + .setDisableTypoToleranceOnWords(Arrays.asList("algolia")) + .setDistinct(Distinct.of(3)) + .setEnablePersonalization(true) + .setEnableReRanking(false) + .setEnableRules(true) + .setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE) + .setHighlightPreTag("") + .setHighlightPostTag("") + .setHitsPerPage(10) + .setIgnorePlurals(IgnorePlurals.of(false)) + .setIndexLanguages(Arrays.asList(SupportedLanguage.FR)) + .setKeepDiacriticsOnCharacters("abc") + .setMaxFacetHits(20) + .setMaxValuesPerFacet(30) + .setMinProximity(6) + .setMinWordSizefor1Typo(5) + .setMinWordSizefor2Typos(11) + .setMode(Mode.NEURAL_SEARCH) + .setNumericAttributesForFiltering(Arrays.asList("algolia")) + .setOptionalWords(OptionalWords.of(Arrays.asList("myspace"))) + .setPaginationLimitedTo(0) + .setQueryLanguages(Arrays.asList(SupportedLanguage.FR)) + .setQueryType(QueryType.PREFIX_LAST) + .setRanking(Arrays.asList("geo")) + .setReRankingApplyFilter(ReRankingApplyFilter.of("mySearch:filters")) + .setRelevancyStrictness(10) + .setRemoveStopWords(RemoveStopWords.of(false)) + .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS) + .setRenderingContent( + new RenderingContent() + .setFacetOrdering( + new FacetOrdering() + .setFacets(new Facets().setOrder(Arrays.asList("a", "b"))) + .setValues( + new HashMap() { + { + put("a", new Value().setOrder(Arrays.asList("b")).setSortRemainingBy(SortRemainingBy.COUNT)); + } + } + ) + ) + ) + .setReplaceSynonymsInHighlight(true) + .setReplicas(Arrays.asList("")) + .setResponseFields(Arrays.asList("algolia")) + .setRestrictHighlightAndSnippetArrays(true) + .setSearchableAttributes(Arrays.asList("foo")) + .setSemanticSearch(new SemanticSearch().setEventSources(Arrays.asList("foo"))) + .setSeparatorsToIndex("bar") + .setSnippetEllipsisText("---") + .setSortFacetValuesBy("date") + .setTypoTolerance(TypoTolerance.of(false)) + .setUnretrievableAttributes(Arrays.asList("foo")) + .setUserData( + new HashMap() { + { + put("user", "data"); + } + } + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesWithCustomRankingsAndAttributesForFaceting + void snippetForSetSettings53() throws Exception { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setSearchableAttributes(Arrays.asList("brand", "name", "categories", "unordered(description)")) + .setCustomRanking(Arrays.asList("desc(popularity)")) + .setAttributesForFaceting(Arrays.asList("searchable(brand)", "type", "categories", "price")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesOrdering + void snippetForSetSettings54() throws Exception { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("unordered(title)", "cast"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesProductReferenceSuffixes + void snippetForSetSettings55() throws Exception { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setSearchableAttributes(Arrays.asList("name", "product_reference", "product_reference_suffixes")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // queryLanguageAndIgnorePlurals + void snippetForSetSettings56() throws Exception { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.EN)).setIgnorePlurals(IgnorePlurals.of(true)) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesInMovies + void snippetForSetSettings57() throws Exception { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setSearchableAttributes(Arrays.asList("title_eng", "title_fr", "title_es")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // disablePrefixOnAttributes + void snippetForSetSettings58() throws Exception { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("serial_number"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // disableTypoToleranceOnAttributes + void snippetForSetSettings59() throws Exception { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesSimpleExample + void snippetForSetSettings60() throws Exception { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // searchableAttributesSimpleExampleAlt + void snippetForSetSettings61() throws Exception { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number", "serial_number_suffixes")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_searchable_attributes + void snippetForSetSettings62() throws Exception { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setSearchableAttributes(Arrays.asList("title,alternative_title", "author", "unordered(text)", "emails.personal")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_searchable_attributes + void snippetForSetSettings63() throws Exception { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setAttributesForFaceting( + Arrays.asList( + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ) + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // unretrievable_attributes + void snippetForSetSettings64() throws Exception { + // >SEPARATOR setSettings unretrievable_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setUnretrievableAttributes(Arrays.asList("total_number_of_sales"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_retrievable_attributes + void snippetForSetSettings65() throws Exception { + // >SEPARATOR setSettings set_retrievable_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToRetrieve(Arrays.asList("author", "title", "content"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_all_attributes_as_retrievable + void snippetForSetSettings66() throws Exception { + // >SEPARATOR setSettings set_all_attributes_as_retrievable + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToRetrieve(Arrays.asList("*"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // specify_attributes_not_to_retrieve + void snippetForSetSettings67() throws Exception { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToRetrieve(Arrays.asList("*", "-SKU", "-internal_desc"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // neural_search + void snippetForSetSettings68() throws Exception { + // >SEPARATOR setSettings neural_search + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // keyword_search + void snippetForSetSettings69() throws Exception { + // >SEPARATOR setSettings keyword_search + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_ranking + void snippetForSetSettings70() throws Exception { + // >SEPARATOR setSettings set_default_ranking + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setRanking(Arrays.asList("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_ranking_by_attribute_asc + void snippetForSetSettings71() throws Exception { + // >SEPARATOR setSettings set_ranking_by_attribute_asc + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setRanking(Arrays.asList("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_ranking_by_attribute_desc + void snippetForSetSettings72() throws Exception { + // >SEPARATOR setSettings set_ranking_by_attribute_desc + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // restrict_searchable_attributes + void snippetForSetSettings73() throws Exception { + // >SEPARATOR setSettings restrict_searchable_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCustomRanking(Arrays.asList("desc(popularity)", "asc(price)"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_relevancy + void snippetForSetSettings74() throws Exception { + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setRelevancyStrictness(90)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_replicas + void snippetForSetSettings75() throws Exception { + // >SEPARATOR setSettings set_replicas + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setReplicas(Arrays.asList("name_of_replica_index1", "name_of_replica_index2")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_max_values_per_facet + void snippetForSetSettings76() throws Exception { + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMaxValuesPerFacet(100)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_sort_facet_values_by + void snippetForSetSettings77() throws Exception { + // >SEPARATOR setSettings set_default_sort_facet_values_by + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSortFacetValuesBy("alpha")); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_attributes_to_snippet + void snippetForSetSettings78() throws Exception { + // >SEPARATOR setSettings set_attributes_to_snippet + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToSnippet(Arrays.asList("content:80", "description"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_all_attributes_to_snippet + void snippetForSetSettings79() throws Exception { + // >SEPARATOR setSettings set_all_attributes_to_snippet + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAttributesToSnippet(Arrays.asList("*:80"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_highlight_pre_tag + void snippetForSetSettings80() throws Exception { + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setHighlightPreTag("")); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // customRanking and ranking sort alphabetically - void snippetForSetSettings34() throws Exception { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // set_default_highlight_post_tag + void snippetForSetSettings81() throws Exception { + // >SEPARATOR setSettings set_default_highlight_post_tag + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setHighlightPostTag("")); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_snippet_ellipsis_text + void snippetForSetSettings82() throws Exception { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSnippetEllipsisText("…")); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // enable_restrict_highlight_and_snippet_arrays_by_default + void snippetForSetSettings83() throws Exception { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setRestrictHighlightAndSnippetArrays(true)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_hits_per_page + void snippetForSetSettings84() throws Exception { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setHitsPerPage(20)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_pagination_limit + void snippetForSetSettings85() throws Exception { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setPaginationLimitedTo(1000)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_min_word_size_for_one_typo + void snippetForSetSettings86() throws Exception { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMinWordSizefor1Typo(4)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_min_word_size_for_two_typos + void snippetForSetSettings87() throws Exception { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setMinWordSizefor2Typos(4)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_default_typo_tolerance_mode + void snippetForSetSettings88() throws Exception { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setTypoTolerance(TypoTolerance.of(true))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // disable_typos_on_numeric_tokens_by_default + void snippetForSetSettings89() throws Exception { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setAllowTyposOnNumericTokens(false)); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // disable_typo_tolerance_for_words + void snippetForSetSettings90() throws Exception { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setDisableTypoToleranceOnWords(Arrays.asList("wheel", "1X2BCD"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_separators_to_index + void snippetForSetSettings91() throws Exception { + // >SEPARATOR setSettings set_separators_to_index + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setSeparatorsToIndex("+#")); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_languages_using_querylanguages + void snippetForSetSettings92() throws Exception { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.ES)).setIgnorePlurals(IgnorePlurals.of(true)) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_attributes_to_transliterate + void snippetForSetSettings93() throws Exception { + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); @@ -4810,8 +7369,153 @@ void snippetForSetSettings34() throws Exception { client.setSettings( "", new IndexSettings() - .setCustomRanking(Arrays.asList("asc(textual_attribute)")) - .setRanking(Arrays.asList("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + .setIndexLanguages(Arrays.asList(SupportedLanguage.JA)) + .setAttributesToTransliterate(Arrays.asList("name", "description")) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_languages_using_querylanguages + void snippetForSetSettings94() throws Exception { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.ES)).setRemoveStopWords(RemoveStopWords.of(true)) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_camel_case_attributes + void snippetForSetSettings95() throws Exception { + // >SEPARATOR setSettings set_camel_case_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setCamelCaseAttributes(Arrays.asList("description"))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_decompounded_attributes + void snippetForSetSettings96() throws Exception { + // >SEPARATOR setSettings set_decompounded_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setDecompoundedAttributes( + new HashMap() { + { + put("de", Arrays.asList("name")); + } + } + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_decompounded_multiple_attributes + void snippetForSetSettings97() throws Exception { + // >SEPARATOR setSettings set_decompounded_multiple_attributes + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setDecompoundedAttributes( + new HashMap() { + { + put("de", Arrays.asList("name_de", "description_de")); + put("fi", Arrays.asList("name_fi", "description_fi")); + } + } + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_keep_diacritics_on_characters + void snippetForSetSettings98() throws Exception { + // >SEPARATOR setSettings set_keep_diacritics_on_characters + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setKeepDiacriticsOnCharacters("øé")); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_custom_normalization + void snippetForSetSettings99() throws Exception { + // >SEPARATOR setSettings set_custom_normalization + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setCustomNormalization( + new HashMap() { + { + put( + "default", + new HashMap() { + { + put("ä", "ae"); + } + } + ); + } + } + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_languages_using_querylanguages + void snippetForSetSettings100() throws Exception { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setQueryLanguages(Arrays.asList(SupportedLanguage.ES)) + .setRemoveStopWords(RemoveStopWords.of(true)) + .setIgnorePlurals(IgnorePlurals.of(true)) ); // >LOG // SEPARATOR< @@ -4819,168 +7523,170 @@ void snippetForSetSettings34() throws Exception { // Snippet for the setSettings method. // - // relevancyStrictness - void snippetForSetSettings35() throws Exception { - // >SEPARATOR setSettings relevancyStrictness + // set_indexlanguages + void snippetForSetSettings101() throws Exception { + // >SEPARATOR setSettings set_indexlanguages + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings("", new IndexSettings().setIndexLanguages(Arrays.asList(SupportedLanguage.JA))); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // enable_decompound_query_by_default + void snippetForSetSettings102() throws Exception { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setCustomRanking(Arrays.asList("asc(textual_attribute)")).setRelevancyStrictness(0) - ); + client.setSettings("", new IndexSettings().setDecompoundQuery(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // create replica index - void snippetForSetSettings36() throws Exception { - // >SEPARATOR setSettings create replica index + // enable_rules_syntax_by_default + void snippetForSetSettings103() throws Exception { + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setReplicas(Arrays.asList("products_price_desc"))); + client.setSettings("", new IndexSettings().setEnableRules(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // create virtual replica index - void snippetForSetSettings37() throws Exception { - // >SEPARATOR setSettings create virtual replica index + // enable_personalization_settings + void snippetForSetSettings104() throws Exception { + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setReplicas(Arrays.asList("virtual(products_price_desc)"))); + client.setSettings("", new IndexSettings().setEnablePersonalization(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // unlink replica index - void snippetForSetSettings38() throws Exception { - // >SEPARATOR setSettings unlink replica index + // set_default_query_type + void snippetForSetSettings105() throws Exception { + // >SEPARATOR setSettings set_default_query_type // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setReplicas(Arrays.asList(""))); + client.setSettings("", new IndexSettings().setQueryType(QueryType.PREFIX_LAST)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // forwardToReplicas - void snippetForSetSettings39() throws Exception { - // >SEPARATOR setSettings forwardToReplicas + // set_default_remove_words_if_no_result + void snippetForSetSettings106() throws Exception { + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("name", "description")), true); + client.setSettings("", new IndexSettings().setRemoveWordsIfNoResults(RemoveWordsIfNoResults.NONE)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // maxValuesPerFacet - void snippetForSetSettings40() throws Exception { - // >SEPARATOR setSettings maxValuesPerFacet + // enable_advanced_syntax_by_default + void snippetForSetSettings107() throws Exception { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setMaxValuesPerFacet(1000)); + client.setSettings("", new IndexSettings().setAdvancedSyntax(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // maxFacetHits - void snippetForSetSettings41() throws Exception { - // >SEPARATOR setSettings maxFacetHits + // set_default_optional_words + void snippetForSetSettings108() throws Exception { + // >SEPARATOR setSettings set_default_optional_words // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setMaxFacetHits(1000)); + client.setSettings("", new IndexSettings().setOptionalWords(OptionalWords.of(Arrays.asList("blue", "iphone case")))); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // attributesForFaceting complex - void snippetForSetSettings42() throws Exception { - // >SEPARATOR setSettings attributesForFaceting complex + // disabling_prefix_search_for_some_attributes_by_default + void snippetForSetSettings109() throws Exception { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setAttributesForFaceting(Arrays.asList("actor", "filterOnly(category)", "searchable(publisher)")) - ); + client.setSettings("", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("sku"))); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // ranking closest dates - void snippetForSetSettings43() throws Exception { - // >SEPARATOR setSettings ranking closest dates + // disabling_exact_for_some_attributes_by_default + void snippetForSetSettings110() throws Exception { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings() - .setRanking(Arrays.asList("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) - ); + client.setSettings("", new IndexSettings().setDisableExactOnAttributes(Arrays.asList("description"))); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributes item variation - void snippetForSetSettings44() throws Exception { - // >SEPARATOR setSettings searchableAttributes item variation + // set_default_exact_single_word_query + void snippetForSetSettings111() throws Exception { + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("design", "type", "color"))); + client.setSettings("", new IndexSettings().setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributes around location - void snippetForSetSettings45() throws Exception { - // >SEPARATOR setSettings searchableAttributes around location + // set_default_aternative_as_exact + void snippetForSetSettings112() throws Exception { + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API client.setSettings( "", - new IndexSettings() - .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) - .setCustomRanking(Arrays.asList("desc(links_count)")) + new IndexSettings().setAlternativesAsExact(Arrays.asList(AlternativesAsExact.IGNORE_PLURALS, AlternativesAsExact.SINGLE_WORD_SYNONYM)) ); // >LOG // SEPARATOR< @@ -4988,278 +7694,201 @@ void snippetForSetSettings45() throws Exception { // Snippet for the setSettings method. // - // searchableAttributes around location - void snippetForSetSettings46() throws Exception { - // >SEPARATOR setSettings searchableAttributes around location + // enable_advanced_syntax_by_default + void snippetForSetSettings113() throws Exception { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings() - .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) - .setCustomRanking(Arrays.asList("desc(links_count)")) - ); + client.setSettings("", new IndexSettings().setAdvancedSyntax(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // disableTypoToleranceOnAttributes - void snippetForSetSettings47() throws Exception { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // set_numeric_attributes_for_filtering + void snippetForSetSettings114() throws Exception { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("", new IndexSettings().setNumericAttributesForFiltering(Arrays.asList("quantity", "popularity"))); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // everything - void snippetForSetSettings48() throws Exception { - // >SEPARATOR setSettings everything + // enable_compression_of_integer_array + void snippetForSetSettings115() throws Exception { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings() - .setAdvancedSyntax(true) - .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)) - .setAllowCompressionOfIntegerArray(true) - .setAllowTyposOnNumericTokens(true) - .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.SINGLE_WORD_SYNONYM)) - .setAttributeCriteriaComputedByMinProximity(true) - .setAttributeForDistinct("test") - .setAttributesForFaceting(Arrays.asList("algolia")) - .setAttributesToHighlight(Arrays.asList("algolia")) - .setAttributesToRetrieve(Arrays.asList("algolia")) - .setAttributesToSnippet(Arrays.asList("algolia")) - .setAttributesToTransliterate(Arrays.asList("algolia")) - .setCamelCaseAttributes(Arrays.asList("algolia")) - .setCustomNormalization( - new HashMap() { - { - put( - "algolia", - new HashMap() { - { - put("aloglia", "aglolia"); - } - } - ); - } - } - ) - .setCustomRanking(Arrays.asList("algolia")) - .setDecompoundQuery(false) - .setDecompoundedAttributes( - new HashMap() { - { - put("algolia", "aloglia"); - } - } - ) - .setDisableExactOnAttributes(Arrays.asList("algolia")) - .setDisablePrefixOnAttributes(Arrays.asList("algolia")) - .setDisableTypoToleranceOnAttributes(Arrays.asList("algolia")) - .setDisableTypoToleranceOnWords(Arrays.asList("algolia")) - .setDistinct(Distinct.of(3)) - .setEnablePersonalization(true) - .setEnableReRanking(false) - .setEnableRules(true) - .setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE) - .setHighlightPreTag("") - .setHighlightPostTag("") - .setHitsPerPage(10) - .setIgnorePlurals(IgnorePlurals.of(false)) - .setIndexLanguages(Arrays.asList(SupportedLanguage.FR)) - .setKeepDiacriticsOnCharacters("abc") - .setMaxFacetHits(20) - .setMaxValuesPerFacet(30) - .setMinProximity(6) - .setMinWordSizefor1Typo(5) - .setMinWordSizefor2Typos(11) - .setMode(Mode.NEURAL_SEARCH) - .setNumericAttributesForFiltering(Arrays.asList("algolia")) - .setOptionalWords(OptionalWords.of(Arrays.asList("myspace"))) - .setPaginationLimitedTo(0) - .setQueryLanguages(Arrays.asList(SupportedLanguage.FR)) - .setQueryType(QueryType.PREFIX_LAST) - .setRanking(Arrays.asList("geo")) - .setReRankingApplyFilter(ReRankingApplyFilter.of("mySearch:filters")) - .setRelevancyStrictness(10) - .setRemoveStopWords(RemoveStopWords.of(false)) - .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS) - .setRenderingContent( - new RenderingContent() - .setFacetOrdering( - new FacetOrdering() - .setFacets(new Facets().setOrder(Arrays.asList("a", "b"))) - .setValues( - new HashMap() { - { - put("a", new Value().setOrder(Arrays.asList("b")).setSortRemainingBy(SortRemainingBy.COUNT)); - } - } - ) - ) - ) - .setReplaceSynonymsInHighlight(true) - .setReplicas(Arrays.asList("")) - .setResponseFields(Arrays.asList("algolia")) - .setRestrictHighlightAndSnippetArrays(true) - .setSearchableAttributes(Arrays.asList("foo")) - .setSemanticSearch(new SemanticSearch().setEventSources(Arrays.asList("foo"))) - .setSeparatorsToIndex("bar") - .setSnippetEllipsisText("---") - .setSortFacetValuesBy("date") - .setTypoTolerance(TypoTolerance.of(false)) - .setUnretrievableAttributes(Arrays.asList("foo")) - .setUserData( - new HashMap() { - { - put("user", "data"); - } - } - ) - ); + client.setSettings("", new IndexSettings().setAllowCompressionOfIntegerArray(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributesWithCustomRankingsAndAttributesForFaceting - void snippetForSetSettings49() throws Exception { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // set_attributes_for_distinct + void snippetForSetSettings116() throws Exception { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings() - .setSearchableAttributes(Arrays.asList("brand", "name", "categories", "unordered(description)")) - .setCustomRanking(Arrays.asList("desc(popularity)")) - .setAttributesForFaceting(Arrays.asList("searchable(brand)", "type", "categories", "price")) - ); + client.setSettings("", new IndexSettings().setAttributeForDistinct("url")); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributesProductReferenceSuffixes - void snippetForSetSettings50() throws Exception { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // set_distinct + void snippetForSetSettings117() throws Exception { + // >SEPARATOR setSettings set_distinct // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setSearchableAttributes(Arrays.asList("name", "product_reference", "product_reference_suffixes")) - ); + client.setSettings("", new IndexSettings().setDistinct(Distinct.of(1)).setAttributeForDistinct("url")); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // queryLanguageAndIgnorePlurals - void snippetForSetSettings51() throws Exception { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // set_replace_synonyms_in_highlights + void snippetForSetSettings118() throws Exception { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.EN)).setIgnorePlurals(IgnorePlurals.of(true)) - ); + client.setSettings("", new IndexSettings().setReplaceSynonymsInHighlight(false)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributesInMovies - void snippetForSetSettings52() throws Exception { - // >SEPARATOR setSettings searchableAttributesInMovies + // set_min_proximity + void snippetForSetSettings119() throws Exception { + // >SEPARATOR setSettings set_min_proximity // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings( - "", - new IndexSettings().setSearchableAttributes(Arrays.asList("title_eng", "title_fr", "title_es")) - ); + client.setSettings("", new IndexSettings().setMinProximity(1)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // disablePrefixOnAttributes - void snippetForSetSettings53() throws Exception { - // >SEPARATOR setSettings disablePrefixOnAttributes + // set_default_field + void snippetForSetSettings120() throws Exception { + // >SEPARATOR setSettings set_default_field // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("", new IndexSettings().setResponseFields(Arrays.asList("hits", "hitsPerPage", "nbPages", "page"))); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // disableTypoToleranceOnAttributes - void snippetForSetSettings54() throws Exception { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // set_max_facet_hits + void snippetForSetSettings121() throws Exception { + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("", new IndexSettings().setMaxFacetHits(10)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributesSimpleExample - void snippetForSetSettings55() throws Exception { - // >SEPARATOR setSettings searchableAttributesSimpleExample + // set_attribute_criteria_computed_by_min_proximity + void snippetForSetSettings122() throws Exception { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API - client.setSettings("", new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number"))); + client.setSettings("", new IndexSettings().setAttributeCriteriaComputedByMinProximity(true)); // >LOG // SEPARATOR< } // Snippet for the setSettings method. // - // searchableAttributesSimpleExampleAlt - void snippetForSetSettings56() throws Exception { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // set_user_data + void snippetForSetSettings123() throws Exception { + // >SEPARATOR setSettings set_user_data // Initialize the client SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); // Call the API client.setSettings( "", - new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number", "serial_number_suffixes")) + new IndexSettings() + .setUserData( + new HashMap() { + { + put("extraData", "This is the custom data that you want to store in your index"); + } + } + ) + ); + // >LOG + // SEPARATOR< + } + + // Snippet for the setSettings method. + // + // set_rendering_content + void snippetForSetSettings124() throws Exception { + // >SEPARATOR setSettings set_rendering_content + // Initialize the client + SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); + + // Call the API + client.setSettings( + "", + new IndexSettings() + .setRenderingContent( + new RenderingContent() + .setFacetOrdering( + new FacetOrdering() + .setFacets(new Facets().setOrder(Arrays.asList("size", "brand"))) + .setValues( + new HashMap() { + { + put( + "brand", + new Value() + .setOrder(Arrays.asList("uniqlo")) + .setHide(Arrays.asList("muji")) + .setSortRemainingBy(SortRemainingBy.COUNT) + ); + put("size", new Value().setOrder(Arrays.asList("S", "M", "L")).setSortRemainingBy(SortRemainingBy.HIDDEN)); + } + } + ) + ) + ) ); // >LOG // SEPARATOR< diff --git a/docs/snippets/javascript/src/search.ts b/docs/snippets/javascript/src/search.ts index 882c80ab2c..1caf005660 100644 --- a/docs/snippets/javascript/src/search.ts +++ b/docs/snippets/javascript/src/search.ts @@ -3796,8 +3796,92 @@ export async function snippetForSearchSingleIndex13(): Promise { // Snippet for the searchSingleIndex method. // -// facetFiltersNeg +// facetFiltersBook export async function snippetForSearchSingleIndex14(): Promise { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['category:Book'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersAND +export async function snippetForSearchSingleIndex15(): Promise { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['category:Book', 'author:John Doe'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersOR +export async function snippetForSearchSingleIndex16(): Promise { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: [['category:Book', 'author:John Doe']] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersCombined +export async function snippetForSearchSingleIndex17(): Promise { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['author:John Doe', ['category:Book', 'category:Movie']] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facetFiltersNeg +export async function snippetForSearchSingleIndex18(): Promise { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client // @@ -3818,7 +3902,7 @@ export async function snippetForSearchSingleIndex14(): Promise { // Snippet for the searchSingleIndex method. // // filtersAndFacetFilters -export async function snippetForSearchSingleIndex15(): Promise { +export async function snippetForSearchSingleIndex19(): Promise { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client // @@ -3839,7 +3923,7 @@ export async function snippetForSearchSingleIndex15(): Promise { // Snippet for the searchSingleIndex method. // // facet author genre -export async function snippetForSearchSingleIndex16(): Promise { +export async function snippetForSearchSingleIndex20(): Promise { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client // @@ -3860,7 +3944,7 @@ export async function snippetForSearchSingleIndex16(): Promise { // Snippet for the searchSingleIndex method. // // facet wildcard -export async function snippetForSearchSingleIndex17(): Promise { +export async function snippetForSearchSingleIndex21(): Promise { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client // @@ -3878,7 +3962,7 @@ export async function snippetForSearchSingleIndex17(): Promise { // Snippet for the searchSingleIndex method. // // maxValuesPerFacet -export async function snippetForSearchSingleIndex18(): Promise { +export async function snippetForSearchSingleIndex22(): Promise { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client // @@ -3899,7 +3983,7 @@ export async function snippetForSearchSingleIndex18(): Promise { // Snippet for the searchSingleIndex method. // // aroundLatLng -export async function snippetForSearchSingleIndex19(): Promise { +export async function snippetForSearchSingleIndex23(): Promise { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client // @@ -3920,7 +4004,7 @@ export async function snippetForSearchSingleIndex19(): Promise { // Snippet for the searchSingleIndex method. // // aroundLatLngViaIP -export async function snippetForSearchSingleIndex20(): Promise { +export async function snippetForSearchSingleIndex24(): Promise { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client // @@ -3941,7 +4025,7 @@ export async function snippetForSearchSingleIndex20(): Promise { // Snippet for the searchSingleIndex method. // // aroundRadius -export async function snippetForSearchSingleIndex21(): Promise { +export async function snippetForSearchSingleIndex25(): Promise { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client // @@ -3962,7 +4046,7 @@ export async function snippetForSearchSingleIndex21(): Promise { // Snippet for the searchSingleIndex method. // // insideBoundingBox -export async function snippetForSearchSingleIndex22(): Promise { +export async function snippetForSearchSingleIndex26(): Promise { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client // @@ -3983,7 +4067,7 @@ export async function snippetForSearchSingleIndex22(): Promise { // Snippet for the searchSingleIndex method. // // insidePolygon -export async function snippetForSearchSingleIndex23(): Promise { +export async function snippetForSearchSingleIndex27(): Promise { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client // @@ -4012,7 +4096,7 @@ export async function snippetForSearchSingleIndex23(): Promise { // Snippet for the searchSingleIndex method. // // insidePolygon -export async function snippetForSearchSingleIndex24(): Promise { +export async function snippetForSearchSingleIndex28(): Promise { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client // @@ -4041,7 +4125,7 @@ export async function snippetForSearchSingleIndex24(): Promise { // Snippet for the searchSingleIndex method. // // optionalFilters -export async function snippetForSearchSingleIndex25(): Promise { +export async function snippetForSearchSingleIndex29(): Promise { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client // @@ -4062,7 +4146,7 @@ export async function snippetForSearchSingleIndex25(): Promise { // Snippet for the searchSingleIndex method. // // optionalFiltersMany -export async function snippetForSearchSingleIndex26(): Promise { +export async function snippetForSearchSingleIndex30(): Promise { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client // @@ -4083,7 +4167,7 @@ export async function snippetForSearchSingleIndex26(): Promise { // Snippet for the searchSingleIndex method. // // optionalFiltersSimple -export async function snippetForSearchSingleIndex27(): Promise { +export async function snippetForSearchSingleIndex31(): Promise { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client // @@ -4104,7 +4188,7 @@ export async function snippetForSearchSingleIndex27(): Promise { // Snippet for the searchSingleIndex method. // // restrictSearchableAttributes -export async function snippetForSearchSingleIndex28(): Promise { +export async function snippetForSearchSingleIndex32(): Promise { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client // @@ -4125,7 +4209,7 @@ export async function snippetForSearchSingleIndex28(): Promise { // Snippet for the searchSingleIndex method. // // getRankingInfo -export async function snippetForSearchSingleIndex29(): Promise { +export async function snippetForSearchSingleIndex33(): Promise { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client // @@ -4143,7 +4227,7 @@ export async function snippetForSearchSingleIndex29(): Promise { // Snippet for the searchSingleIndex method. // // clickAnalytics -export async function snippetForSearchSingleIndex30(): Promise { +export async function snippetForSearchSingleIndex34(): Promise { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client // @@ -4161,7 +4245,7 @@ export async function snippetForSearchSingleIndex30(): Promise { // Snippet for the searchSingleIndex method. // // clickAnalyticsUserToken -export async function snippetForSearchSingleIndex31(): Promise { +export async function snippetForSearchSingleIndex35(): Promise { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client // @@ -4182,7 +4266,7 @@ export async function snippetForSearchSingleIndex31(): Promise { // Snippet for the searchSingleIndex method. // // enablePersonalization -export async function snippetForSearchSingleIndex32(): Promise { +export async function snippetForSearchSingleIndex36(): Promise { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client // @@ -4203,7 +4287,7 @@ export async function snippetForSearchSingleIndex32(): Promise { // Snippet for the searchSingleIndex method. // // userToken -export async function snippetForSearchSingleIndex33(): Promise { +export async function snippetForSearchSingleIndex37(): Promise { // >SEPARATOR searchSingleIndex userToken // Initialize the client // @@ -4218,10 +4302,31 @@ export async function snippetForSearchSingleIndex33(): Promise { // SEPARATOR< } +// Snippet for the searchSingleIndex method. +// +// userToken1234 +export async function snippetForSearchSingleIndex38(): Promise { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', userToken: 'user-1234' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + // Snippet for the searchSingleIndex method. // // analyticsTag -export async function snippetForSearchSingleIndex34(): Promise { +export async function snippetForSearchSingleIndex39(): Promise { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client // @@ -4242,7 +4347,7 @@ export async function snippetForSearchSingleIndex34(): Promise { // Snippet for the searchSingleIndex method. // // facetFiltersUsers -export async function snippetForSearchSingleIndex35(): Promise { +export async function snippetForSearchSingleIndex40(): Promise { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client // @@ -4263,7 +4368,7 @@ export async function snippetForSearchSingleIndex35(): Promise { // Snippet for the searchSingleIndex method. // // buildTheQuery -export async function snippetForSearchSingleIndex36(): Promise { +export async function snippetForSearchSingleIndex41(): Promise { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client // @@ -4281,17 +4386,20 @@ export async function snippetForSearchSingleIndex36(): Promise { // SEPARATOR< } -// Snippet for the searchSynonyms method. +// Snippet for the searchSingleIndex method. // -// searchSynonyms with minimal parameters -export async function snippetForSearchSynonyms(): Promise { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters +// attributesToHighlightOverride +export async function snippetForSearchSingleIndex42(): Promise { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.searchSynonyms({ indexName: 'indexName' }); + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToHighlight: ['title', 'content'] }, + }); // >LOG // use typed response @@ -4299,19 +4407,19 @@ export async function snippetForSearchSynonyms(): Promise { // SEPARATOR< } -// Snippet for the searchSynonyms method. +// Snippet for the searchSingleIndex method. // -// searchSynonyms with all parameters -export async function snippetForSearchSynonyms1(): Promise { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters +// disableTypoToleranceOnAttributes +export async function snippetForSearchSingleIndex43(): Promise { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.searchSynonyms({ + const response = await client.searchSingleIndex({ indexName: 'indexName', - searchSynonymsParams: { query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }, + searchParams: { query: 'query', disableTypoToleranceOnAttributes: ['serial_number'] }, }); // >LOG @@ -4320,22 +4428,17 @@ export async function snippetForSearchSynonyms1(): Promise { // SEPARATOR< } -// Snippet for the searchUserIds method. +// Snippet for the searchSingleIndex method. // -// searchUserIds -export async function snippetForSearchUserIds(): Promise { - // >SEPARATOR searchUserIds default +// search_a_query +export async function snippetForSearchSingleIndex44(): Promise { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.searchUserIds({ - query: 'test', - clusterName: 'theClusterName', - page: 5, - hitsPerPage: 10, - }); + const response = await client.searchSingleIndex({ indexName: 'indexName', searchParams: { query: 'shirt' } }); // >LOG // use typed response @@ -4343,34 +4446,37 @@ export async function snippetForSearchUserIds(): Promise { // SEPARATOR< } -// Snippet for the setClientApiKey method. +// Snippet for the searchSingleIndex method. // -// switch API key -export function snippetForSetClientApiKey(): void { - // >SEPARATOR setClientApiKey default +// search_everything +export async function snippetForSearchSingleIndex45(): Promise { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - client.setClientApiKey({ apiKey: 'updated-api-key' }); + const response = await client.searchSingleIndex({ indexName: 'indexName', searchParams: { query: '' } }); // >LOG + // use typed response + console.log(response); // SEPARATOR< } -// Snippet for the setDictionarySettings method. +// Snippet for the searchSingleIndex method. // -// get setDictionarySettings results with minimal parameters -export async function snippetForSetDictionarySettings(): Promise { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters +// api_filtering_range_example +export async function snippetForSearchSingleIndex46(): Promise { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setDictionarySettings({ - disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'books', filters: 'price:10 TO 20' }, }); // >LOG @@ -4379,21 +4485,22 @@ export async function snippetForSetDictionarySettings(): Promise { // SEPARATOR< } -// Snippet for the setDictionarySettings method. +// Snippet for the searchSingleIndex method. // -// get setDictionarySettings results with all parameters -export async function snippetForSetDictionarySettings1(): Promise { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters +// search_a_query +export async function snippetForSearchSingleIndex47(): Promise { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setDictionarySettings({ - disableStandardEntries: { - plurals: { fr: false, en: false, ru: true }, - stopwords: { fr: false }, - compounds: { ru: true }, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: '', + similarQuery: 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen', + filters: 'year:1991 TO 2001', }, }); @@ -4403,20 +4510,19 @@ export async function snippetForSetDictionarySettings1(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// minimal parameters -export async function snippetForSetSettings(): Promise { - // >SEPARATOR setSettings minimal parameters +// override_retrievable_attributes +export async function snippetForSearchSingleIndex48(): Promise { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'cts_e2e_settings', - indexSettings: { paginationLimitedTo: 10 }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToRetrieve: ['title', 'content'] }, }); // >LOG @@ -4425,20 +4531,19 @@ export async function snippetForSetSettings(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// boolean typoTolerance -export async function snippetForSetSettings1(): Promise { - // >SEPARATOR setSettings boolean typoTolerance +// restrict_searchable_attributes +export async function snippetForSearchSingleIndex49(): Promise { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { typoTolerance: true }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', restrictSearchableAttributes: ['title', 'author'] }, }); // >LOG @@ -4447,20 +4552,19 @@ export async function snippetForSetSettings1(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// enum typoTolerance -export async function snippetForSetSettings2(): Promise { - // >SEPARATOR setSettings enum typoTolerance +// override_default_relevancy +export async function snippetForSearchSingleIndex50(): Promise { + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { typoTolerance: 'min' }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', relevancyStrictness: 70 }, }); // >LOG @@ -4469,20 +4573,19 @@ export async function snippetForSetSettings2(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// ignorePlurals -export async function snippetForSetSettings3(): Promise { - // >SEPARATOR setSettings ignorePlurals +// apply_filters +export async function snippetForSearchSingleIndex51(): Promise { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { ignorePlurals: true }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: '(category:Book OR category:Ebook) AND _tags:published' }, }); // >LOG @@ -4491,20 +4594,23 @@ export async function snippetForSetSettings3(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// list of string ignorePlurals -export async function snippetForSetSettings4(): Promise { - // >SEPARATOR setSettings list of string ignorePlurals +// apply_all_filters +export async function snippetForSearchSingleIndex52(): Promise { + // >SEPARATOR searchSingleIndex apply_all_filters // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { ignorePlurals: ['fr'] }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + 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"', + }, }); // >LOG @@ -4513,20 +4619,3102 @@ export async function snippetForSetSettings4(): Promise { // SEPARATOR< } -// Snippet for the setSettings method. +// Snippet for the searchSingleIndex method. // -// removeStopWords boolean -export async function snippetForSetSettings5(): Promise { - // >SEPARATOR setSettings removeStopWords boolean +// escape_spaces +export async function snippetForSearchSingleIndex53(): Promise { + // >SEPARATOR searchSingleIndex escape_spaces // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { removeStopWords: true }, - forwardToReplicas: true, + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'category:"Books and Comics"' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// escape_keywords +export async function snippetForSearchSingleIndex54(): Promise { + // >SEPARATOR searchSingleIndex escape_keywords + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'keyword:"OR"' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// escape_single_quotes +export async function snippetForSearchSingleIndex55(): Promise { + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'content:"It\'s a wonderful day"' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// escape_double_quotes +export async function snippetForSearchSingleIndex56(): Promise { + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'content:"She said "Hello World"' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// apply_filters +export async function snippetForSearchSingleIndex57(): Promise { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalFilters: ['category:Book', 'author:John Doe'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// apply_negative_filters +export async function snippetForSearchSingleIndex58(): Promise { + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalFilters: ['category:Book', 'author:-John Doe'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// apply_numeric_filters +export async function snippetForSearchSingleIndex59(): Promise { + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', numericFilters: ['price < 1000', ['inStock = 1', 'deliveryDate < 1441755506']] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// apply_tag_filters +export async function snippetForSearchSingleIndex60(): Promise { + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', tagFilters: ['SciFi', ['Book', 'Movie']] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// apply_filters +export async function snippetForSearchSingleIndex61(): Promise { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', sumOrFiltersScores: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// facets_all +export async function snippetForSearchSingleIndex62(): Promise { + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facets: ['*'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// retrieve_only_some_facets +export async function snippetForSearchSingleIndex63(): Promise { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facets: ['category', 'author'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_max_values_per_facet +export async function snippetForSearchSingleIndex64(): Promise { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', maxValuesPerFacet: 20 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_faceting_after_distinct +export async function snippetForSearchSingleIndex65(): Promise { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetingAfterDistinct: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// sort_facet_values_alphabetically +export async function snippetForSearchSingleIndex66(): Promise { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', sortFacetValuesBy: 'count' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_attributes_to_snippet +export async function snippetForSearchSingleIndex67(): Promise { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToSnippet: ['title', 'content:80'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_highlight_pre_tag +export async function snippetForSearchSingleIndex68(): Promise { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', highlightPreTag: '' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_highlight_post_tag +export async function snippetForSearchSingleIndex69(): Promise { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', highlightPostTag: '' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_snippet_ellipsis_text +export async function snippetForSearchSingleIndex70(): Promise { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', snippetEllipsisText: '' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_restrict_highlight_and_snippet_arrays +export async function snippetForSearchSingleIndex71(): Promise { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', restrictHighlightAndSnippetArrays: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// access_page +export async function snippetForSearchSingleIndex72(): Promise { + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', page: 0 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_hits_per_page +export async function snippetForSearchSingleIndex73(): Promise { + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', hitsPerPage: 10 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// get_nth_hit +export async function snippetForSearchSingleIndex74(): Promise { + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', offset: 4 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// get_n_results +export async function snippetForSearchSingleIndex75(): Promise { + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', length: 4 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_min_word_size_for_one_typo +export async function snippetForSearchSingleIndex76(): Promise { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minWordSizefor1Typo: 2 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_min_word_size_for_two_typos +export async function snippetForSearchSingleIndex77(): Promise { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minWordSizefor2Typos: 2 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_typo_tolerance_mode +export async function snippetForSearchSingleIndex78(): Promise { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', typoTolerance: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_typos_on_numeric_tokens_at_search_time +export async function snippetForSearchSingleIndex79(): Promise { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', allowTyposOnNumericTokens: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_around_a_position +export async function snippetForSearchSingleIndex80(): Promise { + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundLatLng: '40.71, -74.01' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_around_server_ip +export async function snippetForSearchSingleIndex81(): Promise { + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex( + { indexName: 'indexName', searchParams: { 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', + }, + }, + ); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_around_radius +export async function snippetForSearchSingleIndex82(): Promise { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundRadius: 1000 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_automatic_radius +export async function snippetForSearchSingleIndex83(): Promise { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundRadius: 'all' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_geo_search_precision +export async function snippetForSearchSingleIndex84(): Promise { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundPrecision: 100 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_geo_search_precision_non_linear +export async function snippetForSearchSingleIndex85(): Promise { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + aroundPrecision: [ + { from: 0, value: 25 }, + { from: 2000, value: 1000 }, + ], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_minimum_geo_search_radius +export async function snippetForSearchSingleIndex86(): Promise { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minimumAroundRadius: 1000 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_rectangular_area +export async function snippetForSearchSingleIndex87(): Promise { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insideBoundingBox: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_multiple_rectangular_areas +export async function snippetForSearchSingleIndex88(): Promise { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insideBoundingBox: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875], + ], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_polygon_area +export async function snippetForSearchSingleIndex89(): Promise { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insidePolygon: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625], + ], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// search_inside_multiple_polygon_areas +export async function snippetForSearchSingleIndex90(): Promise { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + 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, + ], + ], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +export async function snippetForSearchSingleIndex91(): Promise { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', ignorePlurals: ['ca', 'es'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +export async function snippetForSearchSingleIndex92(): Promise { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeStopWords: ['ca', 'es'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_override +export async function snippetForSearchSingleIndex93(): Promise { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeStopWords: ['ca', 'es'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_querylanguages_with_japanese_query +export async function snippetForSearchSingleIndex94(): Promise { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', queryLanguages: ['ja', 'en'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_natural_languages +export async function snippetForSearchSingleIndex95(): Promise { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: '', naturalLanguages: ['fr'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_natural_languages_with_query +export async function snippetForSearchSingleIndex96(): Promise { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: '', naturalLanguages: ['fr'], removeWordsIfNoResults: 'firstWords' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_decompound_query_search_time +export async function snippetForSearchSingleIndex97(): Promise { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', decompoundQuery: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_rules_search_time +export async function snippetForSearchSingleIndex98(): Promise { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableRules: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_rule_contexts +export async function snippetForSearchSingleIndex99(): Promise { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', ruleContexts: ['front_end', 'website2'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_personalization +export async function snippetForSearchSingleIndex100(): Promise { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_personalization_with_user_token +export async function snippetForSearchSingleIndex101(): Promise { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// personalization_impact +export async function snippetForSearchSingleIndex102(): Promise { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', personalizationImpact: 20 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_user_token +export async function snippetForSearchSingleIndex103(): Promise { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', userToken: '123456' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_user_token_with_personalization +export async function snippetForSearchSingleIndex104(): Promise { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_query_type +export async function snippetForSearchSingleIndex105(): Promise { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', queryType: 'prefixAll' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_remove_words_if_no_results +export async function snippetForSearchSingleIndex106(): Promise { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeWordsIfNoResults: 'lastWords' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_search_time +export async function snippetForSearchSingleIndex107(): Promise { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// overide_default_optional_words +export async function snippetForSearchSingleIndex108(): Promise { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalWords: ['toyota', '2020 2021'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disabling_exact_for_some_attributes_search_time +export async function snippetForSearchSingleIndex109(): Promise { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', disableExactOnAttributes: ['description'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_exact_single_word_query +export async function snippetForSearchSingleIndex110(): Promise { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', exactOnSingleWordQuery: 'none' }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_aternative_as_exact +export async function snippetForSearchSingleIndex111(): Promise { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', alternativesAsExact: ['multiWordsSynonym'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_exact_phrase +export async function snippetForSearchSingleIndex112(): Promise { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['exactPhrase'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_advanced_syntax_exclude_words +export async function snippetForSearchSingleIndex113(): Promise { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['excludeWords'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_distinct +export async function snippetForSearchSingleIndex114(): Promise { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', distinct: 0 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// get_ranking_info +export async function snippetForSearchSingleIndex115(): Promise { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', getRankingInfo: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_click_analytics +export async function snippetForSearchSingleIndex116(): Promise { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', clickAnalytics: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// enable_click_analytics +export async function snippetForSearchSingleIndex117(): Promise { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', clickAnalytics: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_analytics +export async function snippetForSearchSingleIndex118(): Promise { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', analytics: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// add_analytics_tags +export async function snippetForSearchSingleIndex119(): Promise { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', analyticsTags: ['front_end', 'website2'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// disable_synonyms +export async function snippetForSearchSingleIndex120(): Promise { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', synonyms: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_replace_synonyms_in_highlights +export async function snippetForSearchSingleIndex121(): Promise { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', replaceSynonymsInHighlight: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_min_proximity +export async function snippetForSearchSingleIndex122(): Promise { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minProximity: 2 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_default_field +export async function snippetForSearchSingleIndex123(): Promise { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', responseFields: ['hits', 'facets'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// override_percentile_computation +export async function snippetForSearchSingleIndex124(): Promise { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', percentileComputation: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_ab_test +export async function snippetForSearchSingleIndex125(): Promise { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableABTest: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSingleIndex method. +// +// set_enable_re_ranking +export async function snippetForSearchSingleIndex126(): Promise { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableReRanking: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSynonyms method. +// +// searchSynonyms with minimal parameters +export async function snippetForSearchSynonyms(): Promise { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSynonyms({ indexName: 'indexName' }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchSynonyms method. +// +// searchSynonyms with all parameters +export async function snippetForSearchSynonyms1(): Promise { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchSynonyms({ + indexName: 'indexName', + searchSynonymsParams: { query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the searchUserIds method. +// +// searchUserIds +export async function snippetForSearchUserIds(): Promise { + // >SEPARATOR searchUserIds default + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.searchUserIds({ + query: 'test', + clusterName: 'theClusterName', + page: 5, + hitsPerPage: 10, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setClientApiKey method. +// +// switch API key +export function snippetForSetClientApiKey(): void { + // >SEPARATOR setClientApiKey default + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + client.setClientApiKey({ apiKey: 'updated-api-key' }); + + // >LOG + // SEPARATOR< +} + +// Snippet for the setDictionarySettings method. +// +// get setDictionarySettings results with minimal parameters +export async function snippetForSetDictionarySettings(): Promise { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setDictionarySettings({ + disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setDictionarySettings method. +// +// get setDictionarySettings results with all parameters +export async function snippetForSetDictionarySettings1(): Promise { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setDictionarySettings({ + disableStandardEntries: { + plurals: { fr: false, en: false, ru: true }, + stopwords: { fr: false }, + compounds: { ru: true }, + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// minimal parameters +export async function snippetForSetSettings(): Promise { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'cts_e2e_settings', + indexSettings: { paginationLimitedTo: 10 }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// boolean typoTolerance +export async function snippetForSetSettings1(): Promise { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { typoTolerance: true }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// enum typoTolerance +export async function snippetForSetSettings2(): Promise { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { typoTolerance: 'min' }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ignorePlurals +export async function snippetForSetSettings3(): Promise { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ignorePlurals: true }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// list of string ignorePlurals +export async function snippetForSetSettings4(): Promise { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ignorePlurals: ['fr'] }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// removeStopWords boolean +export async function snippetForSetSettings5(): Promise { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { removeStopWords: true }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// removeStopWords list of string +export async function snippetForSetSettings6(): Promise { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { removeStopWords: ['fr'] }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// boolean distinct +export async function snippetForSetSettings7(): Promise { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { distinct: true }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// integer distinct +export async function snippetForSetSettings8(): Promise { + // >SEPARATOR setSettings integer distinct + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { distinct: 1 }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct company +export async function snippetForSetSettings9(): Promise { + // >SEPARATOR setSettings distinct company + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'company', distinct: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct design +export async function snippetForSetSettings10(): Promise { + // >SEPARATOR setSettings distinct design + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'design', distinct: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct true +export async function snippetForSetSettings11(): Promise { + // >SEPARATOR setSettings distinct true + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { distinct: true } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// distinct section +export async function snippetForSetSettings12(): Promise { + // >SEPARATOR setSettings distinct section + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'section', distinct: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting allergens +export async function snippetForSetSettings13(): Promise { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['allergens'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_faceting +export async function snippetForSetSettings14(): Promise { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['genre', 'author'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_faceting_searchable +export async function snippetForSetSettings15(): Promise { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['genre', 'searchable(author)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// api_attributes_for_filter_only +export async function snippetForSetSettings16(): Promise { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(genre)', 'author'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting categoryPageId +export async function snippetForSetSettings17(): Promise { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['searchable(categoryPageId)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// unretrievableAttributes +export async function snippetForSetSettings18(): Promise { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { unretrievableAttributes: ['visible_by'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting user restricted data +export async function snippetForSetSettings19(): Promise { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(visible_by)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting optional filters +export async function snippetForSetSettings20(): Promise { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting redirect index +export async function snippetForSetSettings21(): Promise { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['query_terms'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting multiple consequences +export async function snippetForSetSettings22(): Promise { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['director'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting in-depth optional filters +export async function snippetForSetSettings23(): Promise { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(brand)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// mode neuralSearch +export async function snippetForSetSettings24(): Promise { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'neuralSearch' } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// mode keywordSearch +export async function snippetForSetSettings25(): Promise { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'keywordSearch' } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes same priority +export async function snippetForSetSettings26(): Promise { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['title,comments', 'ingredients'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes higher priority +export async function snippetForSetSettings27(): Promise { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['title', 'ingredients'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking retweets +export async function snippetForSetSettings28(): Promise { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(retweets)', 'desc(likes)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking boosted +export async function snippetForSetSettings29(): Promise { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(boosted)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking pageviews +export async function snippetForSetSettings30(): Promise { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(pageviews)', 'desc(comments)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking applying search parameters for a specific query +export async function snippetForSetSettings31(): Promise { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(nb_airline_liaisons)'], attributesForFaceting: ['city, country'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking rounded pageviews +export async function snippetForSetSettings32(): Promise { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking price +export async function snippetForSetSettings33(): Promise { + // >SEPARATOR setSettings customRanking price + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(price)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking exhaustive +export async function snippetForSetSettings34(): Promise { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking standard replica +export async function snippetForSetSettings35(): Promise { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ranking: ['desc(post_date_timestamp)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking virtual replica +export async function snippetForSetSettings36(): Promise { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(post_date_timestamp)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// customRanking and ranking sort alphabetically +export async function snippetForSetSettings37(): Promise { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + customRanking: ['asc(textual_attribute)'], + ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// relevancyStrictness +export async function snippetForSetSettings38(): Promise { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create replica index +export async function snippetForSetSettings39(): Promise { + // >SEPARATOR setSettings create replica index + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['products_price_desc'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create replica index articles +export async function snippetForSetSettings40(): Promise { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['articles_date_desc'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// create virtual replica index +export async function snippetForSetSettings41(): Promise { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['virtual(products_price_desc)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// unlink replica index +export async function snippetForSetSettings42(): Promise { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { replicas: [''] } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// forwardToReplicas +export async function snippetForSetSettings43(): Promise { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['name', 'description'] }, + forwardToReplicas: true, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// maxValuesPerFacet +export async function snippetForSetSettings44(): Promise { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxValuesPerFacet: 1000 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// maxFacetHits +export async function snippetForSetSettings45(): Promise { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxFacetHits: 1000 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesForFaceting complex +export async function snippetForSetSettings46(): Promise { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// ranking closest dates +export async function snippetForSetSettings47(): Promise { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + ranking: ['asc(date_timestamp)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes item variation +export async function snippetForSetSettings48(): Promise { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['design', 'type', 'color'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributes around location +export async function snippetForSetSettings49(): Promise { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['name', 'country', 'code', 'iata_code'], + customRanking: ['desc(links_count)'], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesToHighlight +export async function snippetForSetSettings50(): Promise { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributesToHighlight: ['author', 'title', 'content'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// attributesToHighlightStar +export async function snippetForSetSettings51(): Promise { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributesToHighlight: ['*'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// everything +export async function snippetForSetSettings52(): Promise { + // >SEPARATOR setSettings everything + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + advancedSyntax: true, + advancedSyntaxFeatures: ['exactPhrase'], + allowCompressionOfIntegerArray: true, + allowTyposOnNumericTokens: true, + alternativesAsExact: ['singleWordSynonym'], + attributeCriteriaComputedByMinProximity: true, + attributeForDistinct: 'test', + attributesForFaceting: ['algolia'], + attributesToHighlight: ['algolia'], + attributesToRetrieve: ['algolia'], + attributesToSnippet: ['algolia'], + attributesToTransliterate: ['algolia'], + camelCaseAttributes: ['algolia'], + customNormalization: { algolia: { aloglia: 'aglolia' } }, + customRanking: ['algolia'], + decompoundQuery: false, + decompoundedAttributes: { algolia: 'aloglia' }, + disableExactOnAttributes: ['algolia'], + disablePrefixOnAttributes: ['algolia'], + disableTypoToleranceOnAttributes: ['algolia'], + disableTypoToleranceOnWords: ['algolia'], + distinct: 3, + enablePersonalization: true, + enableReRanking: false, + enableRules: true, + exactOnSingleWordQuery: 'attribute', + highlightPreTag: '', + highlightPostTag: '', + hitsPerPage: 10, + ignorePlurals: false, + indexLanguages: ['fr'], + keepDiacriticsOnCharacters: 'abc', + maxFacetHits: 20, + maxValuesPerFacet: 30, + minProximity: 6, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + mode: 'neuralSearch', + numericAttributesForFiltering: ['algolia'], + optionalWords: ['myspace'], + paginationLimitedTo: 0, + queryLanguages: ['fr'], + queryType: 'prefixLast', + ranking: ['geo'], + reRankingApplyFilter: 'mySearch:filters', + relevancyStrictness: 10, + removeStopWords: false, + removeWordsIfNoResults: 'lastWords', + renderingContent: { + facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, + }, + replaceSynonymsInHighlight: true, + replicas: [''], + responseFields: ['algolia'], + restrictHighlightAndSnippetArrays: true, + searchableAttributes: ['foo'], + semanticSearch: { eventSources: ['foo'] }, + separatorsToIndex: 'bar', + snippetEllipsisText: '---', + sortFacetValuesBy: 'date', + typoTolerance: false, + unretrievableAttributes: ['foo'], + userData: { user: 'data' }, + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesWithCustomRankingsAndAttributesForFaceting +export async function snippetForSetSettings53(): Promise { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], + customRanking: ['desc(popularity)'], + attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], + }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesOrdering +export async function snippetForSetSettings54(): Promise { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['unordered(title)', 'cast'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesProductReferenceSuffixes +export async function snippetForSetSettings55(): Promise { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// queryLanguageAndIgnorePlurals +export async function snippetForSetSettings56(): Promise { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { queryLanguages: ['en'], ignorePlurals: true }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesInMovies +export async function snippetForSetSettings57(): Promise { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'movies', + indexSettings: { searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disablePrefixOnAttributes +export async function snippetForSetSettings58(): Promise { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disablePrefixOnAttributes: ['serial_number'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disableTypoToleranceOnAttributes +export async function snippetForSetSettings59(): Promise { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesSimpleExample +export async function snippetForSetSettings60(): Promise { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['serial_number'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// searchableAttributesSimpleExampleAlt +export async function snippetForSetSettings61(): Promise { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_searchable_attributes +export async function snippetForSetSettings62(): Promise { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['title,alternative_title', 'author', 'unordered(text)', 'emails.personal'], + }, }); // >LOG @@ -4537,9 +7725,9 @@ export async function snippetForSetSettings5(): Promise { // Snippet for the setSettings method. // -// removeStopWords list of string -export async function snippetForSetSettings6(): Promise { - // >SEPARATOR setSettings removeStopWords list of string +// set_searchable_attributes +export async function snippetForSetSettings63(): Promise { + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4547,8 +7735,15 @@ export async function snippetForSetSettings6(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { removeStopWords: ['fr'] }, - forwardToReplicas: true, + indexSettings: { + attributesForFaceting: [ + 'author', + 'filterOnly(isbn)', + 'searchable(edition)', + 'afterDistinct(category)', + 'afterDistinct(searchable(publisher))', + ], + }, }); // >LOG @@ -4559,9 +7754,9 @@ export async function snippetForSetSettings6(): Promise { // Snippet for the setSettings method. // -// boolean distinct -export async function snippetForSetSettings7(): Promise { - // >SEPARATOR setSettings boolean distinct +// unretrievable_attributes +export async function snippetForSetSettings64(): Promise { + // >SEPARATOR setSettings unretrievable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4569,8 +7764,7 @@ export async function snippetForSetSettings7(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { distinct: true }, - forwardToReplicas: true, + indexSettings: { unretrievableAttributes: ['total_number_of_sales'] }, }); // >LOG @@ -4581,9 +7775,9 @@ export async function snippetForSetSettings7(): Promise { // Snippet for the setSettings method. // -// integer distinct -export async function snippetForSetSettings8(): Promise { - // >SEPARATOR setSettings integer distinct +// set_retrievable_attributes +export async function snippetForSetSettings65(): Promise { + // >SEPARATOR setSettings set_retrievable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4591,8 +7785,7 @@ export async function snippetForSetSettings8(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { distinct: 1 }, - forwardToReplicas: true, + indexSettings: { attributesToRetrieve: ['author', 'title', 'content'] }, }); // >LOG @@ -4603,9 +7796,9 @@ export async function snippetForSetSettings8(): Promise { // Snippet for the setSettings method. // -// distinct company -export async function snippetForSetSettings9(): Promise { - // >SEPARATOR setSettings distinct company +// set_all_attributes_as_retrievable +export async function snippetForSetSettings66(): Promise { + // >SEPARATOR setSettings set_all_attributes_as_retrievable // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4613,7 +7806,7 @@ export async function snippetForSetSettings9(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'company', distinct: true }, + indexSettings: { attributesToRetrieve: ['*'] }, }); // >LOG @@ -4624,9 +7817,9 @@ export async function snippetForSetSettings9(): Promise { // Snippet for the setSettings method. // -// distinct design -export async function snippetForSetSettings10(): Promise { - // >SEPARATOR setSettings distinct design +// specify_attributes_not_to_retrieve +export async function snippetForSetSettings67(): Promise { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4634,7 +7827,7 @@ export async function snippetForSetSettings10(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'design', distinct: true }, + indexSettings: { attributesToRetrieve: ['*', '-SKU', '-internal_desc'] }, }); // >LOG @@ -4645,15 +7838,15 @@ export async function snippetForSetSettings10(): Promise { // Snippet for the setSettings method. // -// distinct true -export async function snippetForSetSettings11(): Promise { - // >SEPARATOR setSettings distinct true +// neural_search +export async function snippetForSetSettings68(): Promise { + // >SEPARATOR setSettings neural_search // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { distinct: true } }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'neuralSearch' } }); // >LOG // use typed response @@ -4663,9 +7856,27 @@ export async function snippetForSetSettings11(): Promise { // Snippet for the setSettings method. // -// distinct section -export async function snippetForSetSettings12(): Promise { - // >SEPARATOR setSettings distinct section +// keyword_search +export async function snippetForSetSettings69(): Promise { + // >SEPARATOR setSettings keyword_search + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'keywordSearch' } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_ranking +export async function snippetForSetSettings70(): Promise { + // >SEPARATOR setSettings set_default_ranking // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4673,7 +7884,7 @@ export async function snippetForSetSettings12(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'section', distinct: true }, + indexSettings: { ranking: ['typo', 'geo', 'words', 'filters', 'attribute', 'proximity', 'exact', 'custom'] }, }); // >LOG @@ -4684,17 +7895,19 @@ export async function snippetForSetSettings12(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting allergens -export async function snippetForSetSettings13(): Promise { - // >SEPARATOR setSettings attributesForFaceting allergens +// set_ranking_by_attribute_asc +export async function snippetForSetSettings71(): Promise { + // >SEPARATOR setSettings set_ranking_by_attribute_asc // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['allergens'] }, + indexName: 'theIndexName', + indexSettings: { + ranking: ['asc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, }); // >LOG @@ -4705,17 +7918,19 @@ export async function snippetForSetSettings13(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting categoryPageId -export async function snippetForSetSettings14(): Promise { - // >SEPARATOR setSettings attributesForFaceting categoryPageId +// set_ranking_by_attribute_desc +export async function snippetForSetSettings72(): Promise { + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['searchable(categoryPageId)'] }, + indexName: 'theIndexName', + indexSettings: { + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, }); // >LOG @@ -4726,17 +7941,17 @@ export async function snippetForSetSettings14(): Promise { // Snippet for the setSettings method. // -// unretrievableAttributes -export async function snippetForSetSettings15(): Promise { - // >SEPARATOR setSettings unretrievableAttributes +// restrict_searchable_attributes +export async function snippetForSetSettings73(): Promise { + // >SEPARATOR setSettings restrict_searchable_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { unretrievableAttributes: ['visible_by'] }, + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(popularity)', 'asc(price)'] }, }); // >LOG @@ -4747,17 +7962,35 @@ export async function snippetForSetSettings15(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting user restricted data -export async function snippetForSetSettings16(): Promise { - // >SEPARATOR setSettings attributesForFaceting user restricted data +// set_default_relevancy +export async function snippetForSetSettings74(): Promise { + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { relevancyStrictness: 90 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_replicas +export async function snippetForSetSettings75(): Promise { + // >SEPARATOR setSettings set_replicas // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['filterOnly(visible_by)'] }, + indexName: 'theIndexName', + indexSettings: { replicas: ['name_of_replica_index1', 'name_of_replica_index2'] }, }); // >LOG @@ -4768,17 +8001,35 @@ export async function snippetForSetSettings16(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting optional filters -export async function snippetForSetSettings17(): Promise { - // >SEPARATOR setSettings attributesForFaceting optional filters +// set_default_max_values_per_facet +export async function snippetForSetSettings76(): Promise { + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxValuesPerFacet: 100 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_sort_facet_values_by +export async function snippetForSetSettings77(): Promise { + // >SEPARATOR setSettings set_default_sort_facet_values_by // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }, + indexName: 'theIndexName', + indexSettings: { sortFacetValuesBy: 'alpha' }, }); // >LOG @@ -4789,17 +8040,17 @@ export async function snippetForSetSettings17(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting redirect index -export async function snippetForSetSettings18(): Promise { - // >SEPARATOR setSettings attributesForFaceting redirect index +// set_attributes_to_snippet +export async function snippetForSetSettings78(): Promise { + // >SEPARATOR setSettings set_attributes_to_snippet // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['query_terms'] }, + indexName: 'theIndexName', + indexSettings: { attributesToSnippet: ['content:80', 'description'] }, }); // >LOG @@ -4810,17 +8061,17 @@ export async function snippetForSetSettings18(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting multiple consequences -export async function snippetForSetSettings19(): Promise { - // >SEPARATOR setSettings attributesForFaceting multiple consequences +// set_all_attributes_to_snippet +export async function snippetForSetSettings79(): Promise { + // >SEPARATOR setSettings set_all_attributes_to_snippet // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['director'] }, + indexName: 'theIndexName', + indexSettings: { attributesToSnippet: ['*:80'] }, }); // >LOG @@ -4831,17 +8082,35 @@ export async function snippetForSetSettings19(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting in-depth optional filters -export async function snippetForSetSettings20(): Promise { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters +// set_default_highlight_pre_tag +export async function snippetForSetSettings80(): Promise { + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { highlightPreTag: '' } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_highlight_post_tag +export async function snippetForSetSettings81(): Promise { + // >SEPARATOR setSettings set_default_highlight_post_tag // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['filterOnly(brand)'] }, + indexName: 'theIndexName', + indexSettings: { highlightPostTag: '' }, }); // >LOG @@ -4852,15 +8121,15 @@ export async function snippetForSetSettings20(): Promise { // Snippet for the setSettings method. // -// mode neuralSearch -export async function snippetForSetSettings21(): Promise { - // >SEPARATOR setSettings mode neuralSearch +// set_default_snippet_ellipsis_text +export async function snippetForSetSettings82(): Promise { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'neuralSearch' } }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { snippetEllipsisText: '…' } }); // >LOG // use typed response @@ -4870,15 +8139,18 @@ export async function snippetForSetSettings21(): Promise { // Snippet for the setSettings method. // -// mode keywordSearch -export async function snippetForSetSettings22(): Promise { - // >SEPARATOR setSettings mode keywordSearch +// enable_restrict_highlight_and_snippet_arrays_by_default +export async function snippetForSetSettings83(): Promise { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { mode: 'keywordSearch' } }); + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { restrictHighlightAndSnippetArrays: true }, + }); // >LOG // use typed response @@ -4888,9 +8160,27 @@ export async function snippetForSetSettings22(): Promise { // Snippet for the setSettings method. // -// searchableAttributes same priority -export async function snippetForSetSettings23(): Promise { - // >SEPARATOR setSettings searchableAttributes same priority +// set_default_hits_per_page +export async function snippetForSetSettings84(): Promise { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { hitsPerPage: 20 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_pagination_limit +export async function snippetForSetSettings85(): Promise { + // >SEPARATOR setSettings set_pagination_limit // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4898,7 +8188,7 @@ export async function snippetForSetSettings23(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['title,comments', 'ingredients'] }, + indexSettings: { paginationLimitedTo: 1000 }, }); // >LOG @@ -4909,18 +8199,111 @@ export async function snippetForSetSettings23(): Promise { // Snippet for the setSettings method. // -// searchableAttributes higher priority -export async function snippetForSetSettings24(): Promise { - // >SEPARATOR setSettings searchableAttributes higher priority +// set_default_min_word_size_for_one_typo +export async function snippetForSetSettings86(): Promise { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minWordSizefor1Typo: 4 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_min_word_size_for_two_typos +export async function snippetForSetSettings87(): Promise { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minWordSizefor2Typos: 4 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_default_typo_tolerance_mode +export async function snippetForSetSettings88(): Promise { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { typoTolerance: true } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disable_typos_on_numeric_tokens_by_default +export async function snippetForSetSettings89(): Promise { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { allowTyposOnNumericTokens: false }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// disable_typo_tolerance_for_words +export async function snippetForSetSettings90(): Promise { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disableTypoToleranceOnWords: ['wheel', '1X2BCD'] }, + }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_separators_to_index +export async function snippetForSetSettings91(): Promise { + // >SEPARATOR setSettings set_separators_to_index // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['title', 'ingredients'] }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { separatorsToIndex: '+#' } }); // >LOG // use typed response @@ -4930,9 +8313,9 @@ export async function snippetForSetSettings24(): Promise { // Snippet for the setSettings method. // -// customRanking retweets -export async function snippetForSetSettings25(): Promise { - // >SEPARATOR setSettings customRanking retweets +// set_languages_using_querylanguages +export async function snippetForSetSettings92(): Promise { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4940,7 +8323,7 @@ export async function snippetForSetSettings25(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(retweets)', 'desc(likes)'] }, + indexSettings: { queryLanguages: ['es'], ignorePlurals: true }, }); // >LOG @@ -4951,9 +8334,9 @@ export async function snippetForSetSettings25(): Promise { // Snippet for the setSettings method. // -// customRanking boosted -export async function snippetForSetSettings26(): Promise { - // >SEPARATOR setSettings customRanking boosted +// set_attributes_to_transliterate +export async function snippetForSetSettings93(): Promise { + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4961,7 +8344,7 @@ export async function snippetForSetSettings26(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(boosted)'] }, + indexSettings: { indexLanguages: ['ja'], attributesToTransliterate: ['name', 'description'] }, }); // >LOG @@ -4972,9 +8355,9 @@ export async function snippetForSetSettings26(): Promise { // Snippet for the setSettings method. // -// customRanking pageviews -export async function snippetForSetSettings27(): Promise { - // >SEPARATOR setSettings customRanking pageviews +// set_languages_using_querylanguages +export async function snippetForSetSettings94(): Promise { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -4982,7 +8365,7 @@ export async function snippetForSetSettings27(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(pageviews)', 'desc(comments)'] }, + indexSettings: { queryLanguages: ['es'], removeStopWords: true }, }); // >LOG @@ -4993,9 +8376,9 @@ export async function snippetForSetSettings27(): Promise { // Snippet for the setSettings method. // -// customRanking applying search parameters for a specific query -export async function snippetForSetSettings28(): Promise { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query +// set_camel_case_attributes +export async function snippetForSetSettings95(): Promise { + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5003,7 +8386,7 @@ export async function snippetForSetSettings28(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(nb_airline_liaisons)'], attributesForFaceting: ['city, country'] }, + indexSettings: { camelCaseAttributes: ['description'] }, }); // >LOG @@ -5014,9 +8397,9 @@ export async function snippetForSetSettings28(): Promise { // Snippet for the setSettings method. // -// customRanking rounded pageviews -export async function snippetForSetSettings29(): Promise { - // >SEPARATOR setSettings customRanking rounded pageviews +// set_decompounded_attributes +export async function snippetForSetSettings96(): Promise { + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5024,7 +8407,7 @@ export async function snippetForSetSettings29(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }, + indexSettings: { decompoundedAttributes: { de: ['name'] } }, }); // >LOG @@ -5035,9 +8418,9 @@ export async function snippetForSetSettings29(): Promise { // Snippet for the setSettings method. // -// customRanking price -export async function snippetForSetSettings30(): Promise { - // >SEPARATOR setSettings customRanking price +// set_decompounded_multiple_attributes +export async function snippetForSetSettings97(): Promise { + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5045,7 +8428,7 @@ export async function snippetForSetSettings30(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(price)'] }, + indexSettings: { decompoundedAttributes: { de: ['name_de', 'description_de'], fi: ['name_fi', 'description_fi'] } }, }); // >LOG @@ -5056,9 +8439,9 @@ export async function snippetForSetSettings30(): Promise { // Snippet for the setSettings method. // -// ranking exhaustive -export async function snippetForSetSettings31(): Promise { - // >SEPARATOR setSettings ranking exhaustive +// set_keep_diacritics_on_characters +export async function snippetForSetSettings98(): Promise { + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5066,9 +8449,7 @@ export async function snippetForSetSettings31(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], - }, + indexSettings: { keepDiacriticsOnCharacters: 'øé' }, }); // >LOG @@ -5079,9 +8460,9 @@ export async function snippetForSetSettings31(): Promise { // Snippet for the setSettings method. // -// ranking standard replica -export async function snippetForSetSettings32(): Promise { - // >SEPARATOR setSettings ranking standard replica +// set_custom_normalization +export async function snippetForSetSettings99(): Promise { + // >SEPARATOR setSettings set_custom_normalization // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5089,7 +8470,7 @@ export async function snippetForSetSettings32(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { ranking: ['desc(post_date_timestamp)'] }, + indexSettings: { customNormalization: { default: { ä: 'ae' } } }, }); // >LOG @@ -5100,9 +8481,9 @@ export async function snippetForSetSettings32(): Promise { // Snippet for the setSettings method. // -// ranking virtual replica -export async function snippetForSetSettings33(): Promise { - // >SEPARATOR setSettings ranking virtual replica +// set_languages_using_querylanguages +export async function snippetForSetSettings100(): Promise { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5110,7 +8491,7 @@ export async function snippetForSetSettings33(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(post_date_timestamp)'] }, + indexSettings: { queryLanguages: ['es'], removeStopWords: true, ignorePlurals: true }, }); // >LOG @@ -5121,21 +8502,15 @@ export async function snippetForSetSettings33(): Promise { // Snippet for the setSettings method. // -// customRanking and ranking sort alphabetically -export async function snippetForSetSettings34(): Promise { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically +// set_indexlanguages +export async function snippetForSetSettings101(): Promise { + // >SEPARATOR setSettings set_indexlanguages // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { - customRanking: ['asc(textual_attribute)'], - ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], - }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { indexLanguages: ['ja'] } }); // >LOG // use typed response @@ -5145,18 +8520,15 @@ export async function snippetForSetSettings34(): Promise { // Snippet for the setSettings method. // -// relevancyStrictness -export async function snippetForSetSettings35(): Promise { - // >SEPARATOR setSettings relevancyStrictness +// enable_decompound_query_by_default +export async function snippetForSetSettings102(): Promise { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { decompoundQuery: true } }); // >LOG // use typed response @@ -5166,18 +8538,15 @@ export async function snippetForSetSettings35(): Promise { // Snippet for the setSettings method. // -// create replica index -export async function snippetForSetSettings36(): Promise { - // >SEPARATOR setSettings create replica index +// enable_rules_syntax_by_default +export async function snippetForSetSettings103(): Promise { + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { replicas: ['products_price_desc'] }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { enableRules: true } }); // >LOG // use typed response @@ -5187,9 +8556,9 @@ export async function snippetForSetSettings36(): Promise { // Snippet for the setSettings method. // -// create virtual replica index -export async function snippetForSetSettings37(): Promise { - // >SEPARATOR setSettings create virtual replica index +// enable_personalization_settings +export async function snippetForSetSettings104(): Promise { + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5197,7 +8566,7 @@ export async function snippetForSetSettings37(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { replicas: ['virtual(products_price_desc)'] }, + indexSettings: { enablePersonalization: true }, }); // >LOG @@ -5208,15 +8577,15 @@ export async function snippetForSetSettings37(): Promise { // Snippet for the setSettings method. // -// unlink replica index -export async function snippetForSetSettings38(): Promise { - // >SEPARATOR setSettings unlink replica index +// set_default_query_type +export async function snippetForSetSettings105(): Promise { + // >SEPARATOR setSettings set_default_query_type // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { replicas: [''] } }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { queryType: 'prefixLast' } }); // >LOG // use typed response @@ -5226,9 +8595,9 @@ export async function snippetForSetSettings38(): Promise { // Snippet for the setSettings method. // -// forwardToReplicas -export async function snippetForSetSettings39(): Promise { - // >SEPARATOR setSettings forwardToReplicas +// set_default_remove_words_if_no_result +export async function snippetForSetSettings106(): Promise { + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5236,8 +8605,7 @@ export async function snippetForSetSettings39(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['name', 'description'] }, - forwardToReplicas: true, + indexSettings: { removeWordsIfNoResults: 'none' }, }); // >LOG @@ -5248,15 +8616,15 @@ export async function snippetForSetSettings39(): Promise { // Snippet for the setSettings method. // -// maxValuesPerFacet -export async function snippetForSetSettings40(): Promise { - // >SEPARATOR setSettings maxValuesPerFacet +// enable_advanced_syntax_by_default +export async function snippetForSetSettings107(): Promise { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxValuesPerFacet: 1000 } }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { advancedSyntax: true } }); // >LOG // use typed response @@ -5266,15 +8634,18 @@ export async function snippetForSetSettings40(): Promise { // Snippet for the setSettings method. // -// maxFacetHits -export async function snippetForSetSettings41(): Promise { - // >SEPARATOR setSettings maxFacetHits +// set_default_optional_words +export async function snippetForSetSettings108(): Promise { + // >SEPARATOR setSettings set_default_optional_words // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxFacetHits: 1000 } }); + const response = await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { optionalWords: ['blue', 'iphone case'] }, + }); // >LOG // use typed response @@ -5284,17 +8655,17 @@ export async function snippetForSetSettings41(): Promise { // Snippet for the setSettings method. // -// attributesForFaceting complex -export async function snippetForSetSettings42(): Promise { - // >SEPARATOR setSettings attributesForFaceting complex +// disabling_prefix_search_for_some_attributes_by_default +export async function snippetForSetSettings109(): Promise { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API const response = await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }, + indexName: 'theIndexName', + indexSettings: { disablePrefixOnAttributes: ['sku'] }, }); // >LOG @@ -5305,9 +8676,9 @@ export async function snippetForSetSettings42(): Promise { // Snippet for the setSettings method. // -// ranking closest dates -export async function snippetForSetSettings43(): Promise { - // >SEPARATOR setSettings ranking closest dates +// disabling_exact_for_some_attributes_by_default +export async function snippetForSetSettings110(): Promise { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5315,9 +8686,7 @@ export async function snippetForSetSettings43(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - ranking: ['asc(date_timestamp)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], - }, + indexSettings: { disableExactOnAttributes: ['description'] }, }); // >LOG @@ -5328,9 +8697,9 @@ export async function snippetForSetSettings43(): Promise { // Snippet for the setSettings method. // -// searchableAttributes item variation -export async function snippetForSetSettings44(): Promise { - // >SEPARATOR setSettings searchableAttributes item variation +// set_default_exact_single_word_query +export async function snippetForSetSettings111(): Promise { + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5338,7 +8707,7 @@ export async function snippetForSetSettings44(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['design', 'type', 'color'] }, + indexSettings: { exactOnSingleWordQuery: 'attribute' }, }); // >LOG @@ -5349,9 +8718,9 @@ export async function snippetForSetSettings44(): Promise { // Snippet for the setSettings method. // -// searchableAttributes around location -export async function snippetForSetSettings45(): Promise { - // >SEPARATOR setSettings searchableAttributes around location +// set_default_aternative_as_exact +export async function snippetForSetSettings112(): Promise { + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5359,10 +8728,7 @@ export async function snippetForSetSettings45(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }, + indexSettings: { alternativesAsExact: ['ignorePlurals', 'singleWordSynonym'] }, }); // >LOG @@ -5373,21 +8739,15 @@ export async function snippetForSetSettings45(): Promise { // Snippet for the setSettings method. // -// searchableAttributes around location -export async function snippetForSetSettings46(): Promise { - // >SEPARATOR setSettings searchableAttributes around location +// enable_advanced_syntax_by_default +export async function snippetForSetSettings113(): Promise { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { advancedSyntax: true } }); // >LOG // use typed response @@ -5397,9 +8757,9 @@ export async function snippetForSetSettings46(): Promise { // Snippet for the setSettings method. // -// disableTypoToleranceOnAttributes -export async function snippetForSetSettings47(): Promise { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes +// set_numeric_attributes_for_filtering +export async function snippetForSetSettings114(): Promise { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5407,7 +8767,7 @@ export async function snippetForSetSettings47(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + indexSettings: { numericAttributesForFiltering: ['quantity', 'popularity'] }, }); // >LOG @@ -5418,9 +8778,9 @@ export async function snippetForSetSettings47(): Promise { // Snippet for the setSettings method. // -// everything -export async function snippetForSetSettings48(): Promise { - // >SEPARATOR setSettings everything +// enable_compression_of_integer_array +export async function snippetForSetSettings115(): Promise { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5428,71 +8788,7 @@ export async function snippetForSetSettings48(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - advancedSyntax: true, - advancedSyntaxFeatures: ['exactPhrase'], - allowCompressionOfIntegerArray: true, - allowTyposOnNumericTokens: true, - alternativesAsExact: ['singleWordSynonym'], - attributeCriteriaComputedByMinProximity: true, - attributeForDistinct: 'test', - attributesForFaceting: ['algolia'], - attributesToHighlight: ['algolia'], - attributesToRetrieve: ['algolia'], - attributesToSnippet: ['algolia'], - attributesToTransliterate: ['algolia'], - camelCaseAttributes: ['algolia'], - customNormalization: { algolia: { aloglia: 'aglolia' } }, - customRanking: ['algolia'], - decompoundQuery: false, - decompoundedAttributes: { algolia: 'aloglia' }, - disableExactOnAttributes: ['algolia'], - disablePrefixOnAttributes: ['algolia'], - disableTypoToleranceOnAttributes: ['algolia'], - disableTypoToleranceOnWords: ['algolia'], - distinct: 3, - enablePersonalization: true, - enableReRanking: false, - enableRules: true, - exactOnSingleWordQuery: 'attribute', - highlightPreTag: '', - highlightPostTag: '', - hitsPerPage: 10, - ignorePlurals: false, - indexLanguages: ['fr'], - keepDiacriticsOnCharacters: 'abc', - maxFacetHits: 20, - maxValuesPerFacet: 30, - minProximity: 6, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - mode: 'neuralSearch', - numericAttributesForFiltering: ['algolia'], - optionalWords: ['myspace'], - paginationLimitedTo: 0, - queryLanguages: ['fr'], - queryType: 'prefixLast', - ranking: ['geo'], - reRankingApplyFilter: 'mySearch:filters', - relevancyStrictness: 10, - removeStopWords: false, - removeWordsIfNoResults: 'lastWords', - renderingContent: { - facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, - }, - replaceSynonymsInHighlight: true, - replicas: [''], - responseFields: ['algolia'], - restrictHighlightAndSnippetArrays: true, - searchableAttributes: ['foo'], - semanticSearch: { eventSources: ['foo'] }, - separatorsToIndex: 'bar', - snippetEllipsisText: '---', - sortFacetValuesBy: 'date', - typoTolerance: false, - unretrievableAttributes: ['foo'], - userData: { user: 'data' }, - }, + indexSettings: { allowCompressionOfIntegerArray: true }, }); // >LOG @@ -5503,9 +8799,9 @@ export async function snippetForSetSettings48(): Promise { // Snippet for the setSettings method. // -// searchableAttributesWithCustomRankingsAndAttributesForFaceting -export async function snippetForSetSettings49(): Promise { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting +// set_attributes_for_distinct +export async function snippetForSetSettings116(): Promise { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5513,11 +8809,7 @@ export async function snippetForSetSettings49(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], - customRanking: ['desc(popularity)'], - attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], - }, + indexSettings: { attributeForDistinct: 'url' }, }); // >LOG @@ -5528,9 +8820,9 @@ export async function snippetForSetSettings49(): Promise { // Snippet for the setSettings method. // -// searchableAttributesProductReferenceSuffixes -export async function snippetForSetSettings50(): Promise { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes +// set_distinct +export async function snippetForSetSettings117(): Promise { + // >SEPARATOR setSettings set_distinct // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5538,7 +8830,7 @@ export async function snippetForSetSettings50(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }, + indexSettings: { distinct: 1, attributeForDistinct: 'url' }, }); // >LOG @@ -5549,9 +8841,9 @@ export async function snippetForSetSettings50(): Promise { // Snippet for the setSettings method. // -// queryLanguageAndIgnorePlurals -export async function snippetForSetSettings51(): Promise { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals +// set_replace_synonyms_in_highlights +export async function snippetForSetSettings118(): Promise { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5559,7 +8851,7 @@ export async function snippetForSetSettings51(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { queryLanguages: ['en'], ignorePlurals: true }, + indexSettings: { replaceSynonymsInHighlight: false }, }); // >LOG @@ -5570,18 +8862,15 @@ export async function snippetForSetSettings51(): Promise { // Snippet for the setSettings method. // -// searchableAttributesInMovies -export async function snippetForSetSettings52(): Promise { - // >SEPARATOR setSettings searchableAttributesInMovies +// set_min_proximity +export async function snippetForSetSettings119(): Promise { + // >SEPARATOR setSettings set_min_proximity // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - const response = await client.setSettings({ - indexName: 'movies', - indexSettings: { searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }, - }); + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { minProximity: 1 } }); // >LOG // use typed response @@ -5591,9 +8880,9 @@ export async function snippetForSetSettings52(): Promise { // Snippet for the setSettings method. // -// disablePrefixOnAttributes -export async function snippetForSetSettings53(): Promise { - // >SEPARATOR setSettings disablePrefixOnAttributes +// set_default_field +export async function snippetForSetSettings120(): Promise { + // >SEPARATOR setSettings set_default_field // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5601,7 +8890,7 @@ export async function snippetForSetSettings53(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disablePrefixOnAttributes: ['serial_number'] }, + indexSettings: { responseFields: ['hits', 'hitsPerPage', 'nbPages', 'page'] }, }); // >LOG @@ -5612,9 +8901,27 @@ export async function snippetForSetSettings53(): Promise { // Snippet for the setSettings method. // -// disableTypoToleranceOnAttributes -export async function snippetForSetSettings54(): Promise { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes +// set_max_facet_hits +export async function snippetForSetSettings121(): Promise { + // >SEPARATOR setSettings set_max_facet_hits + // Initialize the client + // + const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { maxFacetHits: 10 } }); + + // >LOG + // use typed response + console.log(response); + // SEPARATOR< +} + +// Snippet for the setSettings method. +// +// set_attribute_criteria_computed_by_min_proximity +export async function snippetForSetSettings122(): Promise { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5622,7 +8929,7 @@ export async function snippetForSetSettings54(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + indexSettings: { attributeCriteriaComputedByMinProximity: true }, }); // >LOG @@ -5633,9 +8940,9 @@ export async function snippetForSetSettings54(): Promise { // Snippet for the setSettings method. // -// searchableAttributesSimpleExample -export async function snippetForSetSettings55(): Promise { - // >SEPARATOR setSettings searchableAttributesSimpleExample +// set_user_data +export async function snippetForSetSettings123(): Promise { + // >SEPARATOR setSettings set_user_data // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5643,7 +8950,7 @@ export async function snippetForSetSettings55(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['serial_number'] }, + indexSettings: { userData: { extraData: 'This is the custom data that you want to store in your index' } }, }); // >LOG @@ -5654,9 +8961,9 @@ export async function snippetForSetSettings55(): Promise { // Snippet for the setSettings method. // -// searchableAttributesSimpleExampleAlt -export async function snippetForSetSettings56(): Promise { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt +// set_rendering_content +export async function snippetForSetSettings124(): Promise { + // >SEPARATOR setSettings set_rendering_content // Initialize the client // const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); @@ -5664,7 +8971,17 @@ export async function snippetForSetSettings56(): Promise { // Call the API const response = await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] }, + indexSettings: { + renderingContent: { + facetOrdering: { + facets: { order: ['size', 'brand'] }, + values: { + brand: { order: ['uniqlo'], hide: ['muji'], sortRemainingBy: 'count' }, + size: { order: ['S', 'M', 'L'], sortRemainingBy: 'hidden' }, + }, + }, + }, + }, }); // >LOG diff --git a/docs/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt b/docs/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt index 95b8a058a2..e7c374014f 100644 --- a/docs/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt +++ b/docs/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Search.kt @@ -4682,7 +4682,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex14() { - // >SEPARATOR searchSingleIndex facetFiltersNeg + // >SEPARATOR searchSingleIndex facetFiltersBook // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4690,7 +4690,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - facetFilters = FacetFilters.of("category:-Ebook"), + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("category:Book"))), ), ) @@ -4703,7 +4704,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex15() { - // >SEPARATOR searchSingleIndex filtersAndFacetFilters + // >SEPARATOR searchSingleIndex facetFiltersAND // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4711,8 +4712,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - filters = "(author:\"Stephen King\" OR genre:\"Horror\")", - facetFilters = FacetFilters.of(listOf(FacetFilters.of("publisher:Penguin"))), + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe"))), ), ) @@ -4725,7 +4726,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex16() { - // >SEPARATOR searchSingleIndex facet author genre + // >SEPARATOR searchSingleIndex facetFiltersOR // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4733,7 +4734,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - facets = listOf("author", "genre"), + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe"))))), ), ) @@ -4746,7 +4748,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex17() { - // >SEPARATOR searchSingleIndex facet wildcard + // >SEPARATOR searchSingleIndex facetFiltersCombined // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4754,7 +4756,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - facets = listOf("*"), + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("author:John Doe"), FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("category:Movie"))))), ), ) @@ -4767,7 +4770,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex18() { - // >SEPARATOR searchSingleIndex maxValuesPerFacet + // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4775,7 +4778,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - maxValuesPerFacet = 1000, + facetFilters = FacetFilters.of("category:-Ebook"), ), ) @@ -4788,7 +4791,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex19() { - // >SEPARATOR searchSingleIndex aroundLatLng + // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4796,7 +4799,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - aroundLatLng = "40.71, -74.01", + filters = "(author:\"Stephen King\" OR genre:\"Horror\")", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("publisher:Penguin"))), ), ) @@ -4809,7 +4813,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex20() { - // >SEPARATOR searchSingleIndex aroundLatLngViaIP + // >SEPARATOR searchSingleIndex facet author genre // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4817,7 +4821,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - aroundLatLngViaIP = true, + facets = listOf("author", "genre"), ), ) @@ -4830,7 +4834,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex21() { - // >SEPARATOR searchSingleIndex aroundRadius + // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4838,8 +4842,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - aroundLatLng = "40.71, -74.01", - aroundRadius = AroundRadius.of(1000000), + facets = listOf("*"), ), ) @@ -4852,7 +4855,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex22() { - // >SEPARATOR searchSingleIndex insideBoundingBox + // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4860,7 +4863,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - insideBoundingBox = InsideBoundingBox.of(listOf(listOf(49.067996905313834, 65.73828125, 25.905859247243498, 128.8046875))), + maxValuesPerFacet = 1000, ), ) @@ -4873,7 +4876,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex23() { - // >SEPARATOR searchSingleIndex insidePolygon + // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4881,7 +4884,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - insidePolygon = listOf(listOf(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005, 31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545, -117.54828125)), + aroundLatLng = "40.71, -74.01", ), ) @@ -4894,7 +4897,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex24() { - // >SEPARATOR searchSingleIndex insidePolygon + // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4902,7 +4905,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - insidePolygon = listOf(listOf(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005, 31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545, -117.54828125)), + aroundLatLngViaIP = true, ), ) @@ -4915,7 +4918,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex25() { - // >SEPARATOR searchSingleIndex optionalFilters + // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4923,7 +4926,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("can_deliver_quickly:true"))), + aroundLatLng = "40.71, -74.01", + aroundRadius = AroundRadius.of(1000000), ), ) @@ -4936,7 +4940,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex26() { - // >SEPARATOR searchSingleIndex optionalFiltersMany + // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4944,7 +4948,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("brand:Apple"), OptionalFilters.of("brand:Samsung"), OptionalFilters.of("brand:-Huawei"))), + insideBoundingBox = InsideBoundingBox.of(listOf(listOf(49.067996905313834, 65.73828125, 25.905859247243498, 128.8046875))), ), ) @@ -4957,7 +4961,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex27() { - // >SEPARATOR searchSingleIndex optionalFiltersSimple + // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4965,7 +4969,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("brand:Apple"), OptionalFilters.of("type:tablet"))), + insidePolygon = listOf(listOf(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005, 31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545, -117.54828125)), ), ) @@ -4978,7 +4982,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex28() { - // >SEPARATOR searchSingleIndex restrictSearchableAttributes + // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4986,7 +4990,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - restrictSearchableAttributes = listOf("title_fr"), + insidePolygon = listOf(listOf(42.01, -124.31, 48.835509470063045, -124.40453125000005, 45.01082951668149, -65.95726562500005, 31.247243545293433, -81.06578125000004, 25.924152577235226, -97.68234374999997, 32.300311895879545, -117.54828125)), ), ) @@ -4999,7 +5003,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex29() { - // >SEPARATOR searchSingleIndex getRankingInfo + // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5007,7 +5011,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - getRankingInfo = true, + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("can_deliver_quickly:true"))), ), ) @@ -5020,7 +5024,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex30() { - // >SEPARATOR searchSingleIndex clickAnalytics + // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5028,7 +5032,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - clickAnalytics = true, + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("brand:Apple"), OptionalFilters.of("brand:Samsung"), OptionalFilters.of("brand:-Huawei"))), ), ) @@ -5041,7 +5045,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex31() { - // >SEPARATOR searchSingleIndex clickAnalyticsUserToken + // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5049,8 +5053,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - clickAnalytics = true, - userToken = "user-1", + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("brand:Apple"), OptionalFilters.of("type:tablet"))), ), ) @@ -5063,7 +5066,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex32() { - // >SEPARATOR searchSingleIndex enablePersonalization + // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5071,8 +5074,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - enablePersonalization = true, - userToken = "user-1", + restrictSearchableAttributes = listOf("title_fr"), ), ) @@ -5085,7 +5087,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex33() { - // >SEPARATOR searchSingleIndex userToken + // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5093,7 +5095,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - userToken = "user-1", + getRankingInfo = true, ), ) @@ -5106,7 +5108,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex34() { - // >SEPARATOR searchSingleIndex analyticsTag + // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5114,7 +5116,7 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - analyticsTags = listOf("YOUR_ANALYTICS_TAG"), + clickAnalytics = true, ), ) @@ -5127,7 +5129,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex35() { - // >SEPARATOR searchSingleIndex facetFiltersUsers + // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5135,7 +5137,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - facetFilters = FacetFilters.of(listOf(FacetFilters.of("user:user42"), FacetFilters.of("user:public"))), + clickAnalytics = true, + userToken = "user-1", ), ) @@ -5148,7 +5151,7 @@ class SnippetSearchClient { } suspend fun snippetForSearchSingleIndex36() { - // >SEPARATOR searchSingleIndex buildTheQuery + // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5156,9 +5159,8 @@ class SnippetSearchClient { var response = client.searchSingleIndex( indexName = "", searchParams = SearchParamsObject( - filters = "categoryPageId: Men's Clothing", - hitsPerPage = 50, - analyticsTags = listOf("mens-clothing"), + enablePersonalization = true, + userToken = "user-1", ), ) @@ -5170,14 +5172,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSearchSynonyms() { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + suspend fun snippetForSearchSingleIndex37() { + // >SEPARATOR searchSingleIndex userToken // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.searchSynonyms( + var response = client.searchSingleIndex( indexName = "", + searchParams = SearchParamsObject( + userToken = "user-1", + ), ) // >LOG @@ -5188,19 +5193,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSearchSynonyms1() { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + suspend fun snippetForSearchSingleIndex38() { + // >SEPARATOR searchSingleIndex userToken1234 // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.searchSynonyms( + var response = client.searchSingleIndex( indexName = "", - searchSynonymsParams = SearchSynonymsParams( - query = "myQuery", - type = SynonymType.entries.first { it.value == "altcorrection1" }, - page = 10, - hitsPerPage = 10, + searchParams = SearchParamsObject( + query = "query", + userToken = "user-1234", ), ) @@ -5212,18 +5215,16 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSearchUserIds() { - // >SEPARATOR searchUserIds default + suspend fun snippetForSearchSingleIndex39() { + // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.searchUserIds( - searchUserIdsParams = SearchUserIdsParams( - query = "test", - clusterName = "theClusterName", - page = 5, - hitsPerPage = 10, + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + analyticsTags = listOf("YOUR_ANALYTICS_TAG"), ), ) @@ -5235,33 +5236,39 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetClientApiKey() { - // >SEPARATOR setClientApiKey default + suspend fun snippetForSearchSingleIndex40() { + // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - client.setClientApiKey( - apiKey = "updated-api-key", + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + facetFilters = FacetFilters.of(listOf(FacetFilters.of("user:user42"), FacetFilters.of("user:public"))), + ), ) // >LOG + // Use the response + println(response) // SEPARATOR< exitProcess(0) } - suspend fun snippetForSetDictionarySettings() { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + suspend fun snippetForSearchSingleIndex41() { + // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = mapOf("fr" to false, "en" to false, "ru" to true), - ), + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + filters = "categoryPageId: Men's Clothing", + hitsPerPage = 50, + analyticsTags = listOf("mens-clothing"), ), ) @@ -5273,19 +5280,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetDictionarySettings1() { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + suspend fun snippetForSearchSingleIndex42() { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = mapOf("fr" to false, "en" to false, "ru" to true), - stopwords = mapOf("fr" to false), - compounds = mapOf("ru" to true), - ), + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + attributesToHighlight = listOf("title", "content"), ), ) @@ -5297,18 +5302,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings() { - // >SEPARATOR setSettings minimal parameters + suspend fun snippetForSearchSingleIndex43() { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - paginationLimitedTo = 10, + searchParams = SearchParamsObject( + query = "query", + disableTypoToleranceOnAttributes = listOf("serial_number"), ), - forwardToReplicas = true, ) // >LOG @@ -5319,18 +5324,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings1() { - // >SEPARATOR setSettings boolean typoTolerance + suspend fun snippetForSearchSingleIndex44() { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - typoTolerance = TypoTolerance.of(true), + searchParams = SearchParamsObject( + query = "shirt", ), - forwardToReplicas = true, ) // >LOG @@ -5341,18 +5345,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings2() { - // >SEPARATOR setSettings enum typoTolerance + suspend fun snippetForSearchSingleIndex45() { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - typoTolerance = TypoToleranceEnum.entries.first { it.value == "min" }, + searchParams = SearchParamsObject( + query = "", ), - forwardToReplicas = true, ) // >LOG @@ -5363,18 +5366,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings3() { - // >SEPARATOR setSettings ignorePlurals + suspend fun snippetForSearchSingleIndex46() { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - ignorePlurals = IgnorePlurals.of(true), + searchParams = SearchParamsObject( + query = "books", + filters = "price:10 TO 20", ), - forwardToReplicas = true, ) // >LOG @@ -5385,18 +5388,19 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings4() { - // >SEPARATOR setSettings list of string ignorePlurals + suspend fun snippetForSearchSingleIndex47() { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + searchParams = SearchParamsObject( + query = "", + similarQuery = "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters = "year:1991 TO 2001", ), - forwardToReplicas = true, ) // >LOG @@ -5407,18 +5411,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings5() { - // >SEPARATOR setSettings removeStopWords boolean + suspend fun snippetForSearchSingleIndex48() { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - removeStopWords = RemoveStopWords.of(true), + searchParams = SearchParamsObject( + query = "query", + attributesToRetrieve = listOf("title", "content"), ), - forwardToReplicas = true, ) // >LOG @@ -5429,18 +5433,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings6() { - // >SEPARATOR setSettings removeStopWords list of string + suspend fun snippetForSearchSingleIndex49() { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + searchParams = SearchParamsObject( + query = "query", + restrictSearchableAttributes = listOf("title", "author"), ), - forwardToReplicas = true, ) // >LOG @@ -5451,18 +5455,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings7() { - // >SEPARATOR setSettings boolean distinct + suspend fun snippetForSearchSingleIndex50() { + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - distinct = Distinct.of(true), + searchParams = SearchParamsObject( + query = "query", + relevancyStrictness = 70, ), - forwardToReplicas = true, ) // >LOG @@ -5473,18 +5477,18 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings8() { - // >SEPARATOR setSettings integer distinct + suspend fun snippetForSearchSingleIndex51() { + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - distinct = Distinct.of(1), + searchParams = SearchParamsObject( + query = "query", + filters = "(category:Book OR category:Ebook) AND _tags:published", ), - forwardToReplicas = true, ) // >LOG @@ -5495,17 +5499,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings9() { - // >SEPARATOR setSettings distinct company + suspend fun snippetForSearchSingleIndex52() { + // >SEPARATOR searchSingleIndex apply_all_filters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - attributeForDistinct = "company", - distinct = Distinct.of(true), + searchParams = SearchParamsObject( + 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\"", ), ) @@ -5517,17 +5521,17 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings10() { - // >SEPARATOR setSettings distinct design + suspend fun snippetForSearchSingleIndex53() { + // >SEPARATOR searchSingleIndex escape_spaces // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - attributeForDistinct = "design", - distinct = Distinct.of(true), + searchParams = SearchParamsObject( + query = "query", + filters = "category:\"Books and Comics\"", ), ) @@ -5539,16 +5543,3281 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings11() { - // >SEPARATOR setSettings distinct true + suspend fun snippetForSearchSingleIndex54() { + // >SEPARATOR searchSingleIndex escape_keywords // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - var response = client.setSettings( + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + filters = "keyword:\"OR\"", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex55() { + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + filters = "content:\"It's a wonderful day\"", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex56() { + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + filters = "content:\"She said \"Hello World\"", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex57() { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("category:Book"), OptionalFilters.of("author:John Doe"))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex58() { + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("category:Book"), OptionalFilters.of("author:-John Doe"))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex59() { + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + numericFilters = NumericFilters.of(listOf(NumericFilters.of("price < 1000"), NumericFilters.of(listOf(NumericFilters.of("inStock = 1"), NumericFilters.of("deliveryDate < 1441755506"))))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex60() { + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + tagFilters = TagFilters.of(listOf(TagFilters.of("SciFi"), TagFilters.of(listOf(TagFilters.of("Book"), TagFilters.of("Movie"))))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex61() { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + sumOrFiltersScores = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex62() { + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + facets = listOf("*"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex63() { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + facets = listOf("category", "author"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex64() { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + maxValuesPerFacet = 20, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex65() { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + facetingAfterDistinct = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex66() { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + sortFacetValuesBy = "count", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex67() { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + attributesToSnippet = listOf("title", "content:80"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex68() { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + highlightPreTag = "", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex69() { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + highlightPostTag = "", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex70() { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + snippetEllipsisText = "", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex71() { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + restrictHighlightAndSnippetArrays = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex72() { + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + page = 0, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex73() { + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + hitsPerPage = 10, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex74() { + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + offset = 4, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex75() { + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + length = 4, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex76() { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + minWordSizefor1Typo = 2, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex77() { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + minWordSizefor2Typos = 2, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex78() { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + typoTolerance = TypoTolerance.of(false), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex79() { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + allowTyposOnNumericTokens = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex80() { + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundLatLng = "40.71, -74.01", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex81() { + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundLatLngViaIP = true, + ), + requestOptions = RequestOptions( + headers = buildMap { + put("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to search around") + }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex82() { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundRadius = AroundRadius.of(1000), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex83() { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundRadius = AroundRadiusAll.entries.first { it.value == "all" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex84() { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundPrecision = AroundPrecision.of(100), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex85() { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + aroundPrecision = AroundPrecision.of( + listOf( + Range( + from = 0, + value = 25, + ), + Range( + from = 2000, + value = 1000, + ), + ), + ), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex86() { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + minimumAroundRadius = 1000, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex87() { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex88() { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875))), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex89() { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex90() { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625)), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex91() { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex92() { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex93() { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex94() { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }, SupportedLanguage.entries.first { it.value == "en" }), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex95() { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "", + naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex96() { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "", + naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "firstWords" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex97() { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + decompoundQuery = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex98() { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enableRules = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex99() { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + ruleContexts = listOf("front_end", "website2"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex100() { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex101() { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + userToken = "123456", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex102() { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + personalizationImpact = 20, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex103() { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + userToken = "123456", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex104() { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + userToken = "123456", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex105() { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + queryType = QueryType.entries.first { it.value == "prefixAll" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex106() { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex107() { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex108() { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + optionalWords = OptionalWords.of(listOf("toyota", "2020 2021")), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex109() { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + disableExactOnAttributes = listOf("description"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex110() { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "none" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex111() { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "multiWordsSynonym" }), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex112() { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex113() { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "excludeWords" }), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex114() { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + distinct = Distinct.of(0), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex115() { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + getRankingInfo = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex116() { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + clickAnalytics = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex117() { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + clickAnalytics = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex118() { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + analytics = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex119() { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + analyticsTags = listOf("front_end", "website2"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex120() { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + synonyms = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex121() { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + replaceSynonymsInHighlight = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex122() { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + minProximity = 2, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex123() { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + responseFields = listOf("hits", "facets"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex124() { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + percentileComputation = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex125() { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enableABTest = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSingleIndex126() { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSingleIndex( + indexName = "", + searchParams = SearchParamsObject( + query = "query", + enableReRanking = false, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSynonyms() { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSynonyms( + indexName = "", + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchSynonyms1() { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchSynonyms( + indexName = "", + searchSynonymsParams = SearchSynonymsParams( + query = "myQuery", + type = SynonymType.entries.first { it.value == "altcorrection1" }, + page = 10, + hitsPerPage = 10, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSearchUserIds() { + // >SEPARATOR searchUserIds default + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.searchUserIds( + searchUserIdsParams = SearchUserIdsParams( + query = "test", + clusterName = "theClusterName", + page = 5, + hitsPerPage = 10, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetClientApiKey() { + // >SEPARATOR setClientApiKey default + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + client.setClientApiKey( + apiKey = "updated-api-key", + ) + + // >LOG + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetDictionarySettings() { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = mapOf("fr" to false, "en" to false, "ru" to true), + ), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetDictionarySettings1() { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = mapOf("fr" to false, "en" to false, "ru" to true), + stopwords = mapOf("fr" to false), + compounds = mapOf("ru" to true), + ), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings() { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + paginationLimitedTo = 10, + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings1() { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + typoTolerance = TypoTolerance.of(true), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings2() { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + typoTolerance = TypoToleranceEnum.entries.first { it.value == "min" }, + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings3() { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ignorePlurals = IgnorePlurals.of(true), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings4() { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings5() { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + removeStopWords = RemoveStopWords.of(true), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings6() { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings7() { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Distinct.of(true), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings8() { + // >SEPARATOR setSettings integer distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Distinct.of(1), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings9() { + // >SEPARATOR setSettings distinct company + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = "company", + distinct = Distinct.of(true), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings10() { + // >SEPARATOR setSettings distinct design + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = "design", + distinct = Distinct.of(true), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings11() { + // >SEPARATOR setSettings distinct true + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Distinct.of(true), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings12() { + // >SEPARATOR setSettings distinct section + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = "section", + distinct = Distinct.of(true), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings13() { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("allergens"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings14() { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("genre", "author"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings15() { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("genre", "searchable(author)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings16() { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(genre)", "author"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings17() { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("searchable(categoryPageId)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings18() { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + unretrievableAttributes = listOf("visible_by"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings19() { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(visible_by)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings20() { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("can_deliver_quickly", "restaurant"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings21() { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("query_terms"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings22() { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("director"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings23() { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(brand)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings24() { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + mode = Mode.entries.first { it.value == "neuralSearch" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings25() { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + mode = Mode.entries.first { it.value == "keywordSearch" }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings26() { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("title,comments", "ingredients"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings27() { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("title", "ingredients"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings28() { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(retweets)", "desc(likes)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings29() { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(boosted)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings30() { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(pageviews)", "desc(comments)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings31() { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(nb_airline_liaisons)"), + attributesForFaceting = listOf("city, country"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings32() { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(rounded_pageviews)", "desc(comments)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings33() { + // >SEPARATOR setSettings customRanking price + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(price)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings34() { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings35() { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = listOf("desc(post_date_timestamp)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings36() { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("desc(post_date_timestamp)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings37() { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("asc(textual_attribute)"), + ranking = listOf("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings38() { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = listOf("asc(textual_attribute)"), + relevancyStrictness = 0, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings39() { + // >SEPARATOR setSettings create replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = listOf("products_price_desc"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings40() { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = listOf("articles_date_desc"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings41() { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = listOf("virtual(products_price_desc)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings42() { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = listOf(""), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings43() { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "description"), + ), + forwardToReplicas = true, + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings44() { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + maxValuesPerFacet = 1000, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings45() { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + maxFacetHits = 1000, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings46() { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("actor", "filterOnly(category)", "searchable(publisher)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings47() { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = listOf("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings48() { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("design", "type", "color"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings49() { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "country", "code", "iata_code"), + customRanking = listOf("desc(links_count)"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings50() { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToHighlight = listOf("author", "title", "content"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings51() { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToHighlight = listOf("*"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings52() { + // >SEPARATOR setSettings everything + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), + allowCompressionOfIntegerArray = true, + allowTyposOnNumericTokens = true, + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), + attributeCriteriaComputedByMinProximity = true, + attributeForDistinct = "test", + attributesForFaceting = listOf("algolia"), + attributesToHighlight = listOf("algolia"), + attributesToRetrieve = listOf("algolia"), + attributesToSnippet = listOf("algolia"), + attributesToTransliterate = listOf("algolia"), + camelCaseAttributes = listOf("algolia"), + customNormalization = mapOf("algolia" to mapOf("aloglia" to "aglolia")), + customRanking = listOf("algolia"), + decompoundQuery = false, + decompoundedAttributes = buildJsonObject { + put( + "algolia", + JsonPrimitive("aloglia"), + ) + }, + disableExactOnAttributes = listOf("algolia"), + disablePrefixOnAttributes = listOf("algolia"), + disableTypoToleranceOnAttributes = listOf("algolia"), + disableTypoToleranceOnWords = listOf("algolia"), + distinct = Distinct.of(3), + enablePersonalization = true, + enableReRanking = false, + enableRules = true, + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, + highlightPreTag = "", + highlightPostTag = "", + hitsPerPage = 10, + ignorePlurals = IgnorePlurals.of(false), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + keepDiacriticsOnCharacters = "abc", + maxFacetHits = 20, + maxValuesPerFacet = 30, + minProximity = 6, + minWordSizefor1Typo = 5, + minWordSizefor2Typos = 11, + mode = Mode.entries.first { it.value == "neuralSearch" }, + numericAttributesForFiltering = listOf("algolia"), + optionalWords = OptionalWords.of(listOf("myspace")), + paginationLimitedTo = 0, + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + queryType = QueryType.entries.first { it.value == "prefixLast" }, + ranking = listOf("geo"), + reRankingApplyFilter = ReRankingApplyFilter.of("mySearch:filters"), + relevancyStrictness = 10, + removeStopWords = RemoveStopWords.of(false), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, + renderingContent = RenderingContent( + facetOrdering = FacetOrdering( + facets = Facets( + order = listOf("a", "b"), + ), + values = mapOf( + "a" to Value( + order = listOf("b"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, + ), + ), + ), + ), + replaceSynonymsInHighlight = true, + replicas = listOf(""), + responseFields = listOf("algolia"), + restrictHighlightAndSnippetArrays = true, + searchableAttributes = listOf("foo"), + semanticSearch = SemanticSearch( + eventSources = listOf("foo"), + ), + separatorsToIndex = "bar", + snippetEllipsisText = "---", + sortFacetValuesBy = "date", + typoTolerance = TypoTolerance.of(false), + unretrievableAttributes = listOf("foo"), + userData = buildJsonObject { + put( + "user", + JsonPrimitive("data"), + ) + }, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings53() { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("brand", "name", "categories", "unordered(description)"), + customRanking = listOf("desc(popularity)"), + attributesForFaceting = listOf("searchable(brand)", "type", "categories", "price"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings54() { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("unordered(title)", "cast"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings55() { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "product_reference", "product_reference_suffixes"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings56() { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "en" }), + ignorePlurals = IgnorePlurals.of(true), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings57() { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("title_eng", "title_fr", "title_es"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings58() { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + disablePrefixOnAttributes = listOf("serial_number"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings59() { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + disableTypoToleranceOnAttributes = listOf("serial_number"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings60() { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("serial_number"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings61() { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("serial_number", "serial_number_suffixes"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings62() { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = listOf("title,alternative_title", "author", "unordered(text)", "emails.personal"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings63() { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("author", "filterOnly(isbn)", "searchable(edition)", "afterDistinct(category)", "afterDistinct(searchable(publisher))"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings64() { + // >SEPARATOR setSettings unretrievable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + unretrievableAttributes = listOf("total_number_of_sales"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings65() { + // >SEPARATOR setSettings set_retrievable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToRetrieve = listOf("author", "title", "content"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings66() { + // >SEPARATOR setSettings set_all_attributes_as_retrievable + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToRetrieve = listOf("*"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings67() { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - distinct = Distinct.of(true), + attributesToRetrieve = listOf("*", "-SKU", "-internal_desc"), ), ) @@ -5560,8 +8829,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings12() { - // >SEPARATOR setSettings distinct section + suspend fun snippetForSetSettings68() { + // >SEPARATOR setSettings neural_search // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5569,8 +8838,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributeForDistinct = "section", - distinct = Distinct.of(true), + mode = Mode.entries.first { it.value == "neuralSearch" }, ), ) @@ -5582,8 +8850,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings13() { - // >SEPARATOR setSettings attributesForFaceting allergens + suspend fun snippetForSetSettings69() { + // >SEPARATOR setSettings keyword_search // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5591,7 +8859,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("allergens"), + mode = Mode.entries.first { it.value == "keywordSearch" }, ), ) @@ -5603,8 +8871,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings14() { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + suspend fun snippetForSetSettings70() { + // >SEPARATOR setSettings set_default_ranking // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5612,7 +8880,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("searchable(categoryPageId)"), + ranking = listOf("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"), ), ) @@ -5624,8 +8892,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings15() { - // >SEPARATOR setSettings unretrievableAttributes + suspend fun snippetForSetSettings71() { + // >SEPARATOR setSettings set_ranking_by_attribute_asc // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5633,7 +8901,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - unretrievableAttributes = listOf("visible_by"), + ranking = listOf("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), ), ) @@ -5645,8 +8913,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings16() { - // >SEPARATOR setSettings attributesForFaceting user restricted data + suspend fun snippetForSetSettings72() { + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5654,7 +8922,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("filterOnly(visible_by)"), + ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), ), ) @@ -5666,8 +8934,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings17() { - // >SEPARATOR setSettings attributesForFaceting optional filters + suspend fun snippetForSetSettings73() { + // >SEPARATOR setSettings restrict_searchable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5675,7 +8943,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("can_deliver_quickly", "restaurant"), + customRanking = listOf("desc(popularity)", "asc(price)"), ), ) @@ -5687,8 +8955,260 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings18() { - // >SEPARATOR setSettings attributesForFaceting redirect index + suspend fun snippetForSetSettings74() { + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + relevancyStrictness = 90, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings75() { + // >SEPARATOR setSettings set_replicas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = listOf("name_of_replica_index1", "name_of_replica_index2"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings76() { + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + maxValuesPerFacet = 100, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings77() { + // >SEPARATOR setSettings set_default_sort_facet_values_by + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + sortFacetValuesBy = "alpha", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings78() { + // >SEPARATOR setSettings set_attributes_to_snippet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToSnippet = listOf("content:80", "description"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings79() { + // >SEPARATOR setSettings set_all_attributes_to_snippet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToSnippet = listOf("*:80"), + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings80() { + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + highlightPreTag = "", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings81() { + // >SEPARATOR setSettings set_default_highlight_post_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + highlightPostTag = "", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings82() { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + snippetEllipsisText = "…", + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings83() { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + restrictHighlightAndSnippetArrays = true, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings84() { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + hitsPerPage = 20, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings85() { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + var response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + paginationLimitedTo = 1000, + ), + ) + + // >LOG + // Use the response + println(response) + // SEPARATOR< + + exitProcess(0) + } + + suspend fun snippetForSetSettings86() { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5696,7 +9216,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("query_terms"), + minWordSizefor1Typo = 4, ), ) @@ -5708,8 +9228,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings19() { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + suspend fun snippetForSetSettings87() { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5717,7 +9237,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("director"), + minWordSizefor2Typos = 4, ), ) @@ -5729,8 +9249,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings20() { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + suspend fun snippetForSetSettings88() { + // >SEPARATOR setSettings set_default_typo_tolerance_mode // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5738,7 +9258,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("filterOnly(brand)"), + typoTolerance = TypoTolerance.of(true), ), ) @@ -5750,8 +9270,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings21() { - // >SEPARATOR setSettings mode neuralSearch + suspend fun snippetForSetSettings89() { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5759,7 +9279,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - mode = Mode.entries.first { it.value == "neuralSearch" }, + allowTyposOnNumericTokens = false, ), ) @@ -5771,8 +9291,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings22() { - // >SEPARATOR setSettings mode keywordSearch + suspend fun snippetForSetSettings90() { + // >SEPARATOR setSettings disable_typo_tolerance_for_words // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5780,7 +9300,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - mode = Mode.entries.first { it.value == "keywordSearch" }, + disableTypoToleranceOnWords = listOf("wheel", "1X2BCD"), ), ) @@ -5792,8 +9312,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings23() { - // >SEPARATOR setSettings searchableAttributes same priority + suspend fun snippetForSetSettings91() { + // >SEPARATOR setSettings set_separators_to_index // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5801,7 +9321,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("title,comments", "ingredients"), + separatorsToIndex = "+#", ), ) @@ -5813,8 +9333,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings24() { - // >SEPARATOR setSettings searchableAttributes higher priority + suspend fun snippetForSetSettings92() { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5822,7 +9342,8 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("title", "ingredients"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + ignorePlurals = IgnorePlurals.of(true), ), ) @@ -5834,8 +9355,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings25() { - // >SEPARATOR setSettings customRanking retweets + suspend fun snippetForSetSettings93() { + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5843,7 +9364,8 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(retweets)", "desc(likes)"), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }), + attributesToTransliterate = listOf("name", "description"), ), ) @@ -5855,8 +9377,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings26() { - // >SEPARATOR setSettings customRanking boosted + suspend fun snippetForSetSettings94() { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5864,7 +9386,8 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(boosted)"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + removeStopWords = RemoveStopWords.of(true), ), ) @@ -5876,8 +9399,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings27() { - // >SEPARATOR setSettings customRanking pageviews + suspend fun snippetForSetSettings95() { + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5885,7 +9408,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(pageviews)", "desc(comments)"), + camelCaseAttributes = listOf("description"), ), ) @@ -5897,8 +9420,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings28() { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + suspend fun snippetForSetSettings96() { + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5906,8 +9429,16 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(nb_airline_liaisons)"), - attributesForFaceting = listOf("city, country"), + decompoundedAttributes = buildJsonObject { + put( + "de", + JsonArray( + listOf( + JsonPrimitive("name"), + ), + ), + ) + }, ), ) @@ -5919,8 +9450,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings29() { - // >SEPARATOR setSettings customRanking rounded pageviews + suspend fun snippetForSetSettings97() { + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5928,7 +9459,26 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(rounded_pageviews)", "desc(comments)"), + decompoundedAttributes = buildJsonObject { + put( + "de", + JsonArray( + listOf( + JsonPrimitive("name_de"), + JsonPrimitive("description_de"), + ), + ), + ) + put( + "fi", + JsonArray( + listOf( + JsonPrimitive("name_fi"), + JsonPrimitive("description_fi"), + ), + ), + ) + }, ), ) @@ -5940,8 +9490,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings30() { - // >SEPARATOR setSettings customRanking price + suspend fun snippetForSetSettings98() { + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5949,7 +9499,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(price)"), + keepDiacriticsOnCharacters = "øé", ), ) @@ -5961,8 +9511,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings31() { - // >SEPARATOR setSettings ranking exhaustive + suspend fun snippetForSetSettings99() { + // >SEPARATOR setSettings set_custom_normalization // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5970,7 +9520,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + customNormalization = mapOf("default" to mapOf("ä" to "ae")), ), ) @@ -5982,8 +9532,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings32() { - // >SEPARATOR setSettings ranking standard replica + suspend fun snippetForSetSettings100() { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5991,7 +9541,9 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = listOf("desc(post_date_timestamp)"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + removeStopWords = RemoveStopWords.of(true), + ignorePlurals = IgnorePlurals.of(true), ), ) @@ -6003,8 +9555,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings33() { - // >SEPARATOR setSettings ranking virtual replica + suspend fun snippetForSetSettings101() { + // >SEPARATOR setSettings set_indexlanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6012,7 +9564,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("desc(post_date_timestamp)"), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }), ), ) @@ -6024,8 +9576,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings34() { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + suspend fun snippetForSetSettings102() { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6033,8 +9585,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("asc(textual_attribute)"), - ranking = listOf("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"), + decompoundQuery = true, ), ) @@ -6046,8 +9597,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings35() { - // >SEPARATOR setSettings relevancyStrictness + suspend fun snippetForSetSettings103() { + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6055,8 +9606,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = listOf("asc(textual_attribute)"), - relevancyStrictness = 0, + enableRules = true, ), ) @@ -6068,8 +9618,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings36() { - // >SEPARATOR setSettings create replica index + suspend fun snippetForSetSettings104() { + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6077,7 +9627,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = listOf("products_price_desc"), + enablePersonalization = true, ), ) @@ -6089,8 +9639,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings37() { - // >SEPARATOR setSettings create virtual replica index + suspend fun snippetForSetSettings105() { + // >SEPARATOR setSettings set_default_query_type // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6098,7 +9648,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = listOf("virtual(products_price_desc)"), + queryType = QueryType.entries.first { it.value == "prefixLast" }, ), ) @@ -6110,8 +9660,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings38() { - // >SEPARATOR setSettings unlink replica index + suspend fun snippetForSetSettings106() { + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6119,7 +9669,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = listOf(""), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "none" }, ), ) @@ -6131,8 +9681,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings39() { - // >SEPARATOR setSettings forwardToReplicas + suspend fun snippetForSetSettings107() { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6140,9 +9690,8 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "description"), + advancedSyntax = true, ), - forwardToReplicas = true, ) // >LOG @@ -6153,8 +9702,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings40() { - // >SEPARATOR setSettings maxValuesPerFacet + suspend fun snippetForSetSettings108() { + // >SEPARATOR setSettings set_default_optional_words // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6162,7 +9711,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - maxValuesPerFacet = 1000, + optionalWords = OptionalWords.of(listOf("blue", "iphone case")), ), ) @@ -6174,8 +9723,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings41() { - // >SEPARATOR setSettings maxFacetHits + suspend fun snippetForSetSettings109() { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6183,7 +9732,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - maxFacetHits = 1000, + disablePrefixOnAttributes = listOf("sku"), ), ) @@ -6195,8 +9744,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings42() { - // >SEPARATOR setSettings attributesForFaceting complex + suspend fun snippetForSetSettings110() { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6204,7 +9753,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = listOf("actor", "filterOnly(category)", "searchable(publisher)"), + disableExactOnAttributes = listOf("description"), ), ) @@ -6216,8 +9765,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings43() { - // >SEPARATOR setSettings ranking closest dates + suspend fun snippetForSetSettings111() { + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6225,7 +9774,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = listOf("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, ), ) @@ -6237,8 +9786,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings44() { - // >SEPARATOR setSettings searchableAttributes item variation + suspend fun snippetForSetSettings112() { + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6246,7 +9795,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("design", "type", "color"), + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "ignorePlurals" }, AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), ), ) @@ -6258,8 +9807,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings45() { - // >SEPARATOR setSettings searchableAttributes around location + suspend fun snippetForSetSettings113() { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6267,8 +9816,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "country", "code", "iata_code"), - customRanking = listOf("desc(links_count)"), + advancedSyntax = true, ), ) @@ -6280,8 +9828,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings46() { - // >SEPARATOR setSettings searchableAttributes around location + suspend fun snippetForSetSettings114() { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6289,8 +9837,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "country", "code", "iata_code"), - customRanking = listOf("desc(links_count)"), + numericAttributesForFiltering = listOf("quantity", "popularity"), ), ) @@ -6302,8 +9849,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings47() { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + suspend fun snippetForSetSettings115() { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6311,7 +9858,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = listOf("serial_number"), + allowCompressionOfIntegerArray = true, ), ) @@ -6323,8 +9870,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings48() { - // >SEPARATOR setSettings everything + suspend fun snippetForSetSettings116() { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6332,91 +9879,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - advancedSyntax = true, - advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), - allowCompressionOfIntegerArray = true, - allowTyposOnNumericTokens = true, - alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), - attributeCriteriaComputedByMinProximity = true, - attributeForDistinct = "test", - attributesForFaceting = listOf("algolia"), - attributesToHighlight = listOf("algolia"), - attributesToRetrieve = listOf("algolia"), - attributesToSnippet = listOf("algolia"), - attributesToTransliterate = listOf("algolia"), - camelCaseAttributes = listOf("algolia"), - customNormalization = mapOf("algolia" to mapOf("aloglia" to "aglolia")), - customRanking = listOf("algolia"), - decompoundQuery = false, - decompoundedAttributes = buildJsonObject { - put( - "algolia", - JsonPrimitive("aloglia"), - ) - }, - disableExactOnAttributes = listOf("algolia"), - disablePrefixOnAttributes = listOf("algolia"), - disableTypoToleranceOnAttributes = listOf("algolia"), - disableTypoToleranceOnWords = listOf("algolia"), - distinct = Distinct.of(3), - enablePersonalization = true, - enableReRanking = false, - enableRules = true, - exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, - highlightPreTag = "", - highlightPostTag = "", - hitsPerPage = 10, - ignorePlurals = IgnorePlurals.of(false), - indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), - keepDiacriticsOnCharacters = "abc", - maxFacetHits = 20, - maxValuesPerFacet = 30, - minProximity = 6, - minWordSizefor1Typo = 5, - minWordSizefor2Typos = 11, - mode = Mode.entries.first { it.value == "neuralSearch" }, - numericAttributesForFiltering = listOf("algolia"), - optionalWords = OptionalWords.of(listOf("myspace")), - paginationLimitedTo = 0, - queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), - queryType = QueryType.entries.first { it.value == "prefixLast" }, - ranking = listOf("geo"), - reRankingApplyFilter = ReRankingApplyFilter.of("mySearch:filters"), - relevancyStrictness = 10, - removeStopWords = RemoveStopWords.of(false), - removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, - renderingContent = RenderingContent( - facetOrdering = FacetOrdering( - facets = Facets( - order = listOf("a", "b"), - ), - values = mapOf( - "a" to Value( - order = listOf("b"), - sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, - ), - ), - ), - ), - replaceSynonymsInHighlight = true, - replicas = listOf(""), - responseFields = listOf("algolia"), - restrictHighlightAndSnippetArrays = true, - searchableAttributes = listOf("foo"), - semanticSearch = SemanticSearch( - eventSources = listOf("foo"), - ), - separatorsToIndex = "bar", - snippetEllipsisText = "---", - sortFacetValuesBy = "date", - typoTolerance = TypoTolerance.of(false), - unretrievableAttributes = listOf("foo"), - userData = buildJsonObject { - put( - "user", - JsonPrimitive("data"), - ) - }, + attributeForDistinct = "url", ), ) @@ -6428,8 +9891,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings49() { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + suspend fun snippetForSetSettings117() { + // >SEPARATOR setSettings set_distinct // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6437,9 +9900,8 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("brand", "name", "categories", "unordered(description)"), - customRanking = listOf("desc(popularity)"), - attributesForFaceting = listOf("searchable(brand)", "type", "categories", "price"), + distinct = Distinct.of(1), + attributeForDistinct = "url", ), ) @@ -6451,8 +9913,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings50() { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + suspend fun snippetForSetSettings118() { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6460,7 +9922,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "product_reference", "product_reference_suffixes"), + replaceSynonymsInHighlight = false, ), ) @@ -6472,8 +9934,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings51() { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + suspend fun snippetForSetSettings119() { + // >SEPARATOR setSettings set_min_proximity // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6481,8 +9943,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "en" }), - ignorePlurals = IgnorePlurals.of(true), + minProximity = 1, ), ) @@ -6494,8 +9955,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings52() { - // >SEPARATOR setSettings searchableAttributesInMovies + suspend fun snippetForSetSettings120() { + // >SEPARATOR setSettings set_default_field // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6503,7 +9964,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("title_eng", "title_fr", "title_es"), + responseFields = listOf("hits", "hitsPerPage", "nbPages", "page"), ), ) @@ -6515,8 +9976,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings53() { - // >SEPARATOR setSettings disablePrefixOnAttributes + suspend fun snippetForSetSettings121() { + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6524,7 +9985,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disablePrefixOnAttributes = listOf("serial_number"), + maxFacetHits = 10, ), ) @@ -6536,8 +9997,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings54() { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + suspend fun snippetForSetSettings122() { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6545,7 +10006,7 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = listOf("serial_number"), + attributeCriteriaComputedByMinProximity = true, ), ) @@ -6557,8 +10018,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings55() { - // >SEPARATOR setSettings searchableAttributesSimpleExample + suspend fun snippetForSetSettings123() { + // >SEPARATOR setSettings set_user_data // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6566,7 +10027,12 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("serial_number"), + userData = buildJsonObject { + put( + "extraData", + JsonPrimitive("This is the custom data that you want to store in your index"), + ) + }, ), ) @@ -6578,8 +10044,8 @@ class SnippetSearchClient { exitProcess(0) } - suspend fun snippetForSetSettings56() { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + suspend fun snippetForSetSettings124() { + // >SEPARATOR setSettings set_rendering_content // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6587,7 +10053,24 @@ class SnippetSearchClient { var response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = listOf("serial_number", "serial_number_suffixes"), + renderingContent = RenderingContent( + facetOrdering = FacetOrdering( + facets = Facets( + order = listOf("size", "brand"), + ), + values = mapOf( + "brand" to Value( + order = listOf("uniqlo"), + hide = listOf("muji"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, + ), + "size" to Value( + order = listOf("S", "M", "L"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "hidden" }, + ), + ), + ), + ), ), ) diff --git a/docs/snippets/php/src/Search.php b/docs/snippets/php/src/Search.php index 6996115aeb..a8df9b07f2 100644 --- a/docs/snippets/php/src/Search.php +++ b/docs/snippets/php/src/Search.php @@ -5086,9 +5086,129 @@ public function snippetForSearchSingleIndex13(): void /** * Snippet for the SearchSingleIndex method. * - * facetFiltersNeg + * facetFiltersBook */ public function snippetForSearchSingleIndex14(): void + { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'facetFilters' => [ + 'category:Book', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * facetFiltersAND + */ + public function snippetForSearchSingleIndex15(): void + { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'facetFilters' => [ + 'category:Book', + + 'author:John Doe', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * facetFiltersOR + */ + public function snippetForSearchSingleIndex16(): void + { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'facetFilters' => [ + [ + 'category:Book', + + 'author:John Doe', + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * facetFiltersCombined + */ + public function snippetForSearchSingleIndex17(): void + { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'facetFilters' => [ + 'author:John Doe', + + [ + 'category:Book', + + 'category:Movie', + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * facetFiltersNeg + */ + public function snippetForSearchSingleIndex18(): void { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client @@ -5112,7 +5232,7 @@ public function snippetForSearchSingleIndex14(): void * * filtersAndFacetFilters */ - public function snippetForSearchSingleIndex15(): void + public function snippetForSearchSingleIndex19(): void { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client @@ -5139,7 +5259,7 @@ public function snippetForSearchSingleIndex15(): void * * facet author genre */ - public function snippetForSearchSingleIndex16(): void + public function snippetForSearchSingleIndex20(): void { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client @@ -5167,7 +5287,7 @@ public function snippetForSearchSingleIndex16(): void * * facet wildcard */ - public function snippetForSearchSingleIndex17(): void + public function snippetForSearchSingleIndex21(): void { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client @@ -5193,7 +5313,7 @@ public function snippetForSearchSingleIndex17(): void * * maxValuesPerFacet */ - public function snippetForSearchSingleIndex18(): void + public function snippetForSearchSingleIndex22(): void { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client @@ -5217,7 +5337,7 @@ public function snippetForSearchSingleIndex18(): void * * aroundLatLng */ - public function snippetForSearchSingleIndex19(): void + public function snippetForSearchSingleIndex23(): void { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client @@ -5241,7 +5361,7 @@ public function snippetForSearchSingleIndex19(): void * * aroundLatLngViaIP */ - public function snippetForSearchSingleIndex20(): void + public function snippetForSearchSingleIndex24(): void { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client @@ -5265,7 +5385,7 @@ public function snippetForSearchSingleIndex20(): void * * aroundRadius */ - public function snippetForSearchSingleIndex21(): void + public function snippetForSearchSingleIndex25(): void { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client @@ -5290,7 +5410,7 @@ public function snippetForSearchSingleIndex21(): void * * insideBoundingBox */ - public function snippetForSearchSingleIndex22(): void + public function snippetForSearchSingleIndex26(): void { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client @@ -5324,7 +5444,7 @@ public function snippetForSearchSingleIndex22(): void * * insidePolygon */ - public function snippetForSearchSingleIndex23(): void + public function snippetForSearchSingleIndex27(): void { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client @@ -5374,7 +5494,7 @@ public function snippetForSearchSingleIndex23(): void * * insidePolygon */ - public function snippetForSearchSingleIndex24(): void + public function snippetForSearchSingleIndex28(): void { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client @@ -5424,7 +5544,7 @@ public function snippetForSearchSingleIndex24(): void * * optionalFilters */ - public function snippetForSearchSingleIndex25(): void + public function snippetForSearchSingleIndex29(): void { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client @@ -5450,7 +5570,7 @@ public function snippetForSearchSingleIndex25(): void * * optionalFiltersMany */ - public function snippetForSearchSingleIndex26(): void + public function snippetForSearchSingleIndex30(): void { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client @@ -5480,7 +5600,7 @@ public function snippetForSearchSingleIndex26(): void * * optionalFiltersSimple */ - public function snippetForSearchSingleIndex27(): void + public function snippetForSearchSingleIndex31(): void { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client @@ -5508,7 +5628,7 @@ public function snippetForSearchSingleIndex27(): void * * restrictSearchableAttributes */ - public function snippetForSearchSingleIndex28(): void + public function snippetForSearchSingleIndex32(): void { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client @@ -5534,7 +5654,7 @@ public function snippetForSearchSingleIndex28(): void * * getRankingInfo */ - public function snippetForSearchSingleIndex29(): void + public function snippetForSearchSingleIndex33(): void { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client @@ -5558,7 +5678,7 @@ public function snippetForSearchSingleIndex29(): void * * clickAnalytics */ - public function snippetForSearchSingleIndex30(): void + public function snippetForSearchSingleIndex34(): void { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client @@ -5582,7 +5702,7 @@ public function snippetForSearchSingleIndex30(): void * * clickAnalyticsUserToken */ - public function snippetForSearchSingleIndex31(): void + public function snippetForSearchSingleIndex35(): void { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client @@ -5607,7 +5727,7 @@ public function snippetForSearchSingleIndex31(): void * * enablePersonalization */ - public function snippetForSearchSingleIndex32(): void + public function snippetForSearchSingleIndex36(): void { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client @@ -5632,7 +5752,7 @@ public function snippetForSearchSingleIndex32(): void * * userToken */ - public function snippetForSearchSingleIndex33(): void + public function snippetForSearchSingleIndex37(): void { // >SEPARATOR searchSingleIndex userToken // Initialize the client @@ -5651,12 +5771,37 @@ public function snippetForSearchSingleIndex33(): void // SEPARATOR< } + /** + * Snippet for the SearchSingleIndex method. + * + * userToken1234 + */ + public function snippetForSearchSingleIndex38(): void + { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'userToken' => 'user-1234', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + /** * Snippet for the SearchSingleIndex method. * * analyticsTag */ - public function snippetForSearchSingleIndex34(): void + public function snippetForSearchSingleIndex39(): void { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client @@ -5682,7 +5827,7 @@ public function snippetForSearchSingleIndex34(): void * * facetFiltersUsers */ - public function snippetForSearchSingleIndex35(): void + public function snippetForSearchSingleIndex40(): void { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client @@ -5710,7 +5855,7 @@ public function snippetForSearchSingleIndex35(): void * * buildTheQuery */ - public function snippetForSearchSingleIndex36(): void + public function snippetForSearchSingleIndex41(): void { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client @@ -5734,19 +5879,26 @@ public function snippetForSearchSingleIndex36(): void } /** - * Snippet for the SearchSynonyms method. + * Snippet for the SearchSingleIndex method. * - * searchSynonyms with minimal parameters + * attributesToHighlightOverride */ - public function snippetForSearchSynonyms(): void + public function snippetForSearchSingleIndex42(): void { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->searchSynonyms( + $response = $client->searchSingleIndex( '', + ['query' => 'query', + 'attributesToHighlight' => [ + 'title', + + 'content', + ], + ], ); // >LOG @@ -5756,23 +5908,23 @@ public function snippetForSearchSynonyms(): void } /** - * Snippet for the SearchSynonyms method. + * Snippet for the SearchSingleIndex method. * - * searchSynonyms with all parameters + * disableTypoToleranceOnAttributes */ - public function snippetForSearchSynonyms1(): void + public function snippetForSearchSingleIndex43(): void { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->searchSynonyms( + $response = $client->searchSingleIndex( '', - ['query' => 'myQuery', - 'type' => 'altcorrection1', - 'page' => 10, - 'hitsPerPage' => 10, + ['query' => 'query', + 'disableTypoToleranceOnAttributes' => [ + 'serial_number', + ], ], ); @@ -5783,22 +5935,20 @@ public function snippetForSearchSynonyms1(): void } /** - * Snippet for the SearchUserIds method. + * Snippet for the SearchSingleIndex method. * - * searchUserIds + * search_a_query */ - public function snippetForSearchUserIds(): void + public function snippetForSearchSingleIndex44(): void { - // >SEPARATOR searchUserIds default + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->searchUserIds( - ['query' => 'test', - 'clusterName' => 'theClusterName', - 'page' => 5, - 'hitsPerPage' => 10, + $response = $client->searchSingleIndex( + '', + ['query' => 'shirt', ], ); @@ -5809,43 +5959,45 @@ public function snippetForSearchUserIds(): void } /** - * Snippet for the SetClientApiKey method. + * Snippet for the SearchSingleIndex method. * - * switch API key + * search_everything */ - public function snippetForSetClientApiKey(): void + public function snippetForSearchSingleIndex45(): void { - // >SEPARATOR setClientApiKey default + // >SEPARATOR searchSingleIndex search_everything // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $client->setClientApiKey( - 'updated-api-key', + $response = $client->searchSingleIndex( + '', + ['query' => '', + ], ); // >LOG + // play with the response + var_dump($response); // SEPARATOR< } /** - * Snippet for the SetDictionarySettings method. + * Snippet for the SearchSingleIndex method. * - * get setDictionarySettings results with minimal parameters + * api_filtering_range_example */ - public function snippetForSetDictionarySettings(): void + public function snippetForSearchSingleIndex46(): void { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setDictionarySettings( - ['disableStandardEntries' => ['plurals' => ['fr' => false, - 'en' => false, - 'ru' => true, - ], - ], + $response = $client->searchSingleIndex( + '', + ['query' => 'books', + 'filters' => 'price:10 TO 20', ], ); @@ -5856,27 +6008,22 @@ public function snippetForSetDictionarySettings(): void } /** - * Snippet for the SetDictionarySettings method. + * Snippet for the SearchSingleIndex method. * - * get setDictionarySettings results with all parameters + * search_a_query */ - public function snippetForSetDictionarySettings1(): void + public function snippetForSearchSingleIndex47(): void { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setDictionarySettings( - ['disableStandardEntries' => ['plurals' => ['fr' => false, - 'en' => false, - 'ru' => true, - ], - 'stopwords' => ['fr' => false, - ], - 'compounds' => ['ru' => true, - ], - ], + $response = $client->searchSingleIndex( + '', + ['query' => '', + 'similarQuery' => 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen', + 'filters' => 'year:1991 TO 2001', ], ); @@ -5887,22 +6034,26 @@ public function snippetForSetDictionarySettings1(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * minimal parameters + * override_retrievable_attributes */ - public function snippetForSetSettings(): void + public function snippetForSearchSingleIndex48(): void { - // >SEPARATOR setSettings minimal parameters + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['paginationLimitedTo' => 10, + ['query' => 'query', + 'attributesToRetrieve' => [ + 'title', + + 'content', + ], ], - true, ); // >LOG @@ -5912,22 +6063,26 @@ public function snippetForSetSettings(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * boolean typoTolerance + * restrict_searchable_attributes */ - public function snippetForSetSettings1(): void + public function snippetForSearchSingleIndex49(): void { - // >SEPARATOR setSettings boolean typoTolerance + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['typoTolerance' => true, + ['query' => 'query', + 'restrictSearchableAttributes' => [ + 'title', + + 'author', + ], ], - true, ); // >LOG @@ -5937,22 +6092,22 @@ public function snippetForSetSettings1(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * enum typoTolerance + * override_default_relevancy */ - public function snippetForSetSettings2(): void + public function snippetForSearchSingleIndex50(): void { - // >SEPARATOR setSettings enum typoTolerance + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['typoTolerance' => 'min', + ['query' => 'query', + 'relevancyStrictness' => 70, ], - true, ); // >LOG @@ -5962,22 +6117,22 @@ public function snippetForSetSettings2(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * ignorePlurals + * apply_filters */ - public function snippetForSetSettings3(): void + public function snippetForSearchSingleIndex51(): void { - // >SEPARATOR setSettings ignorePlurals + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['ignorePlurals' => true, + ['query' => 'query', + 'filters' => '(category:Book OR category:Ebook) AND _tags:published', ], - true, ); // >LOG @@ -5987,24 +6142,22 @@ public function snippetForSetSettings3(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * list of string ignorePlurals + * apply_all_filters */ - public function snippetForSetSettings4(): void + public function snippetForSearchSingleIndex52(): void { - // >SEPARATOR setSettings list of string ignorePlurals + // >SEPARATOR searchSingleIndex apply_all_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['ignorePlurals' => [ - 'fr', + ['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"', ], - ], - true, ); // >LOG @@ -6014,22 +6167,22 @@ public function snippetForSetSettings4(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * removeStopWords boolean + * escape_spaces */ - public function snippetForSetSettings5(): void + public function snippetForSearchSingleIndex53(): void { - // >SEPARATOR setSettings removeStopWords boolean + // >SEPARATOR searchSingleIndex escape_spaces // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['removeStopWords' => true, + ['query' => 'query', + 'filters' => 'category:"Books and Comics"', ], - true, ); // >LOG @@ -6039,24 +6192,22 @@ public function snippetForSetSettings5(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * removeStopWords list of string + * escape_keywords */ - public function snippetForSetSettings6(): void + public function snippetForSearchSingleIndex54(): void { - // >SEPARATOR setSettings removeStopWords list of string + // >SEPARATOR searchSingleIndex escape_keywords // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['removeStopWords' => [ - 'fr', + ['query' => 'query', + 'filters' => 'keyword:"OR"', ], - ], - true, ); // >LOG @@ -6066,22 +6217,22 @@ public function snippetForSetSettings6(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * boolean distinct + * escape_single_quotes */ - public function snippetForSetSettings7(): void + public function snippetForSearchSingleIndex55(): void { - // >SEPARATOR setSettings boolean distinct + // >SEPARATOR searchSingleIndex escape_single_quotes // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['distinct' => true, + ['query' => 'query', + 'filters' => "content:\"It's a wonderful day\"", ], - true, ); // >LOG @@ -6091,22 +6242,22 @@ public function snippetForSetSettings7(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * integer distinct + * escape_double_quotes */ - public function snippetForSetSettings8(): void + public function snippetForSearchSingleIndex56(): void { - // >SEPARATOR setSettings integer distinct + // >SEPARATOR searchSingleIndex escape_double_quotes // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['distinct' => 1, + ['query' => 'query', + 'filters' => 'content:"She said "Hello World"', ], - true, ); // >LOG @@ -6116,21 +6267,25 @@ public function snippetForSetSettings8(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * distinct company + * apply_filters */ - public function snippetForSetSettings9(): void + public function snippetForSearchSingleIndex57(): void { - // >SEPARATOR setSettings distinct company + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributeForDistinct' => 'company', - 'distinct' => true, + ['query' => 'query', + 'optionalFilters' => [ + 'category:Book', + + 'author:John Doe', + ], ], ); @@ -6141,21 +6296,25 @@ public function snippetForSetSettings9(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * distinct design + * apply_negative_filters */ - public function snippetForSetSettings10(): void + public function snippetForSearchSingleIndex58(): void { - // >SEPARATOR setSettings distinct design + // >SEPARATOR searchSingleIndex apply_negative_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributeForDistinct' => 'design', - 'distinct' => true, + ['query' => 'query', + 'optionalFilters' => [ + 'category:Book', + + 'author:-John Doe', + ], ], ); @@ -6166,20 +6325,29 @@ public function snippetForSetSettings10(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * distinct true + * apply_numeric_filters */ - public function snippetForSetSettings11(): void + public function snippetForSearchSingleIndex59(): void { - // >SEPARATOR setSettings distinct true + // >SEPARATOR searchSingleIndex apply_numeric_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['distinct' => true, + ['query' => 'query', + 'numericFilters' => [ + 'price < 1000', + + [ + 'inStock = 1', + + 'deliveryDate < 1441755506', + ], + ], ], ); @@ -6190,21 +6358,29 @@ public function snippetForSetSettings11(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * distinct section + * apply_tag_filters */ - public function snippetForSetSettings12(): void + public function snippetForSearchSingleIndex60(): void { - // >SEPARATOR setSettings distinct section + // >SEPARATOR searchSingleIndex apply_tag_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributeForDistinct' => 'section', - 'distinct' => true, + ['query' => 'query', + 'tagFilters' => [ + 'SciFi', + + [ + 'Book', + + 'Movie', + ], + ], ], ); @@ -6215,22 +6391,21 @@ public function snippetForSetSettings12(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting allergens + * apply_filters */ - public function snippetForSetSettings13(): void + public function snippetForSearchSingleIndex61(): void { - // >SEPARATOR setSettings attributesForFaceting allergens + // >SEPARATOR searchSingleIndex apply_filters // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'allergens', - ], + ['query' => 'query', + 'sumOrFiltersScores' => true, ], ); @@ -6241,22 +6416,23 @@ public function snippetForSetSettings13(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting categoryPageId + * facets_all */ - public function snippetForSetSettings14(): void + public function snippetForSearchSingleIndex62(): void { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + // >SEPARATOR searchSingleIndex facets_all // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'searchable(categoryPageId)', - ], + ['query' => 'query', + 'facets' => [ + '*', + ], ], ); @@ -6267,22 +6443,25 @@ public function snippetForSetSettings14(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * unretrievableAttributes + * retrieve_only_some_facets */ - public function snippetForSetSettings15(): void + public function snippetForSearchSingleIndex63(): void { - // >SEPARATOR setSettings unretrievableAttributes + // >SEPARATOR searchSingleIndex retrieve_only_some_facets // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['unretrievableAttributes' => [ - 'visible_by', - ], + ['query' => 'query', + 'facets' => [ + 'category', + + 'author', + ], ], ); @@ -6293,22 +6472,21 @@ public function snippetForSetSettings15(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting user restricted data + * override_default_max_values_per_facet */ - public function snippetForSetSettings16(): void + public function snippetForSearchSingleIndex64(): void { - // >SEPARATOR setSettings attributesForFaceting user restricted data + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'filterOnly(visible_by)', - ], + ['query' => 'query', + 'maxValuesPerFacet' => 20, ], ); @@ -6319,24 +6497,21 @@ public function snippetForSetSettings16(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting optional filters + * enable_faceting_after_distinct */ - public function snippetForSetSettings17(): void + public function snippetForSearchSingleIndex65(): void { - // >SEPARATOR setSettings attributesForFaceting optional filters + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'can_deliver_quickly', - - 'restaurant', - ], + ['query' => 'query', + 'facetingAfterDistinct' => true, ], ); @@ -6347,22 +6522,21 @@ public function snippetForSetSettings17(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting redirect index + * sort_facet_values_alphabetically */ - public function snippetForSetSettings18(): void + public function snippetForSearchSingleIndex66(): void { - // >SEPARATOR setSettings attributesForFaceting redirect index + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'query_terms', - ], + ['query' => 'query', + 'sortFacetValuesBy' => 'count', ], ); @@ -6373,22 +6547,25 @@ public function snippetForSetSettings18(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting multiple consequences + * override_attributes_to_snippet */ - public function snippetForSetSettings19(): void + public function snippetForSearchSingleIndex67(): void { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + // >SEPARATOR searchSingleIndex override_attributes_to_snippet // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'director', - ], + ['query' => 'query', + 'attributesToSnippet' => [ + 'title', + + 'content:80', + ], ], ); @@ -6399,22 +6576,21 @@ public function snippetForSetSettings19(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting in-depth optional filters + * override_default_highlight_pre_tag */ - public function snippetForSetSettings20(): void + public function snippetForSearchSingleIndex68(): void { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'filterOnly(brand)', - ], + ['query' => 'query', + 'highlightPreTag' => '', ], ); @@ -6425,20 +6601,21 @@ public function snippetForSetSettings20(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * mode neuralSearch + * override_default_highlight_post_tag */ - public function snippetForSetSettings21(): void + public function snippetForSearchSingleIndex69(): void { - // >SEPARATOR setSettings mode neuralSearch + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['mode' => 'neuralSearch', + ['query' => 'query', + 'highlightPostTag' => '', ], ); @@ -6449,20 +6626,21 @@ public function snippetForSetSettings21(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * mode keywordSearch + * override_default_snippet_ellipsis_text */ - public function snippetForSetSettings22(): void + public function snippetForSearchSingleIndex70(): void { - // >SEPARATOR setSettings mode keywordSearch + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['mode' => 'keywordSearch', + ['query' => 'query', + 'snippetEllipsisText' => '', ], ); @@ -6473,24 +6651,21 @@ public function snippetForSetSettings22(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * searchableAttributes same priority + * enable_restrict_highlight_and_snippet_arrays */ - public function snippetForSetSettings23(): void + public function snippetForSearchSingleIndex71(): void { - // >SEPARATOR setSettings searchableAttributes same priority + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['searchableAttributes' => [ - 'title,comments', - - 'ingredients', - ], + ['query' => 'query', + 'restrictHighlightAndSnippetArrays' => false, ], ); @@ -6501,24 +6676,21 @@ public function snippetForSetSettings23(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * searchableAttributes higher priority + * access_page */ - public function snippetForSetSettings24(): void + public function snippetForSearchSingleIndex72(): void { - // >SEPARATOR setSettings searchableAttributes higher priority + // >SEPARATOR searchSingleIndex access_page // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['searchableAttributes' => [ - 'title', - - 'ingredients', - ], + ['query' => 'query', + 'page' => 0, ], ); @@ -6529,24 +6701,21 @@ public function snippetForSetSettings24(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking retweets + * override_default_hits_per_page */ - public function snippetForSetSettings25(): void + public function snippetForSearchSingleIndex73(): void { - // >SEPARATOR setSettings customRanking retweets + // >SEPARATOR searchSingleIndex override_default_hits_per_page // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(retweets)', - - 'desc(likes)', - ], + ['query' => 'query', + 'hitsPerPage' => 10, ], ); @@ -6557,22 +6726,21 @@ public function snippetForSetSettings25(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking boosted + * get_nth_hit */ - public function snippetForSetSettings26(): void + public function snippetForSearchSingleIndex74(): void { - // >SEPARATOR setSettings customRanking boosted + // >SEPARATOR searchSingleIndex get_nth_hit // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(boosted)', - ], + ['query' => 'query', + 'offset' => 4, ], ); @@ -6583,24 +6751,21 @@ public function snippetForSetSettings26(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking pageviews + * get_n_results */ - public function snippetForSetSettings27(): void + public function snippetForSearchSingleIndex75(): void { - // >SEPARATOR setSettings customRanking pageviews + // >SEPARATOR searchSingleIndex get_n_results // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(pageviews)', - - 'desc(comments)', - ], + ['query' => 'query', + 'length' => 4, ], ); @@ -6611,25 +6776,21 @@ public function snippetForSetSettings27(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking applying search parameters for a specific query + * override_default_min_word_size_for_one_typo */ - public function snippetForSetSettings28(): void + public function snippetForSearchSingleIndex76(): void { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(nb_airline_liaisons)', - ], - 'attributesForFaceting' => [ - 'city, country', - ], + ['query' => 'query', + 'minWordSizefor1Typo' => 2, ], ); @@ -6640,24 +6801,21 @@ public function snippetForSetSettings28(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking rounded pageviews + * override_default_min_word_size_for_two_typos */ - public function snippetForSetSettings29(): void + public function snippetForSearchSingleIndex77(): void { - // >SEPARATOR setSettings customRanking rounded pageviews + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(rounded_pageviews)', - - 'desc(comments)', - ], + ['query' => 'query', + 'minWordSizefor2Typos' => 2, ], ); @@ -6668,22 +6826,21 @@ public function snippetForSetSettings29(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking price + * override_default_typo_tolerance_mode */ - public function snippetForSetSettings30(): void + public function snippetForSearchSingleIndex78(): void { - // >SEPARATOR setSettings customRanking price + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(price)', - ], + ['query' => 'query', + 'typoTolerance' => false, ], ); @@ -6694,38 +6851,21 @@ public function snippetForSetSettings30(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * ranking exhaustive + * disable_typos_on_numeric_tokens_at_search_time */ - public function snippetForSetSettings31(): void + public function snippetForSearchSingleIndex79(): void { - // >SEPARATOR setSettings ranking exhaustive + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['ranking' => [ - 'desc(price)', - - 'typo', - - 'geo', - - 'words', - - 'filters', - - 'proximity', - - 'attribute', - - 'exact', - - 'custom', - ], + ['query' => 'query', + 'allowTyposOnNumericTokens' => false, ], ); @@ -6736,22 +6876,21 @@ public function snippetForSetSettings31(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * ranking standard replica + * search_around_a_position */ - public function snippetForSetSettings32(): void + public function snippetForSearchSingleIndex80(): void { - // >SEPARATOR setSettings ranking standard replica + // >SEPARATOR searchSingleIndex search_around_a_position // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['ranking' => [ - 'desc(post_date_timestamp)', - ], + ['query' => 'query', + 'aroundLatLng' => '40.71, -74.01', ], ); @@ -6762,23 +6901,27 @@ public function snippetForSetSettings32(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * ranking virtual replica + * search_around_server_ip */ - public function snippetForSetSettings33(): void + public function snippetForSearchSingleIndex81(): void { - // >SEPARATOR setSettings ranking virtual replica + // >SEPARATOR searchSingleIndex search_around_server_ip // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'desc(post_date_timestamp)', - ], + ['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', + ], + ] ); // >LOG @@ -6788,39 +6931,21 @@ public function snippetForSetSettings33(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * customRanking and ranking sort alphabetically + * set_around_radius */ - public function snippetForSetSettings34(): void + public function snippetForSearchSingleIndex82(): void { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // >SEPARATOR searchSingleIndex set_around_radius // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'asc(textual_attribute)', - ], - 'ranking' => [ - 'custom', - - 'typo', - - 'geo', - - 'words', - - 'filters', - - 'proximity', - - 'attribute', - - 'exact', - ], + ['query' => 'query', + 'aroundRadius' => 1000, ], ); @@ -6831,23 +6956,21 @@ public function snippetForSetSettings34(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * relevancyStrictness + * disable_automatic_radius */ - public function snippetForSetSettings35(): void + public function snippetForSearchSingleIndex83(): void { - // >SEPARATOR setSettings relevancyStrictness + // >SEPARATOR searchSingleIndex disable_automatic_radius // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['customRanking' => [ - 'asc(textual_attribute)', - ], - 'relevancyStrictness' => 0, + ['query' => 'query', + 'aroundRadius' => 'all', ], ); @@ -6858,22 +6981,21 @@ public function snippetForSetSettings35(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * create replica index + * set_geo_search_precision */ - public function snippetForSetSettings36(): void + public function snippetForSearchSingleIndex84(): void { - // >SEPARATOR setSettings create replica index + // >SEPARATOR searchSingleIndex set_geo_search_precision // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['replicas' => [ - 'products_price_desc', - ], + ['query' => 'query', + 'aroundPrecision' => 100, ], ); @@ -6884,22 +7006,29 @@ public function snippetForSetSettings36(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * create virtual replica index + * set_geo_search_precision_non_linear */ - public function snippetForSetSettings37(): void + public function snippetForSearchSingleIndex85(): void { - // >SEPARATOR setSettings create virtual replica index + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['replicas' => [ - 'virtual(products_price_desc)', - ], + ['query' => 'query', + 'aroundPrecision' => [ + ['from' => 0, + 'value' => 25, + ], + + ['from' => 2000, + 'value' => 1000, + ], + ], ], ); @@ -6910,22 +7039,21 @@ public function snippetForSetSettings37(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * unlink replica index + * set_minimum_geo_search_radius */ - public function snippetForSetSettings38(): void + public function snippetForSearchSingleIndex86(): void { - // >SEPARATOR setSettings unlink replica index + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['replicas' => [ - '', - ], + ['query' => 'query', + 'minimumAroundRadius' => 1000, ], ); @@ -6936,26 +7064,32 @@ public function snippetForSetSettings38(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * forwardToReplicas + * search_inside_rectangular_area */ - public function snippetForSetSettings39(): void + public function snippetForSearchSingleIndex87(): void { - // >SEPARATOR setSettings forwardToReplicas + // >SEPARATOR searchSingleIndex search_inside_rectangular_area // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['searchableAttributes' => [ - 'name', + ['query' => 'query', + 'insideBoundingBox' => [ + [ + 46.650828100116044, - 'description', - ], + 7.123046875, + + 45.17210966999772, + + 1.009765625, + ], + ], ], - true, ); // >LOG @@ -6965,20 +7099,41 @@ public function snippetForSetSettings39(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * maxValuesPerFacet + * search_inside_multiple_rectangular_areas */ - public function snippetForSetSettings40(): void + public function snippetForSearchSingleIndex88(): void { - // >SEPARATOR setSettings maxValuesPerFacet + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['maxValuesPerFacet' => 1000, + ['query' => 'query', + 'insideBoundingBox' => [ + [ + 46.650828100116044, + + 7.123046875, + + 45.17210966999772, + + 1.009765625, + ], + + [ + 49.62625916704081, + + 4.6181640625, + + 47.715070300900194, + + 0.482421875, + ], + ], ], ); @@ -6989,20 +7144,35 @@ public function snippetForSetSettings40(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * maxFacetHits + * search_inside_polygon_area */ - public function snippetForSetSettings41(): void + public function snippetForSearchSingleIndex89(): void { - // >SEPARATOR setSettings maxFacetHits + // >SEPARATOR searchSingleIndex search_inside_polygon_area // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['maxFacetHits' => 1000, + ['query' => 'query', + 'insidePolygon' => [ + [ + 46.650828100116044, + + 7.123046875, + + 45.17210966999772, + + 1.009765625, + + 49.62625916704081, + + 4.6181640625, + ], + ], ], ); @@ -7013,31 +7183,4048 @@ public function snippetForSetSettings41(): void } /** - * Snippet for the SetSettings method. + * Snippet for the SearchSingleIndex method. * - * attributesForFaceting complex + * search_inside_multiple_polygon_areas */ - public function snippetForSetSettings42(): void + public function snippetForSearchSingleIndex90(): void { - // >SEPARATOR setSettings attributesForFaceting complex + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API - $response = $client->setSettings( + $response = $client->searchSingleIndex( '', - ['attributesForFaceting' => [ - 'actor', + ['query' => 'query', + 'insidePolygon' => [ + [ + 46.650828100116044, - 'filterOnly(category)', + 7.123046875, - 'searchable(publisher)', - ], - ], - ); + 45.17210966999772, - // >LOG - // play with the response + 1.009765625, + + 49.62625916704081, + + 4.6181640625, + ], + + [ + 49.62625916704081, + + 4.6181640625, + + 47.715070300900194, + + 0.482421875, + + 45.17210966999772, + + 1.009765625, + + 50.62626704081, + + 4.6181640625, + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_querylanguages_override + */ + public function snippetForSearchSingleIndex91(): void + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'ignorePlurals' => [ + 'ca', + + 'es', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_querylanguages_override + */ + public function snippetForSearchSingleIndex92(): void + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'removeStopWords' => [ + 'ca', + + 'es', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_querylanguages_override + */ + public function snippetForSearchSingleIndex93(): void + { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'removeStopWords' => [ + 'ca', + + 'es', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_querylanguages_with_japanese_query + */ + public function snippetForSearchSingleIndex94(): void + { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'queryLanguages' => [ + 'ja', + + 'en', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_natural_languages + */ + public function snippetForSearchSingleIndex95(): void + { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => '', + 'naturalLanguages' => [ + 'fr', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_natural_languages_with_query + */ + public function snippetForSearchSingleIndex96(): void + { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => '', + 'naturalLanguages' => [ + 'fr', + ], + 'removeWordsIfNoResults' => 'firstWords', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_decompound_query_search_time + */ + public function snippetForSearchSingleIndex97(): void + { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'decompoundQuery' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_rules_search_time + */ + public function snippetForSearchSingleIndex98(): void + { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enableRules' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_rule_contexts + */ + public function snippetForSearchSingleIndex99(): void + { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'ruleContexts' => [ + 'front_end', + + 'website2', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_personalization + */ + public function snippetForSearchSingleIndex100(): void + { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enablePersonalization' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_personalization_with_user_token + */ + public function snippetForSearchSingleIndex101(): void + { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enablePersonalization' => true, + 'userToken' => '123456', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * personalization_impact + */ + public function snippetForSearchSingleIndex102(): void + { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'personalizationImpact' => 20, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_user_token + */ + public function snippetForSearchSingleIndex103(): void + { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'userToken' => '123456', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_user_token_with_personalization + */ + public function snippetForSearchSingleIndex104(): void + { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enablePersonalization' => true, + 'userToken' => '123456', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_default_query_type + */ + public function snippetForSearchSingleIndex105(): void + { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'queryType' => 'prefixAll', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_default_remove_words_if_no_results + */ + public function snippetForSearchSingleIndex106(): void + { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'removeWordsIfNoResults' => 'lastWords', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_advanced_syntax_search_time + */ + public function snippetForSearchSingleIndex107(): void + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'advancedSyntax' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * overide_default_optional_words + */ + public function snippetForSearchSingleIndex108(): void + { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'optionalWords' => [ + 'toyota', + + '2020 2021', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * disabling_exact_for_some_attributes_search_time + */ + public function snippetForSearchSingleIndex109(): void + { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'disableExactOnAttributes' => [ + 'description', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_default_exact_single_word_query + */ + public function snippetForSearchSingleIndex110(): void + { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'exactOnSingleWordQuery' => 'none', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_default_aternative_as_exact + */ + public function snippetForSearchSingleIndex111(): void + { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'alternativesAsExact' => [ + 'multiWordsSynonym', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_advanced_syntax_exact_phrase + */ + public function snippetForSearchSingleIndex112(): void + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'exactPhrase', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_advanced_syntax_exclude_words + */ + public function snippetForSearchSingleIndex113(): void + { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'excludeWords', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_distinct + */ + public function snippetForSearchSingleIndex114(): void + { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'distinct' => 0, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * get_ranking_info + */ + public function snippetForSearchSingleIndex115(): void + { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'getRankingInfo' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * disable_click_analytics + */ + public function snippetForSearchSingleIndex116(): void + { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'clickAnalytics' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * enable_click_analytics + */ + public function snippetForSearchSingleIndex117(): void + { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'clickAnalytics' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * disable_analytics + */ + public function snippetForSearchSingleIndex118(): void + { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'analytics' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * add_analytics_tags + */ + public function snippetForSearchSingleIndex119(): void + { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'analyticsTags' => [ + 'front_end', + + 'website2', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * disable_synonyms + */ + public function snippetForSearchSingleIndex120(): void + { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'synonyms' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_replace_synonyms_in_highlights + */ + public function snippetForSearchSingleIndex121(): void + { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'replaceSynonymsInHighlight' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_min_proximity + */ + public function snippetForSearchSingleIndex122(): void + { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'minProximity' => 2, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_default_field + */ + public function snippetForSearchSingleIndex123(): void + { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'responseFields' => [ + 'hits', + + 'facets', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * override_percentile_computation + */ + public function snippetForSearchSingleIndex124(): void + { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'percentileComputation' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_ab_test + */ + public function snippetForSearchSingleIndex125(): void + { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enableABTest' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSingleIndex method. + * + * set_enable_re_ranking + */ + public function snippetForSearchSingleIndex126(): void + { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSingleIndex( + '', + ['query' => 'query', + 'enableReRanking' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSynonyms method. + * + * searchSynonyms with minimal parameters + */ + public function snippetForSearchSynonyms(): void + { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSynonyms( + '', + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchSynonyms method. + * + * searchSynonyms with all parameters + */ + public function snippetForSearchSynonyms1(): void + { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchSynonyms( + '', + ['query' => 'myQuery', + 'type' => 'altcorrection1', + 'page' => 10, + 'hitsPerPage' => 10, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SearchUserIds method. + * + * searchUserIds + */ + public function snippetForSearchUserIds(): void + { + // >SEPARATOR searchUserIds default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->searchUserIds( + ['query' => 'test', + 'clusterName' => 'theClusterName', + 'page' => 5, + 'hitsPerPage' => 10, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetClientApiKey method. + * + * switch API key + */ + public function snippetForSetClientApiKey(): void + { + // >SEPARATOR setClientApiKey default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $client->setClientApiKey( + 'updated-api-key', + ); + + // >LOG + // SEPARATOR< + } + + /** + * Snippet for the SetDictionarySettings method. + * + * get setDictionarySettings results with minimal parameters + */ + public function snippetForSetDictionarySettings(): void + { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setDictionarySettings( + ['disableStandardEntries' => ['plurals' => ['fr' => false, + 'en' => false, + 'ru' => true, + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetDictionarySettings method. + * + * get setDictionarySettings results with all parameters + */ + public function snippetForSetDictionarySettings1(): void + { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setDictionarySettings( + ['disableStandardEntries' => ['plurals' => ['fr' => false, + 'en' => false, + 'ru' => true, + ], + 'stopwords' => ['fr' => false, + ], + 'compounds' => ['ru' => true, + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * minimal parameters + */ + public function snippetForSetSettings(): void + { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['paginationLimitedTo' => 10, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * boolean typoTolerance + */ + public function snippetForSetSettings1(): void + { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['typoTolerance' => true, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * enum typoTolerance + */ + public function snippetForSetSettings2(): void + { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['typoTolerance' => 'min', + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * ignorePlurals + */ + public function snippetForSetSettings3(): void + { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ignorePlurals' => true, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * list of string ignorePlurals + */ + public function snippetForSetSettings4(): void + { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ignorePlurals' => [ + 'fr', + ], + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * removeStopWords boolean + */ + public function snippetForSetSettings5(): void + { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['removeStopWords' => true, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * removeStopWords list of string + */ + public function snippetForSetSettings6(): void + { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['removeStopWords' => [ + 'fr', + ], + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * boolean distinct + */ + public function snippetForSetSettings7(): void + { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['distinct' => true, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * integer distinct + */ + public function snippetForSetSettings8(): void + { + // >SEPARATOR setSettings integer distinct + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['distinct' => 1, + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * distinct company + */ + public function snippetForSetSettings9(): void + { + // >SEPARATOR setSettings distinct company + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributeForDistinct' => 'company', + 'distinct' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * distinct design + */ + public function snippetForSetSettings10(): void + { + // >SEPARATOR setSettings distinct design + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributeForDistinct' => 'design', + 'distinct' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * distinct true + */ + public function snippetForSetSettings11(): void + { + // >SEPARATOR setSettings distinct true + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['distinct' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * distinct section + */ + public function snippetForSetSettings12(): void + { + // >SEPARATOR setSettings distinct section + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributeForDistinct' => 'section', + 'distinct' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting allergens + */ + public function snippetForSetSettings13(): void + { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'allergens', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * api_attributes_for_faceting + */ + public function snippetForSetSettings14(): void + { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'genre', + + 'author', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * api_attributes_for_faceting_searchable + */ + public function snippetForSetSettings15(): void + { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'genre', + + 'searchable(author)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * api_attributes_for_filter_only + */ + public function snippetForSetSettings16(): void + { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(genre)', + + 'author', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting categoryPageId + */ + public function snippetForSetSettings17(): void + { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'searchable(categoryPageId)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * unretrievableAttributes + */ + public function snippetForSetSettings18(): void + { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['unretrievableAttributes' => [ + 'visible_by', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting user restricted data + */ + public function snippetForSetSettings19(): void + { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(visible_by)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting optional filters + */ + public function snippetForSetSettings20(): void + { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'can_deliver_quickly', + + 'restaurant', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting redirect index + */ + public function snippetForSetSettings21(): void + { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'query_terms', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting multiple consequences + */ + public function snippetForSetSettings22(): void + { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'director', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting in-depth optional filters + */ + public function snippetForSetSettings23(): void + { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(brand)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * mode neuralSearch + */ + public function snippetForSetSettings24(): void + { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['mode' => 'neuralSearch', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * mode keywordSearch + */ + public function snippetForSetSettings25(): void + { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['mode' => 'keywordSearch', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributes same priority + */ + public function snippetForSetSettings26(): void + { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'title,comments', + + 'ingredients', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributes higher priority + */ + public function snippetForSetSettings27(): void + { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'title', + + 'ingredients', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking retweets + */ + public function snippetForSetSettings28(): void + { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(retweets)', + + 'desc(likes)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking boosted + */ + public function snippetForSetSettings29(): void + { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(boosted)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking pageviews + */ + public function snippetForSetSettings30(): void + { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(pageviews)', + + 'desc(comments)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking applying search parameters for a specific query + */ + public function snippetForSetSettings31(): void + { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(nb_airline_liaisons)', + ], + 'attributesForFaceting' => [ + 'city, country', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking rounded pageviews + */ + public function snippetForSetSettings32(): void + { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(rounded_pageviews)', + + 'desc(comments)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking price + */ + public function snippetForSetSettings33(): void + { + // >SEPARATOR setSettings customRanking price + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(price)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * ranking exhaustive + */ + public function snippetForSetSettings34(): void + { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'desc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * ranking standard replica + */ + public function snippetForSetSettings35(): void + { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'desc(post_date_timestamp)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * ranking virtual replica + */ + public function snippetForSetSettings36(): void + { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(post_date_timestamp)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * customRanking and ranking sort alphabetically + */ + public function snippetForSetSettings37(): void + { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'asc(textual_attribute)', + ], + 'ranking' => [ + 'custom', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * relevancyStrictness + */ + public function snippetForSetSettings38(): void + { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'asc(textual_attribute)', + ], + 'relevancyStrictness' => 0, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * create replica index + */ + public function snippetForSetSettings39(): void + { + // >SEPARATOR setSettings create replica index + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['replicas' => [ + 'products_price_desc', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * create replica index articles + */ + public function snippetForSetSettings40(): void + { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['replicas' => [ + 'articles_date_desc', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * create virtual replica index + */ + public function snippetForSetSettings41(): void + { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['replicas' => [ + 'virtual(products_price_desc)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * unlink replica index + */ + public function snippetForSetSettings42(): void + { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['replicas' => [ + '', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * forwardToReplicas + */ + public function snippetForSetSettings43(): void + { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'name', + + 'description', + ], + ], + true, + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * maxValuesPerFacet + */ + public function snippetForSetSettings44(): void + { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['maxValuesPerFacet' => 1000, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * maxFacetHits + */ + public function snippetForSetSettings45(): void + { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['maxFacetHits' => 1000, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesForFaceting complex + */ + public function snippetForSetSettings46(): void + { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'actor', + + 'filterOnly(category)', + + 'searchable(publisher)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * ranking closest dates + */ + public function snippetForSetSettings47(): void + { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'asc(date_timestamp)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributes item variation + */ + public function snippetForSetSettings48(): void + { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'design', + + 'type', + + 'color', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributes around location + */ + public function snippetForSetSettings49(): void + { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'name', + + 'country', + + 'code', + + 'iata_code', + ], + 'customRanking' => [ + 'desc(links_count)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesToHighlight + */ + public function snippetForSetSettings50(): void + { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToHighlight' => [ + 'author', + + 'title', + + 'content', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * attributesToHighlightStar + */ + public function snippetForSetSettings51(): void + { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToHighlight' => [ + '*', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * everything + */ + public function snippetForSetSettings52(): void + { + // >SEPARATOR setSettings everything + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'exactPhrase', + ], + 'allowCompressionOfIntegerArray' => true, + 'allowTyposOnNumericTokens' => true, + 'alternativesAsExact' => [ + 'singleWordSynonym', + ], + 'attributeCriteriaComputedByMinProximity' => true, + 'attributeForDistinct' => 'test', + 'attributesForFaceting' => [ + 'algolia', + ], + 'attributesToHighlight' => [ + 'algolia', + ], + 'attributesToRetrieve' => [ + 'algolia', + ], + 'attributesToSnippet' => [ + 'algolia', + ], + 'attributesToTransliterate' => [ + 'algolia', + ], + 'camelCaseAttributes' => [ + 'algolia', + ], + 'customNormalization' => ['algolia' => ['aloglia' => 'aglolia', + ], + ], + 'customRanking' => [ + 'algolia', + ], + 'decompoundQuery' => false, + 'decompoundedAttributes' => ['algolia' => 'aloglia', + ], + 'disableExactOnAttributes' => [ + 'algolia', + ], + 'disablePrefixOnAttributes' => [ + 'algolia', + ], + 'disableTypoToleranceOnAttributes' => [ + 'algolia', + ], + 'disableTypoToleranceOnWords' => [ + 'algolia', + ], + 'distinct' => 3, + 'enablePersonalization' => true, + 'enableReRanking' => false, + 'enableRules' => true, + 'exactOnSingleWordQuery' => 'attribute', + 'highlightPreTag' => '', + 'highlightPostTag' => '', + 'hitsPerPage' => 10, + 'ignorePlurals' => false, + 'indexLanguages' => [ + 'fr', + ], + 'keepDiacriticsOnCharacters' => 'abc', + 'maxFacetHits' => 20, + 'maxValuesPerFacet' => 30, + 'minProximity' => 6, + 'minWordSizefor1Typo' => 5, + 'minWordSizefor2Typos' => 11, + 'mode' => 'neuralSearch', + 'numericAttributesForFiltering' => [ + 'algolia', + ], + 'optionalWords' => [ + 'myspace', + ], + 'paginationLimitedTo' => 0, + 'queryLanguages' => [ + 'fr', + ], + 'queryType' => 'prefixLast', + 'ranking' => [ + 'geo', + ], + 'reRankingApplyFilter' => 'mySearch:filters', + 'relevancyStrictness' => 10, + 'removeStopWords' => false, + 'removeWordsIfNoResults' => 'lastWords', + 'renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ + 'a', + + 'b', + ], + ], + 'values' => ['a' => ['order' => [ + 'b', + ], + 'sortRemainingBy' => 'count', + ], + ], + ], + ], + 'replaceSynonymsInHighlight' => true, + 'replicas' => [ + '', + ], + 'responseFields' => [ + 'algolia', + ], + 'restrictHighlightAndSnippetArrays' => true, + 'searchableAttributes' => [ + 'foo', + ], + 'semanticSearch' => ['eventSources' => [ + 'foo', + ], + ], + 'separatorsToIndex' => 'bar', + 'snippetEllipsisText' => '---', + 'sortFacetValuesBy' => 'date', + 'typoTolerance' => false, + 'unretrievableAttributes' => [ + 'foo', + ], + 'userData' => ['user' => 'data', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesWithCustomRankingsAndAttributesForFaceting + */ + public function snippetForSetSettings53(): void + { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'brand', + + 'name', + + 'categories', + + 'unordered(description)', + ], + 'customRanking' => [ + 'desc(popularity)', + ], + 'attributesForFaceting' => [ + 'searchable(brand)', + + 'type', + + 'categories', + + 'price', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesOrdering + */ + public function snippetForSetSettings54(): void + { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'unordered(title)', + + 'cast', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesProductReferenceSuffixes + */ + public function snippetForSetSettings55(): void + { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'name', + + 'product_reference', + + 'product_reference_suffixes', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * queryLanguageAndIgnorePlurals + */ + public function snippetForSetSettings56(): void + { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['queryLanguages' => [ + 'en', + ], + 'ignorePlurals' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesInMovies + */ + public function snippetForSetSettings57(): void + { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'title_eng', + + 'title_fr', + + 'title_es', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disablePrefixOnAttributes + */ + public function snippetForSetSettings58(): void + { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['disablePrefixOnAttributes' => [ + 'serial_number', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disableTypoToleranceOnAttributes + */ + public function snippetForSetSettings59(): void + { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['disableTypoToleranceOnAttributes' => [ + 'serial_number', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesSimpleExample + */ + public function snippetForSetSettings60(): void + { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'serial_number', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * searchableAttributesSimpleExampleAlt + */ + public function snippetForSetSettings61(): void + { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'serial_number', + + 'serial_number_suffixes', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_searchable_attributes + */ + public function snippetForSetSettings62(): void + { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['searchableAttributes' => [ + 'title,alternative_title', + + 'author', + + 'unordered(text)', + + 'emails.personal', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_searchable_attributes + */ + public function snippetForSetSettings63(): void + { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesForFaceting' => [ + 'author', + + 'filterOnly(isbn)', + + 'searchable(edition)', + + 'afterDistinct(category)', + + 'afterDistinct(searchable(publisher))', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * unretrievable_attributes + */ + public function snippetForSetSettings64(): void + { + // >SEPARATOR setSettings unretrievable_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['unretrievableAttributes' => [ + 'total_number_of_sales', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_retrievable_attributes + */ + public function snippetForSetSettings65(): void + { + // >SEPARATOR setSettings set_retrievable_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToRetrieve' => [ + 'author', + + 'title', + + 'content', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_all_attributes_as_retrievable + */ + public function snippetForSetSettings66(): void + { + // >SEPARATOR setSettings set_all_attributes_as_retrievable + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToRetrieve' => [ + '*', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * specify_attributes_not_to_retrieve + */ + public function snippetForSetSettings67(): void + { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToRetrieve' => [ + '*', + + '-SKU', + + '-internal_desc', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * neural_search + */ + public function snippetForSetSettings68(): void + { + // >SEPARATOR setSettings neural_search + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['mode' => 'neuralSearch', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * keyword_search + */ + public function snippetForSetSettings69(): void + { + // >SEPARATOR setSettings keyword_search + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['mode' => 'keywordSearch', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_ranking + */ + public function snippetForSetSettings70(): void + { + // >SEPARATOR setSettings set_default_ranking + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'attribute', + + 'proximity', + + 'exact', + + 'custom', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_ranking_by_attribute_asc + */ + public function snippetForSetSettings71(): void + { + // >SEPARATOR setSettings set_ranking_by_attribute_asc + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'asc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_ranking_by_attribute_desc + */ + public function snippetForSetSettings72(): void + { + // >SEPARATOR setSettings set_ranking_by_attribute_desc + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['ranking' => [ + 'desc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * restrict_searchable_attributes + */ + public function snippetForSetSettings73(): void + { + // >SEPARATOR setSettings restrict_searchable_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customRanking' => [ + 'desc(popularity)', + + 'asc(price)', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_relevancy + */ + public function snippetForSetSettings74(): void + { + // >SEPARATOR setSettings set_default_relevancy + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['relevancyStrictness' => 90, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_replicas + */ + public function snippetForSetSettings75(): void + { + // >SEPARATOR setSettings set_replicas + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['replicas' => [ + 'name_of_replica_index1', + + 'name_of_replica_index2', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_max_values_per_facet + */ + public function snippetForSetSettings76(): void + { + // >SEPARATOR setSettings set_default_max_values_per_facet + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['maxValuesPerFacet' => 100, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_sort_facet_values_by + */ + public function snippetForSetSettings77(): void + { + // >SEPARATOR setSettings set_default_sort_facet_values_by + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['sortFacetValuesBy' => 'alpha', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_attributes_to_snippet + */ + public function snippetForSetSettings78(): void + { + // >SEPARATOR setSettings set_attributes_to_snippet + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToSnippet' => [ + 'content:80', + + 'description', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_all_attributes_to_snippet + */ + public function snippetForSetSettings79(): void + { + // >SEPARATOR setSettings set_all_attributes_to_snippet + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['attributesToSnippet' => [ + '*:80', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_highlight_pre_tag + */ + public function snippetForSetSettings80(): void + { + // >SEPARATOR setSettings set_default_highlight_pre_tag + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['highlightPreTag' => '', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_highlight_post_tag + */ + public function snippetForSetSettings81(): void + { + // >SEPARATOR setSettings set_default_highlight_post_tag + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['highlightPostTag' => '', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_snippet_ellipsis_text + */ + public function snippetForSetSettings82(): void + { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['snippetEllipsisText' => '…', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * enable_restrict_highlight_and_snippet_arrays_by_default + */ + public function snippetForSetSettings83(): void + { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['restrictHighlightAndSnippetArrays' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_hits_per_page + */ + public function snippetForSetSettings84(): void + { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['hitsPerPage' => 20, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_pagination_limit + */ + public function snippetForSetSettings85(): void + { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['paginationLimitedTo' => 1000, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_min_word_size_for_one_typo + */ + public function snippetForSetSettings86(): void + { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['minWordSizefor1Typo' => 4, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_min_word_size_for_two_typos + */ + public function snippetForSetSettings87(): void + { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['minWordSizefor2Typos' => 4, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_typo_tolerance_mode + */ + public function snippetForSetSettings88(): void + { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['typoTolerance' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disable_typos_on_numeric_tokens_by_default + */ + public function snippetForSetSettings89(): void + { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['allowTyposOnNumericTokens' => false, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disable_typo_tolerance_for_words + */ + public function snippetForSetSettings90(): void + { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['disableTypoToleranceOnWords' => [ + 'wheel', + + '1X2BCD', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_separators_to_index + */ + public function snippetForSetSettings91(): void + { + // >SEPARATOR setSettings set_separators_to_index + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['separatorsToIndex' => '+#', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_languages_using_querylanguages + */ + public function snippetForSetSettings92(): void + { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['queryLanguages' => [ + 'es', + ], + 'ignorePlurals' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_attributes_to_transliterate + */ + public function snippetForSetSettings93(): void + { + // >SEPARATOR setSettings set_attributes_to_transliterate + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['indexLanguages' => [ + 'ja', + ], + 'attributesToTransliterate' => [ + 'name', + + 'description', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_languages_using_querylanguages + */ + public function snippetForSetSettings94(): void + { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['queryLanguages' => [ + 'es', + ], + 'removeStopWords' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_camel_case_attributes + */ + public function snippetForSetSettings95(): void + { + // >SEPARATOR setSettings set_camel_case_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['camelCaseAttributes' => [ + 'description', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_decompounded_attributes + */ + public function snippetForSetSettings96(): void + { + // >SEPARATOR setSettings set_decompounded_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['decompoundedAttributes' => ['de' => [ + 'name', + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_decompounded_multiple_attributes + */ + public function snippetForSetSettings97(): void + { + // >SEPARATOR setSettings set_decompounded_multiple_attributes + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['decompoundedAttributes' => ['de' => [ + 'name_de', + + 'description_de', + ], + 'fi' => [ + 'name_fi', + + 'description_fi', + ], + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_keep_diacritics_on_characters + */ + public function snippetForSetSettings98(): void + { + // >SEPARATOR setSettings set_keep_diacritics_on_characters + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['keepDiacriticsOnCharacters' => 'øé', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_custom_normalization + */ + public function snippetForSetSettings99(): void + { + // >SEPARATOR setSettings set_custom_normalization + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['customNormalization' => ['default' => ['ä' => 'ae', + ], + ], + ], + ); + + // >LOG + // play with the response var_dump($response); // SEPARATOR< } @@ -7045,36 +11232,120 @@ public function snippetForSetSettings42(): void /** * Snippet for the SetSettings method. * - * ranking closest dates + * set_languages_using_querylanguages */ - public function snippetForSetSettings43(): void + public function snippetForSetSettings100(): void { - // >SEPARATOR setSettings ranking closest dates + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['ranking' => [ - 'asc(date_timestamp)', + ['queryLanguages' => [ + 'es', + ], + 'removeStopWords' => true, + 'ignorePlurals' => true, + ], + ); - 'typo', + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } - 'geo', + /** + * Snippet for the SetSettings method. + * + * set_indexlanguages + */ + public function snippetForSetSettings101(): void + { + // >SEPARATOR setSettings set_indexlanguages + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); - 'words', + // Call the API + $response = $client->setSettings( + '', + ['indexLanguages' => [ + 'ja', + ], + ], + ); - 'filters', + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } - 'proximity', + /** + * Snippet for the SetSettings method. + * + * enable_decompound_query_by_default + */ + public function snippetForSetSettings102(): void + { + // >SEPARATOR setSettings enable_decompound_query_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); - 'attribute', + // Call the API + $response = $client->setSettings( + '', + ['decompoundQuery' => true, + ], + ); - 'exact', + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } - 'custom', + /** + * Snippet for the SetSettings method. + * + * enable_rules_syntax_by_default + */ + public function snippetForSetSettings103(): void + { + // >SEPARATOR setSettings enable_rules_syntax_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['enableRules' => true, ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * enable_personalization_settings + */ + public function snippetForSetSettings104(): void + { + // >SEPARATOR setSettings enable_personalization_settings + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['enablePersonalization' => true, ], ); @@ -7087,23 +11358,197 @@ public function snippetForSetSettings43(): void /** * Snippet for the SetSettings method. * - * searchableAttributes item variation + * set_default_query_type + */ + public function snippetForSetSettings105(): void + { + // >SEPARATOR setSettings set_default_query_type + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['queryType' => 'prefixLast', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_remove_words_if_no_result + */ + public function snippetForSetSettings106(): void + { + // >SEPARATOR setSettings set_default_remove_words_if_no_result + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['removeWordsIfNoResults' => 'none', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * enable_advanced_syntax_by_default + */ + public function snippetForSetSettings107(): void + { + // >SEPARATOR setSettings enable_advanced_syntax_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['advancedSyntax' => true, + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_optional_words + */ + public function snippetForSetSettings108(): void + { + // >SEPARATOR setSettings set_default_optional_words + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['optionalWords' => [ + 'blue', + + 'iphone case', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disabling_prefix_search_for_some_attributes_by_default + */ + public function snippetForSetSettings109(): void + { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['disablePrefixOnAttributes' => [ + 'sku', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * disabling_exact_for_some_attributes_by_default + */ + public function snippetForSetSettings110(): void + { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['disableExactOnAttributes' => [ + 'description', + ], + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_exact_single_word_query + */ + public function snippetForSetSettings111(): void + { + // >SEPARATOR setSettings set_default_exact_single_word_query + // Initialize the client + $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); + + // Call the API + $response = $client->setSettings( + '', + ['exactOnSingleWordQuery' => 'attribute', + ], + ); + + // >LOG + // play with the response + var_dump($response); + // SEPARATOR< + } + + /** + * Snippet for the SetSettings method. + * + * set_default_aternative_as_exact */ - public function snippetForSetSettings44(): void + public function snippetForSetSettings112(): void { - // >SEPARATOR setSettings searchableAttributes item variation + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'design', + ['alternativesAsExact' => [ + 'ignorePlurals', - 'type', - - 'color', + 'singleWordSynonym', ], ], ); @@ -7117,29 +11562,18 @@ public function snippetForSetSettings44(): void /** * Snippet for the SetSettings method. * - * searchableAttributes around location + * enable_advanced_syntax_by_default */ - public function snippetForSetSettings45(): void + public function snippetForSetSettings113(): void { - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'name', - - 'country', - - 'code', - - 'iata_code', - ], - 'customRanking' => [ - 'desc(links_count)', - ], + ['advancedSyntax' => true, ], ); @@ -7152,29 +11586,22 @@ public function snippetForSetSettings45(): void /** * Snippet for the SetSettings method. * - * searchableAttributes around location + * set_numeric_attributes_for_filtering */ - public function snippetForSetSettings46(): void + public function snippetForSetSettings114(): void { - // >SEPARATOR setSettings searchableAttributes around location + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'name', - - 'country', - - 'code', + ['numericAttributesForFiltering' => [ + 'quantity', - 'iata_code', + 'popularity', ], - 'customRanking' => [ - 'desc(links_count)', - ], ], ); @@ -7187,20 +11614,18 @@ public function snippetForSetSettings46(): void /** * Snippet for the SetSettings method. * - * disableTypoToleranceOnAttributes + * enable_compression_of_integer_array */ - public function snippetForSetSettings47(): void + public function snippetForSetSettings115(): void { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['disableTypoToleranceOnAttributes' => [ - 'serial_number', - ], + ['allowCompressionOfIntegerArray' => true, ], ); @@ -7213,142 +11638,18 @@ public function snippetForSetSettings47(): void /** * Snippet for the SetSettings method. * - * everything + * set_attributes_for_distinct */ - public function snippetForSetSettings48(): void + public function snippetForSetSettings116(): void { - // >SEPARATOR setSettings everything + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['advancedSyntax' => true, - 'advancedSyntaxFeatures' => [ - 'exactPhrase', - ], - 'allowCompressionOfIntegerArray' => true, - 'allowTyposOnNumericTokens' => true, - 'alternativesAsExact' => [ - 'singleWordSynonym', - ], - 'attributeCriteriaComputedByMinProximity' => true, - 'attributeForDistinct' => 'test', - 'attributesForFaceting' => [ - 'algolia', - ], - 'attributesToHighlight' => [ - 'algolia', - ], - 'attributesToRetrieve' => [ - 'algolia', - ], - 'attributesToSnippet' => [ - 'algolia', - ], - 'attributesToTransliterate' => [ - 'algolia', - ], - 'camelCaseAttributes' => [ - 'algolia', - ], - 'customNormalization' => ['algolia' => ['aloglia' => 'aglolia', - ], - ], - 'customRanking' => [ - 'algolia', - ], - 'decompoundQuery' => false, - 'decompoundedAttributes' => ['algolia' => 'aloglia', - ], - 'disableExactOnAttributes' => [ - 'algolia', - ], - 'disablePrefixOnAttributes' => [ - 'algolia', - ], - 'disableTypoToleranceOnAttributes' => [ - 'algolia', - ], - 'disableTypoToleranceOnWords' => [ - 'algolia', - ], - 'distinct' => 3, - 'enablePersonalization' => true, - 'enableReRanking' => false, - 'enableRules' => true, - 'exactOnSingleWordQuery' => 'attribute', - 'highlightPreTag' => '', - 'highlightPostTag' => '', - 'hitsPerPage' => 10, - 'ignorePlurals' => false, - 'indexLanguages' => [ - 'fr', - ], - 'keepDiacriticsOnCharacters' => 'abc', - 'maxFacetHits' => 20, - 'maxValuesPerFacet' => 30, - 'minProximity' => 6, - 'minWordSizefor1Typo' => 5, - 'minWordSizefor2Typos' => 11, - 'mode' => 'neuralSearch', - 'numericAttributesForFiltering' => [ - 'algolia', - ], - 'optionalWords' => [ - 'myspace', - ], - 'paginationLimitedTo' => 0, - 'queryLanguages' => [ - 'fr', - ], - 'queryType' => 'prefixLast', - 'ranking' => [ - 'geo', - ], - 'reRankingApplyFilter' => 'mySearch:filters', - 'relevancyStrictness' => 10, - 'removeStopWords' => false, - 'removeWordsIfNoResults' => 'lastWords', - 'renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ - 'a', - - 'b', - ], - ], - 'values' => ['a' => ['order' => [ - 'b', - ], - 'sortRemainingBy' => 'count', - ], - ], - ], - ], - 'replaceSynonymsInHighlight' => true, - 'replicas' => [ - '', - ], - 'responseFields' => [ - 'algolia', - ], - 'restrictHighlightAndSnippetArrays' => true, - 'searchableAttributes' => [ - 'foo', - ], - 'semanticSearch' => ['eventSources' => [ - 'foo', - ], - ], - 'separatorsToIndex' => 'bar', - 'snippetEllipsisText' => '---', - 'sortFacetValuesBy' => 'date', - 'typoTolerance' => false, - 'unretrievableAttributes' => [ - 'foo', - ], - 'userData' => ['user' => 'data', - ], + ['attributeForDistinct' => 'url', ], ); @@ -7361,38 +11662,19 @@ public function snippetForSetSettings48(): void /** * Snippet for the SetSettings method. * - * searchableAttributesWithCustomRankingsAndAttributesForFaceting + * set_distinct */ - public function snippetForSetSettings49(): void + public function snippetForSetSettings117(): void { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // >SEPARATOR setSettings set_distinct // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'brand', - - 'name', - - 'categories', - - 'unordered(description)', - ], - 'customRanking' => [ - 'desc(popularity)', - ], - 'attributesForFaceting' => [ - 'searchable(brand)', - - 'type', - - 'categories', - - 'price', - ], + ['distinct' => 1, + 'attributeForDistinct' => 'url', ], ); @@ -7405,24 +11687,18 @@ public function snippetForSetSettings49(): void /** * Snippet for the SetSettings method. * - * searchableAttributesProductReferenceSuffixes + * set_replace_synonyms_in_highlights */ - public function snippetForSetSettings50(): void + public function snippetForSetSettings118(): void { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'name', - - 'product_reference', - - 'product_reference_suffixes', - ], + ['replaceSynonymsInHighlight' => false, ], ); @@ -7435,21 +11711,18 @@ public function snippetForSetSettings50(): void /** * Snippet for the SetSettings method. * - * queryLanguageAndIgnorePlurals + * set_min_proximity */ - public function snippetForSetSettings51(): void + public function snippetForSetSettings119(): void { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // >SEPARATOR setSettings set_min_proximity // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['queryLanguages' => [ - 'en', - ], - 'ignorePlurals' => true, + ['minProximity' => 1, ], ); @@ -7462,23 +11735,25 @@ public function snippetForSetSettings51(): void /** * Snippet for the SetSettings method. * - * searchableAttributesInMovies + * set_default_field */ - public function snippetForSetSettings52(): void + public function snippetForSetSettings120(): void { - // >SEPARATOR setSettings searchableAttributesInMovies + // >SEPARATOR setSettings set_default_field // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'title_eng', + ['responseFields' => [ + 'hits', - 'title_fr', + 'hitsPerPage', - 'title_es', + 'nbPages', + + 'page', ], ], ); @@ -7492,20 +11767,18 @@ public function snippetForSetSettings52(): void /** * Snippet for the SetSettings method. * - * disablePrefixOnAttributes + * set_max_facet_hits */ - public function snippetForSetSettings53(): void + public function snippetForSetSettings121(): void { - // >SEPARATOR setSettings disablePrefixOnAttributes + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['disablePrefixOnAttributes' => [ - 'serial_number', - ], + ['maxFacetHits' => 10, ], ); @@ -7518,20 +11791,18 @@ public function snippetForSetSettings53(): void /** * Snippet for the SetSettings method. * - * disableTypoToleranceOnAttributes + * set_attribute_criteria_computed_by_min_proximity */ - public function snippetForSetSettings54(): void + public function snippetForSetSettings122(): void { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['disableTypoToleranceOnAttributes' => [ - 'serial_number', - ], + ['attributeCriteriaComputedByMinProximity' => true, ], ); @@ -7544,19 +11815,18 @@ public function snippetForSetSettings54(): void /** * Snippet for the SetSettings method. * - * searchableAttributesSimpleExample + * set_user_data */ - public function snippetForSetSettings55(): void + public function snippetForSetSettings123(): void { - // >SEPARATOR setSettings searchableAttributesSimpleExample + // >SEPARATOR setSettings set_user_data // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'serial_number', + ['userData' => ['extraData' => 'This is the custom data that you want to store in your index', ], ], ); @@ -7570,21 +11840,42 @@ public function snippetForSetSettings55(): void /** * Snippet for the SetSettings method. * - * searchableAttributesSimpleExampleAlt + * set_rendering_content */ - public function snippetForSetSettings56(): void + public function snippetForSetSettings124(): void { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // >SEPARATOR setSettings set_rendering_content // Initialize the client $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); // Call the API $response = $client->setSettings( '', - ['searchableAttributes' => [ - 'serial_number', + ['renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ + 'size', - 'serial_number_suffixes', + 'brand', + ], + ], + 'values' => ['brand' => ['order' => [ + 'uniqlo', + ], + 'hide' => [ + 'muji', + ], + 'sortRemainingBy' => 'count', + ], + 'size' => ['order' => [ + 'S', + + 'M', + + 'L', + ], + 'sortRemainingBy' => 'hidden', + ], + ], + ], ], ], ); diff --git a/docs/snippets/python/search.py b/docs/snippets/python/search.py index 98bbe8a237..c90a90e22c 100644 --- a/docs/snippets/python/search.py +++ b/docs/snippets/python/search.py @@ -5292,6 +5292,126 @@ def snippet_for_search_single_index14(): """ Snippet for the searchSingleIndex method. + facetFiltersBook + """ + # >SEPARATOR searchSingleIndex facetFiltersBook + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index15(): + """ + Snippet for the searchSingleIndex method. + + facetFiltersAND + """ + # >SEPARATOR searchSingleIndex facetFiltersAND + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + "author:John Doe", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index16(): + """ + Snippet for the searchSingleIndex method. + + facetFiltersOR + """ + # >SEPARATOR searchSingleIndex facetFiltersOR + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "facetFilters": [ + [ + "category:Book", + "author:John Doe", + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index17(): + """ + Snippet for the searchSingleIndex method. + + facetFiltersCombined + """ + # >SEPARATOR searchSingleIndex facetFiltersCombined + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "facetFilters": [ + "author:John Doe", + [ + "category:Book", + "category:Movie", + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index18(): + """ + Snippet for the searchSingleIndex method. + facetFiltersNeg """ # >SEPARATOR searchSingleIndex facetFiltersNeg @@ -5313,7 +5433,7 @@ def snippet_for_search_single_index14(): # SEPARATOR< -def snippet_for_search_single_index15(): +def snippet_for_search_single_index19(): """ Snippet for the searchSingleIndex method. @@ -5341,7 +5461,7 @@ def snippet_for_search_single_index15(): # SEPARATOR< -def snippet_for_search_single_index16(): +def snippet_for_search_single_index20(): """ Snippet for the searchSingleIndex method. @@ -5369,7 +5489,7 @@ def snippet_for_search_single_index16(): # SEPARATOR< -def snippet_for_search_single_index17(): +def snippet_for_search_single_index21(): """ Snippet for the searchSingleIndex method. @@ -5396,7 +5516,7 @@ def snippet_for_search_single_index17(): # SEPARATOR< -def snippet_for_search_single_index18(): +def snippet_for_search_single_index22(): """ Snippet for the searchSingleIndex method. @@ -5421,7 +5541,7 @@ def snippet_for_search_single_index18(): # SEPARATOR< -def snippet_for_search_single_index19(): +def snippet_for_search_single_index23(): """ Snippet for the searchSingleIndex method. @@ -5446,7 +5566,7 @@ def snippet_for_search_single_index19(): # SEPARATOR< -def snippet_for_search_single_index20(): +def snippet_for_search_single_index24(): """ Snippet for the searchSingleIndex method. @@ -5471,7 +5591,7 @@ def snippet_for_search_single_index20(): # SEPARATOR< -def snippet_for_search_single_index21(): +def snippet_for_search_single_index25(): """ Snippet for the searchSingleIndex method. @@ -5497,7 +5617,7 @@ def snippet_for_search_single_index21(): # SEPARATOR< -def snippet_for_search_single_index22(): +def snippet_for_search_single_index26(): """ Snippet for the searchSingleIndex method. @@ -5529,7 +5649,7 @@ def snippet_for_search_single_index22(): # SEPARATOR< -def snippet_for_search_single_index23(): +def snippet_for_search_single_index27(): """ Snippet for the searchSingleIndex method. @@ -5569,7 +5689,7 @@ def snippet_for_search_single_index23(): # SEPARATOR< -def snippet_for_search_single_index24(): +def snippet_for_search_single_index28(): """ Snippet for the searchSingleIndex method. @@ -5609,7 +5729,7 @@ def snippet_for_search_single_index24(): # SEPARATOR< -def snippet_for_search_single_index25(): +def snippet_for_search_single_index29(): """ Snippet for the searchSingleIndex method. @@ -5636,7 +5756,7 @@ def snippet_for_search_single_index25(): # SEPARATOR< -def snippet_for_search_single_index26(): +def snippet_for_search_single_index30(): """ Snippet for the searchSingleIndex method. @@ -5665,7 +5785,7 @@ def snippet_for_search_single_index26(): # SEPARATOR< -def snippet_for_search_single_index27(): +def snippet_for_search_single_index31(): """ Snippet for the searchSingleIndex method. @@ -5693,7 +5813,7 @@ def snippet_for_search_single_index27(): # SEPARATOR< -def snippet_for_search_single_index28(): +def snippet_for_search_single_index32(): """ Snippet for the searchSingleIndex method. @@ -5720,7 +5840,7 @@ def snippet_for_search_single_index28(): # SEPARATOR< -def snippet_for_search_single_index29(): +def snippet_for_search_single_index33(): """ Snippet for the searchSingleIndex method. @@ -5745,7 +5865,7 @@ def snippet_for_search_single_index29(): # SEPARATOR< -def snippet_for_search_single_index30(): +def snippet_for_search_single_index34(): """ Snippet for the searchSingleIndex method. @@ -5770,7 +5890,7 @@ def snippet_for_search_single_index30(): # SEPARATOR< -def snippet_for_search_single_index31(): +def snippet_for_search_single_index35(): """ Snippet for the searchSingleIndex method. @@ -5796,7 +5916,7 @@ def snippet_for_search_single_index31(): # SEPARATOR< -def snippet_for_search_single_index32(): +def snippet_for_search_single_index36(): """ Snippet for the searchSingleIndex method. @@ -5822,7 +5942,7 @@ def snippet_for_search_single_index32(): # SEPARATOR< -def snippet_for_search_single_index33(): +def snippet_for_search_single_index37(): """ Snippet for the searchSingleIndex method. @@ -5847,7 +5967,33 @@ def snippet_for_search_single_index33(): # SEPARATOR< -def snippet_for_search_single_index34(): +def snippet_for_search_single_index38(): + """ + Snippet for the searchSingleIndex method. + + userToken1234 + """ + # >SEPARATOR searchSingleIndex userToken1234 + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "userToken": "user-1234", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index39(): """ Snippet for the searchSingleIndex method. @@ -5874,7 +6020,7 @@ def snippet_for_search_single_index34(): # SEPARATOR< -def snippet_for_search_single_index35(): +def snippet_for_search_single_index40(): """ Snippet for the searchSingleIndex method. @@ -5902,7 +6048,7 @@ def snippet_for_search_single_index35(): # SEPARATOR< -def snippet_for_search_single_index36(): +def snippet_for_search_single_index41(): """ Snippet for the searchSingleIndex method. @@ -5931,20 +6077,27 @@ def snippet_for_search_single_index36(): # SEPARATOR< -def snippet_for_search_synonyms(): +def snippet_for_search_single_index42(): """ - Snippet for the searchSynonyms method. + Snippet for the searchSingleIndex method. - searchSynonyms with minimal parameters + attributesToHighlightOverride """ - # >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + # >SEPARATOR searchSingleIndex attributesToHighlightOverride # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_synonyms( + response = client.search_single_index( index_name="", + search_params={ + "query": "query", + "attributesToHighlight": [ + "title", + "content", + ], + }, ) # >LOG @@ -5953,25 +6106,25 @@ def snippet_for_search_synonyms(): # SEPARATOR< -def snippet_for_search_synonyms1(): +def snippet_for_search_single_index43(): """ - Snippet for the searchSynonyms method. + Snippet for the searchSingleIndex method. - searchSynonyms with all parameters + disableTypoToleranceOnAttributes """ - # >SEPARATOR searchSynonyms searchSynonyms with all parameters + # >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_synonyms( + response = client.search_single_index( index_name="", - search_synonyms_params={ - "query": "myQuery", - "type": "altcorrection1", - "page": 10, - "hitsPerPage": 10, + search_params={ + "query": "query", + "disableTypoToleranceOnAttributes": [ + "serial_number", + ], }, ) @@ -5981,24 +6134,22 @@ def snippet_for_search_synonyms1(): # SEPARATOR< -def snippet_for_search_user_ids(): +def snippet_for_search_single_index44(): """ - Snippet for the searchUserIds method. + Snippet for the searchSingleIndex method. - searchUserIds + search_a_query """ - # >SEPARATOR searchUserIds default + # >SEPARATOR searchSingleIndex search_a_query # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_user_ids( - search_user_ids_params={ - "query": "test", - "clusterName": "theClusterName", - "page": 5, - "hitsPerPage": 10, + response = client.search_single_index( + index_name="", + search_params={ + "query": "shirt", }, ) @@ -6008,47 +6159,48 @@ def snippet_for_search_user_ids(): # SEPARATOR< -def snippet_for_set_client_api_key(): +def snippet_for_search_single_index45(): """ - Snippet for the setClientApiKey method. + Snippet for the searchSingleIndex method. - switch API key + search_everything """ - # >SEPARATOR setClientApiKey default + # >SEPARATOR searchSingleIndex search_everything # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - client.set_client_api_key( - api_key="updated-api-key", + response = client.search_single_index( + index_name="", + search_params={ + "query": "", + }, ) # >LOG + # use the class directly + print(response) # SEPARATOR< -def snippet_for_set_dictionary_settings(): +def snippet_for_search_single_index46(): """ - Snippet for the setDictionarySettings method. + Snippet for the searchSingleIndex method. - get setDictionarySettings results with minimal parameters + api_filtering_range_example """ - # >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + # >SEPARATOR searchSingleIndex api_filtering_range_example # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_dictionary_settings( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - }, + response = client.search_single_index( + index_name="", + search_params={ + "query": "books", + "filters": "price:10 TO 20", }, ) @@ -6058,35 +6210,26 @@ def snippet_for_set_dictionary_settings(): # SEPARATOR< -def snippet_for_set_dictionary_settings1(): +def snippet_for_search_single_index47(): """ - Snippet for the setDictionarySettings method. + Snippet for the searchSingleIndex method. - get setDictionarySettings results with all parameters + search_a_query """ - # >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + # >SEPARATOR searchSingleIndex search_a_query # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_dictionary_settings( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - "stopwords": { - "fr": False, - }, - "compounds": { - "ru": True, - }, - }, - }, - ) + response = client.search_single_index( + index_name="", + search_params={ + "query": "", + "similarQuery": "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + "filters": "year:1991 TO 2001", + }, + ) # >LOG # use the class directly @@ -6094,24 +6237,27 @@ def snippet_for_set_dictionary_settings1(): # SEPARATOR< -def snippet_for_set_settings(): +def snippet_for_search_single_index48(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - minimal parameters + override_retrievable_attributes """ - # >SEPARATOR setSettings minimal parameters + # >SEPARATOR searchSingleIndex override_retrievable_attributes # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "paginationLimitedTo": 10, + search_params={ + "query": "query", + "attributesToRetrieve": [ + "title", + "content", + ], }, - forward_to_replicas=True, ) # >LOG @@ -6120,24 +6266,27 @@ def snippet_for_set_settings(): # SEPARATOR< -def snippet_for_set_settings1(): +def snippet_for_search_single_index49(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - boolean typoTolerance + restrict_searchable_attributes """ - # >SEPARATOR setSettings boolean typoTolerance + # >SEPARATOR searchSingleIndex restrict_searchable_attributes # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "typoTolerance": True, + search_params={ + "query": "query", + "restrictSearchableAttributes": [ + "title", + "author", + ], }, - forward_to_replicas=True, ) # >LOG @@ -6146,24 +6295,24 @@ def snippet_for_set_settings1(): # SEPARATOR< -def snippet_for_set_settings2(): +def snippet_for_search_single_index50(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - enum typoTolerance + override_default_relevancy """ - # >SEPARATOR setSettings enum typoTolerance + # >SEPARATOR searchSingleIndex override_default_relevancy # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "typoTolerance": "min", + search_params={ + "query": "query", + "relevancyStrictness": 70, }, - forward_to_replicas=True, ) # >LOG @@ -6172,24 +6321,24 @@ def snippet_for_set_settings2(): # SEPARATOR< -def snippet_for_set_settings3(): +def snippet_for_search_single_index51(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - ignorePlurals + apply_filters """ - # >SEPARATOR setSettings ignorePlurals + # >SEPARATOR searchSingleIndex apply_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "ignorePlurals": True, + search_params={ + "query": "query", + "filters": "(category:Book OR category:Ebook) AND _tags:published", }, - forward_to_replicas=True, ) # >LOG @@ -6198,26 +6347,24 @@ def snippet_for_set_settings3(): # SEPARATOR< -def snippet_for_set_settings4(): +def snippet_for_search_single_index52(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - list of string ignorePlurals + apply_all_filters """ - # >SEPARATOR setSettings list of string ignorePlurals + # >SEPARATOR searchSingleIndex apply_all_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "ignorePlurals": [ - "fr", - ], + search_params={ + "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"', }, - forward_to_replicas=True, ) # >LOG @@ -6226,24 +6373,24 @@ def snippet_for_set_settings4(): # SEPARATOR< -def snippet_for_set_settings5(): +def snippet_for_search_single_index53(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - removeStopWords boolean + escape_spaces """ - # >SEPARATOR setSettings removeStopWords boolean + # >SEPARATOR searchSingleIndex escape_spaces # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "removeStopWords": True, + search_params={ + "query": "query", + "filters": 'category:"Books and Comics"', }, - forward_to_replicas=True, ) # >LOG @@ -6252,26 +6399,24 @@ def snippet_for_set_settings5(): # SEPARATOR< -def snippet_for_set_settings6(): +def snippet_for_search_single_index54(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - removeStopWords list of string + escape_keywords """ - # >SEPARATOR setSettings removeStopWords list of string + # >SEPARATOR searchSingleIndex escape_keywords # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "removeStopWords": [ - "fr", - ], + search_params={ + "query": "query", + "filters": 'keyword:"OR"', }, - forward_to_replicas=True, ) # >LOG @@ -6280,24 +6425,24 @@ def snippet_for_set_settings6(): # SEPARATOR< -def snippet_for_set_settings7(): +def snippet_for_search_single_index55(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - boolean distinct + escape_single_quotes """ - # >SEPARATOR setSettings boolean distinct + # >SEPARATOR searchSingleIndex escape_single_quotes # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "distinct": True, + search_params={ + "query": "query", + "filters": 'content:"It\'s a wonderful day"', }, - forward_to_replicas=True, ) # >LOG @@ -6306,24 +6451,24 @@ def snippet_for_set_settings7(): # SEPARATOR< -def snippet_for_set_settings8(): +def snippet_for_search_single_index56(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - integer distinct + escape_double_quotes """ - # >SEPARATOR setSettings integer distinct + # >SEPARATOR searchSingleIndex escape_double_quotes # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "distinct": 1, + search_params={ + "query": "query", + "filters": 'content:"She said "Hello World"', }, - forward_to_replicas=True, ) # >LOG @@ -6332,23 +6477,26 @@ def snippet_for_set_settings8(): # SEPARATOR< -def snippet_for_set_settings9(): +def snippet_for_search_single_index57(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - distinct company + apply_filters """ - # >SEPARATOR setSettings distinct company + # >SEPARATOR searchSingleIndex apply_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributeForDistinct": "company", - "distinct": True, + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:John Doe", + ], }, ) @@ -6358,23 +6506,26 @@ def snippet_for_set_settings9(): # SEPARATOR< -def snippet_for_set_settings10(): +def snippet_for_search_single_index58(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - distinct design + apply_negative_filters """ - # >SEPARATOR setSettings distinct design + # >SEPARATOR searchSingleIndex apply_negative_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributeForDistinct": "design", - "distinct": True, + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:-John Doe", + ], }, ) @@ -6384,22 +6535,29 @@ def snippet_for_set_settings10(): # SEPARATOR< -def snippet_for_set_settings11(): +def snippet_for_search_single_index59(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - distinct true + apply_numeric_filters """ - # >SEPARATOR setSettings distinct true + # >SEPARATOR searchSingleIndex apply_numeric_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "distinct": True, + search_params={ + "query": "query", + "numericFilters": [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506", + ], + ], }, ) @@ -6409,23 +6567,29 @@ def snippet_for_set_settings11(): # SEPARATOR< -def snippet_for_set_settings12(): +def snippet_for_search_single_index60(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - distinct section + apply_tag_filters """ - # >SEPARATOR setSettings distinct section + # >SEPARATOR searchSingleIndex apply_tag_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributeForDistinct": "section", - "distinct": True, + search_params={ + "query": "query", + "tagFilters": [ + "SciFi", + [ + "Book", + "Movie", + ], + ], }, ) @@ -6435,24 +6599,23 @@ def snippet_for_set_settings12(): # SEPARATOR< -def snippet_for_set_settings13(): +def snippet_for_search_single_index61(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting allergens + apply_filters """ - # >SEPARATOR setSettings attributesForFaceting allergens + # >SEPARATOR searchSingleIndex apply_filters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "allergens", - ], + search_params={ + "query": "query", + "sumOrFiltersScores": True, }, ) @@ -6462,23 +6625,24 @@ def snippet_for_set_settings13(): # SEPARATOR< -def snippet_for_set_settings14(): +def snippet_for_search_single_index62(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting categoryPageId + facets_all """ - # >SEPARATOR setSettings attributesForFaceting categoryPageId + # >SEPARATOR searchSingleIndex facets_all # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "searchable(categoryPageId)", + search_params={ + "query": "query", + "facets": [ + "*", ], }, ) @@ -6489,23 +6653,25 @@ def snippet_for_set_settings14(): # SEPARATOR< -def snippet_for_set_settings15(): +def snippet_for_search_single_index63(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - unretrievableAttributes + retrieve_only_some_facets """ - # >SEPARATOR setSettings unretrievableAttributes + # >SEPARATOR searchSingleIndex retrieve_only_some_facets # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "unretrievableAttributes": [ - "visible_by", + search_params={ + "query": "query", + "facets": [ + "category", + "author", ], }, ) @@ -6516,24 +6682,23 @@ def snippet_for_set_settings15(): # SEPARATOR< -def snippet_for_set_settings16(): +def snippet_for_search_single_index64(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting user restricted data + override_default_max_values_per_facet """ - # >SEPARATOR setSettings attributesForFaceting user restricted data + # >SEPARATOR searchSingleIndex override_default_max_values_per_facet # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "filterOnly(visible_by)", - ], + search_params={ + "query": "query", + "maxValuesPerFacet": 20, }, ) @@ -6543,25 +6708,23 @@ def snippet_for_set_settings16(): # SEPARATOR< -def snippet_for_set_settings17(): +def snippet_for_search_single_index65(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting optional filters + enable_faceting_after_distinct """ - # >SEPARATOR setSettings attributesForFaceting optional filters + # >SEPARATOR searchSingleIndex enable_faceting_after_distinct # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "can_deliver_quickly", - "restaurant", - ], + search_params={ + "query": "query", + "facetingAfterDistinct": True, }, ) @@ -6571,24 +6734,23 @@ def snippet_for_set_settings17(): # SEPARATOR< -def snippet_for_set_settings18(): +def snippet_for_search_single_index66(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting redirect index + sort_facet_values_alphabetically """ - # >SEPARATOR setSettings attributesForFaceting redirect index + # >SEPARATOR searchSingleIndex sort_facet_values_alphabetically # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "query_terms", - ], + search_params={ + "query": "query", + "sortFacetValuesBy": "count", }, ) @@ -6598,25 +6760,27 @@ def snippet_for_set_settings18(): # SEPARATOR< -def snippet_for_set_settings19(): +def snippet_for_search_single_index67(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting multiple consequences + override_attributes_to_snippet """ - # >SEPARATOR setSettings attributesForFaceting multiple consequences + # >SEPARATOR searchSingleIndex override_attributes_to_snippet # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "director", - ], - }, + search_params={ + "query": "query", + "attributesToSnippet": [ + "title", + "content:80", + ], + }, ) # >LOG @@ -6625,24 +6789,23 @@ def snippet_for_set_settings19(): # SEPARATOR< -def snippet_for_set_settings20(): +def snippet_for_search_single_index68(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - attributesForFaceting in-depth optional filters + override_default_highlight_pre_tag """ - # >SEPARATOR setSettings attributesForFaceting in-depth optional filters + # >SEPARATOR searchSingleIndex override_default_highlight_pre_tag # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "attributesForFaceting": [ - "filterOnly(brand)", - ], + search_params={ + "query": "query", + "highlightPreTag": "", }, ) @@ -6652,22 +6815,23 @@ def snippet_for_set_settings20(): # SEPARATOR< -def snippet_for_set_settings21(): +def snippet_for_search_single_index69(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - mode neuralSearch + override_default_highlight_post_tag """ - # >SEPARATOR setSettings mode neuralSearch + # >SEPARATOR searchSingleIndex override_default_highlight_post_tag # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "mode": "neuralSearch", + search_params={ + "query": "query", + "highlightPostTag": "", }, ) @@ -6677,22 +6841,23 @@ def snippet_for_set_settings21(): # SEPARATOR< -def snippet_for_set_settings22(): +def snippet_for_search_single_index70(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - mode keywordSearch + override_default_snippet_ellipsis_text """ - # >SEPARATOR setSettings mode keywordSearch + # >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "mode": "keywordSearch", + search_params={ + "query": "query", + "snippetEllipsisText": "", }, ) @@ -6702,25 +6867,23 @@ def snippet_for_set_settings22(): # SEPARATOR< -def snippet_for_set_settings23(): +def snippet_for_search_single_index71(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - searchableAttributes same priority + enable_restrict_highlight_and_snippet_arrays """ - # >SEPARATOR setSettings searchableAttributes same priority + # >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "searchableAttributes": [ - "title,comments", - "ingredients", - ], + search_params={ + "query": "query", + "restrictHighlightAndSnippetArrays": False, }, ) @@ -6730,25 +6893,23 @@ def snippet_for_set_settings23(): # SEPARATOR< -def snippet_for_set_settings24(): +def snippet_for_search_single_index72(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - searchableAttributes higher priority + access_page """ - # >SEPARATOR setSettings searchableAttributes higher priority + # >SEPARATOR searchSingleIndex access_page # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "searchableAttributes": [ - "title", - "ingredients", - ], + search_params={ + "query": "query", + "page": 0, }, ) @@ -6758,25 +6919,23 @@ def snippet_for_set_settings24(): # SEPARATOR< -def snippet_for_set_settings25(): +def snippet_for_search_single_index73(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking retweets + override_default_hits_per_page """ - # >SEPARATOR setSettings customRanking retweets + # >SEPARATOR searchSingleIndex override_default_hits_per_page # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(retweets)", - "desc(likes)", - ], + search_params={ + "query": "query", + "hitsPerPage": 10, }, ) @@ -6786,24 +6945,23 @@ def snippet_for_set_settings25(): # SEPARATOR< -def snippet_for_set_settings26(): +def snippet_for_search_single_index74(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking boosted + get_nth_hit """ - # >SEPARATOR setSettings customRanking boosted + # >SEPARATOR searchSingleIndex get_nth_hit # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(boosted)", - ], + search_params={ + "query": "query", + "offset": 4, }, ) @@ -6813,25 +6971,23 @@ def snippet_for_set_settings26(): # SEPARATOR< -def snippet_for_set_settings27(): +def snippet_for_search_single_index75(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking pageviews + get_n_results """ - # >SEPARATOR setSettings customRanking pageviews + # >SEPARATOR searchSingleIndex get_n_results # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(pageviews)", - "desc(comments)", - ], + search_params={ + "query": "query", + "length": 4, }, ) @@ -6841,27 +6997,23 @@ def snippet_for_set_settings27(): # SEPARATOR< -def snippet_for_set_settings28(): +def snippet_for_search_single_index76(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking applying search parameters for a specific query + override_default_min_word_size_for_one_typo """ - # >SEPARATOR setSettings customRanking applying search parameters for a specific query + # >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(nb_airline_liaisons)", - ], - "attributesForFaceting": [ - "city, country", - ], + search_params={ + "query": "query", + "minWordSizefor1Typo": 2, }, ) @@ -6871,25 +7023,23 @@ def snippet_for_set_settings28(): # SEPARATOR< -def snippet_for_set_settings29(): +def snippet_for_search_single_index77(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking rounded pageviews + override_default_min_word_size_for_two_typos """ - # >SEPARATOR setSettings customRanking rounded pageviews + # >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(rounded_pageviews)", - "desc(comments)", - ], + search_params={ + "query": "query", + "minWordSizefor2Typos": 2, }, ) @@ -6899,24 +7049,23 @@ def snippet_for_set_settings29(): # SEPARATOR< -def snippet_for_set_settings30(): +def snippet_for_search_single_index78(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking price + override_default_typo_tolerance_mode """ - # >SEPARATOR setSettings customRanking price + # >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(price)", - ], + search_params={ + "query": "query", + "typoTolerance": False, }, ) @@ -6926,32 +7075,23 @@ def snippet_for_set_settings30(): # SEPARATOR< -def snippet_for_set_settings31(): +def snippet_for_search_single_index79(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - ranking exhaustive + disable_typos_on_numeric_tokens_at_search_time """ - # >SEPARATOR setSettings ranking exhaustive + # >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "ranking": [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + search_params={ + "query": "query", + "allowTyposOnNumericTokens": False, }, ) @@ -6961,24 +7101,23 @@ def snippet_for_set_settings31(): # SEPARATOR< -def snippet_for_set_settings32(): +def snippet_for_search_single_index80(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - ranking standard replica + search_around_a_position """ - # >SEPARATOR setSettings ranking standard replica + # >SEPARATOR searchSingleIndex search_around_a_position # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "ranking": [ - "desc(post_date_timestamp)", - ], + search_params={ + "query": "query", + "aroundLatLng": "40.71, -74.01", }, ) @@ -6988,24 +7127,28 @@ def snippet_for_set_settings32(): # SEPARATOR< -def snippet_for_set_settings33(): +def snippet_for_search_single_index81(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - ranking virtual replica + search_around_server_ip """ - # >SEPARATOR setSettings ranking virtual replica + # >SEPARATOR searchSingleIndex search_around_server_ip # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "desc(post_date_timestamp)", - ], + search_params={ + "query": "query", + "aroundLatLngViaIP": True, + }, + request_options={ + "headers": loads( + """{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}""" + ), }, ) @@ -7015,34 +7158,23 @@ def snippet_for_set_settings33(): # SEPARATOR< -def snippet_for_set_settings34(): +def snippet_for_search_single_index82(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - customRanking and ranking sort alphabetically + set_around_radius """ - # >SEPARATOR setSettings customRanking and ranking sort alphabetically + # >SEPARATOR searchSingleIndex set_around_radius # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "ranking": [ - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - ], + search_params={ + "query": "query", + "aroundRadius": 1000, }, ) @@ -7052,25 +7184,23 @@ def snippet_for_set_settings34(): # SEPARATOR< -def snippet_for_set_settings35(): +def snippet_for_search_single_index83(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - relevancyStrictness + disable_automatic_radius """ - # >SEPARATOR setSettings relevancyStrictness + # >SEPARATOR searchSingleIndex disable_automatic_radius # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "relevancyStrictness": 0, + search_params={ + "query": "query", + "aroundRadius": "all", }, ) @@ -7080,24 +7210,23 @@ def snippet_for_set_settings35(): # SEPARATOR< -def snippet_for_set_settings36(): +def snippet_for_search_single_index84(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - create replica index + set_geo_search_precision """ - # >SEPARATOR setSettings create replica index + # >SEPARATOR searchSingleIndex set_geo_search_precision # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "replicas": [ - "products_price_desc", - ], + search_params={ + "query": "query", + "aroundPrecision": 100, }, ) @@ -7107,23 +7236,31 @@ def snippet_for_set_settings36(): # SEPARATOR< -def snippet_for_set_settings37(): +def snippet_for_search_single_index85(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. - create virtual replica index + set_geo_search_precision_non_linear """ - # >SEPARATOR setSettings create virtual replica index + # >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( index_name="", - index_settings={ - "replicas": [ - "virtual(products_price_desc)", + search_params={ + "query": "query", + "aroundPrecision": [ + { + "from": 0, + "value": 25, + }, + { + "from": 2000, + "value": 1000, + }, ], }, ) @@ -7134,13 +7271,4183 @@ def snippet_for_set_settings37(): # SEPARATOR< -def snippet_for_set_settings38(): +def snippet_for_search_single_index86(): """ - Snippet for the setSettings method. + Snippet for the searchSingleIndex method. + + set_minimum_geo_search_radius + """ + # >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "minimumAroundRadius": 1000, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index87(): + """ + Snippet for the searchSingleIndex method. + + search_inside_rectangular_area + """ + # >SEPARATOR searchSingleIndex search_inside_rectangular_area + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index88(): + """ + Snippet for the searchSingleIndex method. + + search_inside_multiple_rectangular_areas + """ + # >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index89(): + """ + Snippet for the searchSingleIndex method. + + search_inside_polygon_area + """ + # >SEPARATOR searchSingleIndex search_inside_polygon_area + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index90(): + """ + Snippet for the searchSingleIndex method. + + search_inside_multiple_polygon_areas + """ + # >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "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, + ], + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index91(): + """ + Snippet for the searchSingleIndex method. + + set_querylanguages_override + """ + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "ignorePlurals": [ + "ca", + "es", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index92(): + """ + Snippet for the searchSingleIndex method. + + set_querylanguages_override + """ + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index93(): + """ + Snippet for the searchSingleIndex method. + + set_querylanguages_override + """ + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index94(): + """ + Snippet for the searchSingleIndex method. + + set_querylanguages_with_japanese_query + """ + # >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "queryLanguages": [ + "ja", + "en", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index95(): + """ + Snippet for the searchSingleIndex method. + + set_natural_languages + """ + # >SEPARATOR searchSingleIndex set_natural_languages + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index96(): + """ + Snippet for the searchSingleIndex method. + + override_natural_languages_with_query + """ + # >SEPARATOR searchSingleIndex override_natural_languages_with_query + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", + ], + "removeWordsIfNoResults": "firstWords", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index97(): + """ + Snippet for the searchSingleIndex method. + + enable_decompound_query_search_time + """ + # >SEPARATOR searchSingleIndex enable_decompound_query_search_time + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "decompoundQuery": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index98(): + """ + Snippet for the searchSingleIndex method. + + enable_rules_search_time + """ + # >SEPARATOR searchSingleIndex enable_rules_search_time + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enableRules": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index99(): + """ + Snippet for the searchSingleIndex method. + + set_rule_contexts + """ + # >SEPARATOR searchSingleIndex set_rule_contexts + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "ruleContexts": [ + "front_end", + "website2", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index100(): + """ + Snippet for the searchSingleIndex method. + + enable_personalization + """ + # >SEPARATOR searchSingleIndex enable_personalization + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enablePersonalization": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index101(): + """ + Snippet for the searchSingleIndex method. + + enable_personalization_with_user_token + """ + # >SEPARATOR searchSingleIndex enable_personalization_with_user_token + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index102(): + """ + Snippet for the searchSingleIndex method. + + personalization_impact + """ + # >SEPARATOR searchSingleIndex personalization_impact + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "personalizationImpact": 20, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index103(): + """ + Snippet for the searchSingleIndex method. + + set_user_token + """ + # >SEPARATOR searchSingleIndex set_user_token + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "userToken": "123456", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index104(): + """ + Snippet for the searchSingleIndex method. + + set_user_token_with_personalization + """ + # >SEPARATOR searchSingleIndex set_user_token_with_personalization + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index105(): + """ + Snippet for the searchSingleIndex method. + + override_default_query_type + """ + # >SEPARATOR searchSingleIndex override_default_query_type + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "queryType": "prefixAll", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index106(): + """ + Snippet for the searchSingleIndex method. + + override_default_remove_words_if_no_results + """ + # >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "removeWordsIfNoResults": "lastWords", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index107(): + """ + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_search_time + """ + # >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "advancedSyntax": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index108(): + """ + Snippet for the searchSingleIndex method. + + overide_default_optional_words + """ + # >SEPARATOR searchSingleIndex overide_default_optional_words + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "optionalWords": [ + "toyota", + "2020 2021", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index109(): + """ + Snippet for the searchSingleIndex method. + + disabling_exact_for_some_attributes_search_time + """ + # >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "disableExactOnAttributes": [ + "description", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index110(): + """ + Snippet for the searchSingleIndex method. + + override_default_exact_single_word_query + """ + # >SEPARATOR searchSingleIndex override_default_exact_single_word_query + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "exactOnSingleWordQuery": "none", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index111(): + """ + Snippet for the searchSingleIndex method. + + override_default_aternative_as_exact + """ + # >SEPARATOR searchSingleIndex override_default_aternative_as_exact + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "alternativesAsExact": [ + "multiWordsSynonym", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index112(): + """ + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_exact_phrase + """ + # >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index113(): + """ + Snippet for the searchSingleIndex method. + + enable_advanced_syntax_exclude_words + """ + # >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "excludeWords", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index114(): + """ + Snippet for the searchSingleIndex method. + + override_distinct + """ + # >SEPARATOR searchSingleIndex override_distinct + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "distinct": 0, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index115(): + """ + Snippet for the searchSingleIndex method. + + get_ranking_info + """ + # >SEPARATOR searchSingleIndex get_ranking_info + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "getRankingInfo": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index116(): + """ + Snippet for the searchSingleIndex method. + + disable_click_analytics + """ + # >SEPARATOR searchSingleIndex disable_click_analytics + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "clickAnalytics": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index117(): + """ + Snippet for the searchSingleIndex method. + + enable_click_analytics + """ + # >SEPARATOR searchSingleIndex enable_click_analytics + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "clickAnalytics": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index118(): + """ + Snippet for the searchSingleIndex method. + + disable_analytics + """ + # >SEPARATOR searchSingleIndex disable_analytics + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "analytics": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index119(): + """ + Snippet for the searchSingleIndex method. + + add_analytics_tags + """ + # >SEPARATOR searchSingleIndex add_analytics_tags + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "analyticsTags": [ + "front_end", + "website2", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index120(): + """ + Snippet for the searchSingleIndex method. + + disable_synonyms + """ + # >SEPARATOR searchSingleIndex disable_synonyms + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "synonyms": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index121(): + """ + Snippet for the searchSingleIndex method. + + override_replace_synonyms_in_highlights + """ + # >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "replaceSynonymsInHighlight": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index122(): + """ + Snippet for the searchSingleIndex method. + + override_min_proximity + """ + # >SEPARATOR searchSingleIndex override_min_proximity + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "minProximity": 2, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index123(): + """ + Snippet for the searchSingleIndex method. + + override_default_field + """ + # >SEPARATOR searchSingleIndex override_default_field + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "responseFields": [ + "hits", + "facets", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index124(): + """ + Snippet for the searchSingleIndex method. + + override_percentile_computation + """ + # >SEPARATOR searchSingleIndex override_percentile_computation + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "percentileComputation": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index125(): + """ + Snippet for the searchSingleIndex method. + + set_ab_test + """ + # >SEPARATOR searchSingleIndex set_ab_test + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enableABTest": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_single_index126(): + """ + Snippet for the searchSingleIndex method. + + set_enable_re_ranking + """ + # >SEPARATOR searchSingleIndex set_enable_re_ranking + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + index_name="", + search_params={ + "query": "query", + "enableReRanking": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_synonyms(): + """ + Snippet for the searchSynonyms method. + + searchSynonyms with minimal parameters + """ + # >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_synonyms( + index_name="", + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_synonyms1(): + """ + Snippet for the searchSynonyms method. + + searchSynonyms with all parameters + """ + # >SEPARATOR searchSynonyms searchSynonyms with all parameters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_synonyms( + index_name="", + search_synonyms_params={ + "query": "myQuery", + "type": "altcorrection1", + "page": 10, + "hitsPerPage": 10, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_search_user_ids(): + """ + Snippet for the searchUserIds method. + + searchUserIds + """ + # >SEPARATOR searchUserIds default + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_user_ids( + search_user_ids_params={ + "query": "test", + "clusterName": "theClusterName", + "page": 5, + "hitsPerPage": 10, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_client_api_key(): + """ + Snippet for the setClientApiKey method. + + switch API key + """ + # >SEPARATOR setClientApiKey default + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + client.set_client_api_key( + api_key="updated-api-key", + ) + + # >LOG + # SEPARATOR< + + +def snippet_for_set_dictionary_settings(): + """ + Snippet for the setDictionarySettings method. + + get setDictionarySettings results with minimal parameters + """ + # >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_dictionary_settings( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_dictionary_settings1(): + """ + Snippet for the setDictionarySettings method. + + get setDictionarySettings results with all parameters + """ + # >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_dictionary_settings( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + "stopwords": { + "fr": False, + }, + "compounds": { + "ru": True, + }, + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings(): + """ + Snippet for the setSettings method. + + minimal parameters + """ + # >SEPARATOR setSettings minimal parameters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "paginationLimitedTo": 10, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings1(): + """ + Snippet for the setSettings method. + + boolean typoTolerance + """ + # >SEPARATOR setSettings boolean typoTolerance + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "typoTolerance": True, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings2(): + """ + Snippet for the setSettings method. + + enum typoTolerance + """ + # >SEPARATOR setSettings enum typoTolerance + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "typoTolerance": "min", + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings3(): + """ + Snippet for the setSettings method. + + ignorePlurals + """ + # >SEPARATOR setSettings ignorePlurals + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ignorePlurals": True, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings4(): + """ + Snippet for the setSettings method. + + list of string ignorePlurals + """ + # >SEPARATOR setSettings list of string ignorePlurals + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ignorePlurals": [ + "fr", + ], + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings5(): + """ + Snippet for the setSettings method. + + removeStopWords boolean + """ + # >SEPARATOR setSettings removeStopWords boolean + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "removeStopWords": True, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings6(): + """ + Snippet for the setSettings method. + + removeStopWords list of string + """ + # >SEPARATOR setSettings removeStopWords list of string + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "removeStopWords": [ + "fr", + ], + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings7(): + """ + Snippet for the setSettings method. + + boolean distinct + """ + # >SEPARATOR setSettings boolean distinct + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "distinct": True, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings8(): + """ + Snippet for the setSettings method. + + integer distinct + """ + # >SEPARATOR setSettings integer distinct + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "distinct": 1, + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings9(): + """ + Snippet for the setSettings method. + + distinct company + """ + # >SEPARATOR setSettings distinct company + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributeForDistinct": "company", + "distinct": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings10(): + """ + Snippet for the setSettings method. + + distinct design + """ + # >SEPARATOR setSettings distinct design + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributeForDistinct": "design", + "distinct": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings11(): + """ + Snippet for the setSettings method. + + distinct true + """ + # >SEPARATOR setSettings distinct true + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "distinct": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings12(): + """ + Snippet for the setSettings method. + + distinct section + """ + # >SEPARATOR setSettings distinct section + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributeForDistinct": "section", + "distinct": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings13(): + """ + Snippet for the setSettings method. + + attributesForFaceting allergens + """ + # >SEPARATOR setSettings attributesForFaceting allergens + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "allergens", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings14(): + """ + Snippet for the setSettings method. + + api_attributes_for_faceting + """ + # >SEPARATOR setSettings api_attributes_for_faceting + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "author", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings15(): + """ + Snippet for the setSettings method. + + api_attributes_for_faceting_searchable + """ + # >SEPARATOR setSettings api_attributes_for_faceting_searchable + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "searchable(author)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings16(): + """ + Snippet for the setSettings method. + + api_attributes_for_filter_only + """ + # >SEPARATOR setSettings api_attributes_for_filter_only + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(genre)", + "author", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings17(): + """ + Snippet for the setSettings method. + + attributesForFaceting categoryPageId + """ + # >SEPARATOR setSettings attributesForFaceting categoryPageId + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "searchable(categoryPageId)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings18(): + """ + Snippet for the setSettings method. + + unretrievableAttributes + """ + # >SEPARATOR setSettings unretrievableAttributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "unretrievableAttributes": [ + "visible_by", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings19(): + """ + Snippet for the setSettings method. + + attributesForFaceting user restricted data + """ + # >SEPARATOR setSettings attributesForFaceting user restricted data + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(visible_by)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings20(): + """ + Snippet for the setSettings method. + + attributesForFaceting optional filters + """ + # >SEPARATOR setSettings attributesForFaceting optional filters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "can_deliver_quickly", + "restaurant", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings21(): + """ + Snippet for the setSettings method. + + attributesForFaceting redirect index + """ + # >SEPARATOR setSettings attributesForFaceting redirect index + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "query_terms", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings22(): + """ + Snippet for the setSettings method. + + attributesForFaceting multiple consequences + """ + # >SEPARATOR setSettings attributesForFaceting multiple consequences + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "director", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings23(): + """ + Snippet for the setSettings method. + + attributesForFaceting in-depth optional filters + """ + # >SEPARATOR setSettings attributesForFaceting in-depth optional filters + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(brand)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings24(): + """ + Snippet for the setSettings method. + + mode neuralSearch + """ + # >SEPARATOR setSettings mode neuralSearch + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "mode": "neuralSearch", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings25(): + """ + Snippet for the setSettings method. + + mode keywordSearch + """ + # >SEPARATOR setSettings mode keywordSearch + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "mode": "keywordSearch", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings26(): + """ + Snippet for the setSettings method. + + searchableAttributes same priority + """ + # >SEPARATOR setSettings searchableAttributes same priority + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "title,comments", + "ingredients", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings27(): + """ + Snippet for the setSettings method. + + searchableAttributes higher priority + """ + # >SEPARATOR setSettings searchableAttributes higher priority + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "title", + "ingredients", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings28(): + """ + Snippet for the setSettings method. + + customRanking retweets + """ + # >SEPARATOR setSettings customRanking retweets + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(retweets)", + "desc(likes)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings29(): + """ + Snippet for the setSettings method. + + customRanking boosted + """ + # >SEPARATOR setSettings customRanking boosted + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(boosted)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings30(): + """ + Snippet for the setSettings method. + + customRanking pageviews + """ + # >SEPARATOR setSettings customRanking pageviews + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(pageviews)", + "desc(comments)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings31(): + """ + Snippet for the setSettings method. + + customRanking applying search parameters for a specific query + """ + # >SEPARATOR setSettings customRanking applying search parameters for a specific query + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(nb_airline_liaisons)", + ], + "attributesForFaceting": [ + "city, country", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings32(): + """ + Snippet for the setSettings method. + + customRanking rounded pageviews + """ + # >SEPARATOR setSettings customRanking rounded pageviews + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(rounded_pageviews)", + "desc(comments)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings33(): + """ + Snippet for the setSettings method. + + customRanking price + """ + # >SEPARATOR setSettings customRanking price + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(price)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings34(): + """ + Snippet for the setSettings method. + + ranking exhaustive + """ + # >SEPARATOR setSettings ranking exhaustive + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings35(): + """ + Snippet for the setSettings method. + + ranking standard replica + """ + # >SEPARATOR setSettings ranking standard replica + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "desc(post_date_timestamp)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings36(): + """ + Snippet for the setSettings method. + + ranking virtual replica + """ + # >SEPARATOR setSettings ranking virtual replica + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(post_date_timestamp)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings37(): + """ + Snippet for the setSettings method. + + customRanking and ranking sort alphabetically + """ + # >SEPARATOR setSettings customRanking and ranking sort alphabetically + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "ranking": [ + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings38(): + """ + Snippet for the setSettings method. + + relevancyStrictness + """ + # >SEPARATOR setSettings relevancyStrictness + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "relevancyStrictness": 0, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings39(): + """ + Snippet for the setSettings method. + + create replica index + """ + # >SEPARATOR setSettings create replica index + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "replicas": [ + "products_price_desc", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings40(): + """ + Snippet for the setSettings method. + + create replica index articles + """ + # >SEPARATOR setSettings create replica index articles + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "replicas": [ + "articles_date_desc", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings41(): + """ + Snippet for the setSettings method. + + create virtual replica index + """ + # >SEPARATOR setSettings create virtual replica index + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "replicas": [ + "virtual(products_price_desc)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings42(): + """ + Snippet for the setSettings method. + + unlink replica index + """ + # >SEPARATOR setSettings unlink replica index + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "replicas": [ + "", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings43(): + """ + Snippet for the setSettings method. + + forwardToReplicas + """ + # >SEPARATOR setSettings forwardToReplicas + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "name", + "description", + ], + }, + forward_to_replicas=True, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings44(): + """ + Snippet for the setSettings method. + + maxValuesPerFacet + """ + # >SEPARATOR setSettings maxValuesPerFacet + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "maxValuesPerFacet": 1000, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings45(): + """ + Snippet for the setSettings method. + + maxFacetHits + """ + # >SEPARATOR setSettings maxFacetHits + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "maxFacetHits": 1000, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings46(): + """ + Snippet for the setSettings method. + + attributesForFaceting complex + """ + # >SEPARATOR setSettings attributesForFaceting complex + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings47(): + """ + Snippet for the setSettings method. + + ranking closest dates + """ + # >SEPARATOR setSettings ranking closest dates + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings48(): + """ + Snippet for the setSettings method. + + searchableAttributes item variation + """ + # >SEPARATOR setSettings searchableAttributes item variation + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "design", + "type", + "color", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings49(): + """ + Snippet for the setSettings method. + + searchableAttributes around location + """ + # >SEPARATOR setSettings searchableAttributes around location + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "name", + "country", + "code", + "iata_code", + ], + "customRanking": [ + "desc(links_count)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings50(): + """ + Snippet for the setSettings method. + + attributesToHighlight + """ + # >SEPARATOR setSettings attributesToHighlight + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToHighlight": [ + "author", + "title", + "content", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings51(): + """ + Snippet for the setSettings method. + + attributesToHighlightStar + """ + # >SEPARATOR setSettings attributesToHighlightStar + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToHighlight": [ + "*", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings52(): + """ + Snippet for the setSettings method. + + everything + """ + # >SEPARATOR setSettings everything + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], + "allowCompressionOfIntegerArray": True, + "allowTyposOnNumericTokens": True, + "alternativesAsExact": [ + "singleWordSynonym", + ], + "attributeCriteriaComputedByMinProximity": True, + "attributeForDistinct": "test", + "attributesForFaceting": [ + "algolia", + ], + "attributesToHighlight": [ + "algolia", + ], + "attributesToRetrieve": [ + "algolia", + ], + "attributesToSnippet": [ + "algolia", + ], + "attributesToTransliterate": [ + "algolia", + ], + "camelCaseAttributes": [ + "algolia", + ], + "customNormalization": { + "algolia": { + "aloglia": "aglolia", + }, + }, + "customRanking": [ + "algolia", + ], + "decompoundQuery": False, + "decompoundedAttributes": { + "algolia": "aloglia", + }, + "disableExactOnAttributes": [ + "algolia", + ], + "disablePrefixOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnWords": [ + "algolia", + ], + "distinct": 3, + "enablePersonalization": True, + "enableReRanking": False, + "enableRules": True, + "exactOnSingleWordQuery": "attribute", + "highlightPreTag": "", + "highlightPostTag": "", + "hitsPerPage": 10, + "ignorePlurals": False, + "indexLanguages": [ + "fr", + ], + "keepDiacriticsOnCharacters": "abc", + "maxFacetHits": 20, + "maxValuesPerFacet": 30, + "minProximity": 6, + "minWordSizefor1Typo": 5, + "minWordSizefor2Typos": 11, + "mode": "neuralSearch", + "numericAttributesForFiltering": [ + "algolia", + ], + "optionalWords": [ + "myspace", + ], + "paginationLimitedTo": 0, + "queryLanguages": [ + "fr", + ], + "queryType": "prefixLast", + "ranking": [ + "geo", + ], + "reRankingApplyFilter": "mySearch:filters", + "relevancyStrictness": 10, + "removeStopWords": False, + "removeWordsIfNoResults": "lastWords", + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "a", + "b", + ], + }, + "values": { + "a": { + "order": [ + "b", + ], + "sortRemainingBy": "count", + }, + }, + }, + }, + "replaceSynonymsInHighlight": True, + "replicas": [ + "", + ], + "responseFields": [ + "algolia", + ], + "restrictHighlightAndSnippetArrays": True, + "searchableAttributes": [ + "foo", + ], + "semanticSearch": { + "eventSources": [ + "foo", + ], + }, + "separatorsToIndex": "bar", + "snippetEllipsisText": "---", + "sortFacetValuesBy": "date", + "typoTolerance": False, + "unretrievableAttributes": [ + "foo", + ], + "userData": { + "user": "data", + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings53(): + """ + Snippet for the setSettings method. + + searchableAttributesWithCustomRankingsAndAttributesForFaceting + """ + # >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "brand", + "name", + "categories", + "unordered(description)", + ], + "customRanking": [ + "desc(popularity)", + ], + "attributesForFaceting": [ + "searchable(brand)", + "type", + "categories", + "price", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings54(): + """ + Snippet for the setSettings method. + + searchableAttributesOrdering + """ + # >SEPARATOR setSettings searchableAttributesOrdering + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "unordered(title)", + "cast", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings55(): + """ + Snippet for the setSettings method. + + searchableAttributesProductReferenceSuffixes + """ + # >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "name", + "product_reference", + "product_reference_suffixes", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings56(): + """ + Snippet for the setSettings method. + + queryLanguageAndIgnorePlurals + """ + # >SEPARATOR setSettings queryLanguageAndIgnorePlurals + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "queryLanguages": [ + "en", + ], + "ignorePlurals": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings57(): + """ + Snippet for the setSettings method. + + searchableAttributesInMovies + """ + # >SEPARATOR setSettings searchableAttributesInMovies + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "title_eng", + "title_fr", + "title_es", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings58(): + """ + Snippet for the setSettings method. + + disablePrefixOnAttributes + """ + # >SEPARATOR setSettings disablePrefixOnAttributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "disablePrefixOnAttributes": [ + "serial_number", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings59(): + """ + Snippet for the setSettings method. + + disableTypoToleranceOnAttributes + """ + # >SEPARATOR setSettings disableTypoToleranceOnAttributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "disableTypoToleranceOnAttributes": [ + "serial_number", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings60(): + """ + Snippet for the setSettings method. + + searchableAttributesSimpleExample + """ + # >SEPARATOR setSettings searchableAttributesSimpleExample + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "serial_number", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings61(): + """ + Snippet for the setSettings method. + + searchableAttributesSimpleExampleAlt + """ + # >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "serial_number", + "serial_number_suffixes", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings62(): + """ + Snippet for the setSettings method. + + set_searchable_attributes + """ + # >SEPARATOR setSettings set_searchable_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "searchableAttributes": [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings63(): + """ + Snippet for the setSettings method. + + set_searchable_attributes + """ + # >SEPARATOR setSettings set_searchable_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesForFaceting": [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings64(): + """ + Snippet for the setSettings method. + + unretrievable_attributes + """ + # >SEPARATOR setSettings unretrievable_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "unretrievableAttributes": [ + "total_number_of_sales", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings65(): + """ + Snippet for the setSettings method. + + set_retrievable_attributes + """ + # >SEPARATOR setSettings set_retrievable_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToRetrieve": [ + "author", + "title", + "content", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings66(): + """ + Snippet for the setSettings method. + + set_all_attributes_as_retrievable + """ + # >SEPARATOR setSettings set_all_attributes_as_retrievable + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToRetrieve": [ + "*", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings67(): + """ + Snippet for the setSettings method. + + specify_attributes_not_to_retrieve + """ + # >SEPARATOR setSettings specify_attributes_not_to_retrieve + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToRetrieve": [ + "*", + "-SKU", + "-internal_desc", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings68(): + """ + Snippet for the setSettings method. + + neural_search + """ + # >SEPARATOR setSettings neural_search + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "mode": "neuralSearch", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings69(): + """ + Snippet for the setSettings method. + + keyword_search + """ + # >SEPARATOR setSettings keyword_search + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "mode": "keywordSearch", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings70(): + """ + Snippet for the setSettings method. + + set_default_ranking + """ + # >SEPARATOR setSettings set_default_ranking + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings71(): + """ + Snippet for the setSettings method. + + set_ranking_by_attribute_asc + """ + # >SEPARATOR setSettings set_ranking_by_attribute_asc + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings72(): + """ + Snippet for the setSettings method. + + set_ranking_by_attribute_desc + """ + # >SEPARATOR setSettings set_ranking_by_attribute_desc + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings73(): + """ + Snippet for the setSettings method. + + restrict_searchable_attributes + """ + # >SEPARATOR setSettings restrict_searchable_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customRanking": [ + "desc(popularity)", + "asc(price)", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings74(): + """ + Snippet for the setSettings method. + + set_default_relevancy + """ + # >SEPARATOR setSettings set_default_relevancy + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "relevancyStrictness": 90, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings75(): + """ + Snippet for the setSettings method. + + set_replicas + """ + # >SEPARATOR setSettings set_replicas + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "replicas": [ + "name_of_replica_index1", + "name_of_replica_index2", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings76(): + """ + Snippet for the setSettings method. + + set_default_max_values_per_facet + """ + # >SEPARATOR setSettings set_default_max_values_per_facet + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "maxValuesPerFacet": 100, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings77(): + """ + Snippet for the setSettings method. + + set_default_sort_facet_values_by + """ + # >SEPARATOR setSettings set_default_sort_facet_values_by + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "sortFacetValuesBy": "alpha", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings78(): + """ + Snippet for the setSettings method. + + set_attributes_to_snippet + """ + # >SEPARATOR setSettings set_attributes_to_snippet + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToSnippet": [ + "content:80", + "description", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings79(): + """ + Snippet for the setSettings method. + + set_all_attributes_to_snippet + """ + # >SEPARATOR setSettings set_all_attributes_to_snippet + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "attributesToSnippet": [ + "*:80", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings80(): + """ + Snippet for the setSettings method. + + set_default_highlight_pre_tag + """ + # >SEPARATOR setSettings set_default_highlight_pre_tag + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "highlightPreTag": "", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings81(): + """ + Snippet for the setSettings method. + + set_default_highlight_post_tag + """ + # >SEPARATOR setSettings set_default_highlight_post_tag + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "highlightPostTag": "", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings82(): + """ + Snippet for the setSettings method. + + set_default_snippet_ellipsis_text + """ + # >SEPARATOR setSettings set_default_snippet_ellipsis_text + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "snippetEllipsisText": "…", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings83(): + """ + Snippet for the setSettings method. + + enable_restrict_highlight_and_snippet_arrays_by_default + """ + # >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "restrictHighlightAndSnippetArrays": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings84(): + """ + Snippet for the setSettings method. + + set_default_hits_per_page + """ + # >SEPARATOR setSettings set_default_hits_per_page + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "hitsPerPage": 20, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings85(): + """ + Snippet for the setSettings method. + + set_pagination_limit + """ + # >SEPARATOR setSettings set_pagination_limit + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "paginationLimitedTo": 1000, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings86(): + """ + Snippet for the setSettings method. + + set_default_min_word_size_for_one_typo + """ + # >SEPARATOR setSettings set_default_min_word_size_for_one_typo + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "minWordSizefor1Typo": 4, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings87(): + """ + Snippet for the setSettings method. + + set_default_min_word_size_for_two_typos + """ + # >SEPARATOR setSettings set_default_min_word_size_for_two_typos + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "minWordSizefor2Typos": 4, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings88(): + """ + Snippet for the setSettings method. + + set_default_typo_tolerance_mode + """ + # >SEPARATOR setSettings set_default_typo_tolerance_mode + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "typoTolerance": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings89(): + """ + Snippet for the setSettings method. + + disable_typos_on_numeric_tokens_by_default + """ + # >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "allowTyposOnNumericTokens": False, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings90(): + """ + Snippet for the setSettings method. + + disable_typo_tolerance_for_words + """ + # >SEPARATOR setSettings disable_typo_tolerance_for_words + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "disableTypoToleranceOnWords": [ + "wheel", + "1X2BCD", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings91(): + """ + Snippet for the setSettings method. + + set_separators_to_index + """ + # >SEPARATOR setSettings set_separators_to_index + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "separatorsToIndex": "+#", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings92(): + """ + Snippet for the setSettings method. + + set_languages_using_querylanguages + """ + # >SEPARATOR setSettings set_languages_using_querylanguages + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "queryLanguages": [ + "es", + ], + "ignorePlurals": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings93(): + """ + Snippet for the setSettings method. + + set_attributes_to_transliterate + """ + # >SEPARATOR setSettings set_attributes_to_transliterate + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "indexLanguages": [ + "ja", + ], + "attributesToTransliterate": [ + "name", + "description", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings94(): + """ + Snippet for the setSettings method. + + set_languages_using_querylanguages + """ + # >SEPARATOR setSettings set_languages_using_querylanguages + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "queryLanguages": [ + "es", + ], + "removeStopWords": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings95(): + """ + Snippet for the setSettings method. + + set_camel_case_attributes + """ + # >SEPARATOR setSettings set_camel_case_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "camelCaseAttributes": [ + "description", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings96(): + """ + Snippet for the setSettings method. + + set_decompounded_attributes + """ + # >SEPARATOR setSettings set_decompounded_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "decompoundedAttributes": { + "de": [ + "name", + ], + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings97(): + """ + Snippet for the setSettings method. + + set_decompounded_multiple_attributes + """ + # >SEPARATOR setSettings set_decompounded_multiple_attributes + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") - unlink replica index + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "decompoundedAttributes": { + "de": [ + "name_de", + "description_de", + ], + "fi": [ + "name_fi", + "description_fi", + ], + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings98(): """ - # >SEPARATOR setSettings unlink replica index + Snippet for the setSettings method. + + set_keep_diacritics_on_characters + """ + # >SEPARATOR setSettings set_keep_diacritics_on_characters # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7149,9 +11456,65 @@ def snippet_for_set_settings38(): response = client.set_settings( index_name="", index_settings={ - "replicas": [ - "", + "keepDiacriticsOnCharacters": "øé", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings99(): + """ + Snippet for the setSettings method. + + set_custom_normalization + """ + # >SEPARATOR setSettings set_custom_normalization + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "customNormalization": { + "default": { + "ä": "ae", + }, + }, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings100(): + """ + Snippet for the setSettings method. + + set_languages_using_querylanguages + """ + # >SEPARATOR setSettings set_languages_using_querylanguages + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "queryLanguages": [ + "es", ], + "removeStopWords": True, + "ignorePlurals": True, }, ) @@ -7161,13 +11524,13 @@ def snippet_for_set_settings38(): # SEPARATOR< -def snippet_for_set_settings39(): +def snippet_for_set_settings101(): """ Snippet for the setSettings method. - forwardToReplicas + set_indexlanguages """ - # >SEPARATOR setSettings forwardToReplicas + # >SEPARATOR setSettings set_indexlanguages # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7176,12 +11539,10 @@ def snippet_for_set_settings39(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "name", - "description", + "indexLanguages": [ + "ja", ], }, - forward_to_replicas=True, ) # >LOG @@ -7190,13 +11551,13 @@ def snippet_for_set_settings39(): # SEPARATOR< -def snippet_for_set_settings40(): +def snippet_for_set_settings102(): """ Snippet for the setSettings method. - maxValuesPerFacet + enable_decompound_query_by_default """ - # >SEPARATOR setSettings maxValuesPerFacet + # >SEPARATOR setSettings enable_decompound_query_by_default # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7205,7 +11566,7 @@ def snippet_for_set_settings40(): response = client.set_settings( index_name="", index_settings={ - "maxValuesPerFacet": 1000, + "decompoundQuery": True, }, ) @@ -7215,13 +11576,13 @@ def snippet_for_set_settings40(): # SEPARATOR< -def snippet_for_set_settings41(): +def snippet_for_set_settings103(): """ Snippet for the setSettings method. - maxFacetHits + enable_rules_syntax_by_default """ - # >SEPARATOR setSettings maxFacetHits + # >SEPARATOR setSettings enable_rules_syntax_by_default # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7230,7 +11591,7 @@ def snippet_for_set_settings41(): response = client.set_settings( index_name="", index_settings={ - "maxFacetHits": 1000, + "enableRules": True, }, ) @@ -7240,13 +11601,13 @@ def snippet_for_set_settings41(): # SEPARATOR< -def snippet_for_set_settings42(): +def snippet_for_set_settings104(): """ Snippet for the setSettings method. - attributesForFaceting complex + enable_personalization_settings """ - # >SEPARATOR setSettings attributesForFaceting complex + # >SEPARATOR setSettings enable_personalization_settings # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7255,10 +11616,109 @@ def snippet_for_set_settings42(): response = client.set_settings( index_name="", index_settings={ - "attributesForFaceting": [ - "actor", - "filterOnly(category)", - "searchable(publisher)", + "enablePersonalization": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings105(): + """ + Snippet for the setSettings method. + + set_default_query_type + """ + # >SEPARATOR setSettings set_default_query_type + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "queryType": "prefixLast", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings106(): + """ + Snippet for the setSettings method. + + set_default_remove_words_if_no_result + """ + # >SEPARATOR setSettings set_default_remove_words_if_no_result + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "removeWordsIfNoResults": "none", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings107(): + """ + Snippet for the setSettings method. + + enable_advanced_syntax_by_default + """ + # >SEPARATOR setSettings enable_advanced_syntax_by_default + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "advancedSyntax": True, + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings108(): + """ + Snippet for the setSettings method. + + set_default_optional_words + """ + # >SEPARATOR setSettings set_default_optional_words + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "optionalWords": [ + "blue", + "iphone case", ], }, ) @@ -7269,13 +11729,13 @@ def snippet_for_set_settings42(): # SEPARATOR< -def snippet_for_set_settings43(): +def snippet_for_set_settings109(): """ Snippet for the setSettings method. - ranking closest dates + disabling_prefix_search_for_some_attributes_by_default """ - # >SEPARATOR setSettings ranking closest dates + # >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7284,16 +11744,8 @@ def snippet_for_set_settings43(): response = client.set_settings( index_name="", index_settings={ - "ranking": [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + "disablePrefixOnAttributes": [ + "sku", ], }, ) @@ -7304,13 +11756,13 @@ def snippet_for_set_settings43(): # SEPARATOR< -def snippet_for_set_settings44(): +def snippet_for_set_settings110(): """ Snippet for the setSettings method. - searchableAttributes item variation + disabling_exact_for_some_attributes_by_default """ - # >SEPARATOR setSettings searchableAttributes item variation + # >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7319,10 +11771,8 @@ def snippet_for_set_settings44(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "design", - "type", - "color", + "disableExactOnAttributes": [ + "description", ], }, ) @@ -7333,13 +11783,66 @@ def snippet_for_set_settings44(): # SEPARATOR< -def snippet_for_set_settings45(): +def snippet_for_set_settings111(): + """ + Snippet for the setSettings method. + + set_default_exact_single_word_query + """ + # >SEPARATOR setSettings set_default_exact_single_word_query + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "exactOnSingleWordQuery": "attribute", + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings112(): + """ + Snippet for the setSettings method. + + set_default_aternative_as_exact + """ + # >SEPARATOR setSettings set_default_aternative_as_exact + # Initialize the client + # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. + client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + index_name="", + index_settings={ + "alternativesAsExact": [ + "ignorePlurals", + "singleWordSynonym", + ], + }, + ) + + # >LOG + # use the class directly + print(response) + # SEPARATOR< + + +def snippet_for_set_settings113(): """ Snippet for the setSettings method. - searchableAttributes around location + enable_advanced_syntax_by_default """ - # >SEPARATOR setSettings searchableAttributes around location + # >SEPARATOR setSettings enable_advanced_syntax_by_default # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7348,15 +11851,7 @@ def snippet_for_set_settings45(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", - ], - "customRanking": [ - "desc(links_count)", - ], + "advancedSyntax": True, }, ) @@ -7366,13 +11861,13 @@ def snippet_for_set_settings45(): # SEPARATOR< -def snippet_for_set_settings46(): +def snippet_for_set_settings114(): """ Snippet for the setSettings method. - searchableAttributes around location + set_numeric_attributes_for_filtering """ - # >SEPARATOR setSettings searchableAttributes around location + # >SEPARATOR setSettings set_numeric_attributes_for_filtering # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7381,14 +11876,9 @@ def snippet_for_set_settings46(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", - ], - "customRanking": [ - "desc(links_count)", + "numericAttributesForFiltering": [ + "quantity", + "popularity", ], }, ) @@ -7399,13 +11889,13 @@ def snippet_for_set_settings46(): # SEPARATOR< -def snippet_for_set_settings47(): +def snippet_for_set_settings115(): """ Snippet for the setSettings method. - disableTypoToleranceOnAttributes + enable_compression_of_integer_array """ - # >SEPARATOR setSettings disableTypoToleranceOnAttributes + # >SEPARATOR setSettings enable_compression_of_integer_array # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7414,9 +11904,7 @@ def snippet_for_set_settings47(): response = client.set_settings( index_name="", index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", - ], + "allowCompressionOfIntegerArray": True, }, ) @@ -7426,13 +11914,13 @@ def snippet_for_set_settings47(): # SEPARATOR< -def snippet_for_set_settings48(): +def snippet_for_set_settings116(): """ Snippet for the setSettings method. - everything + set_attributes_for_distinct """ - # >SEPARATOR setSettings everything + # >SEPARATOR setSettings set_attributes_for_distinct # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7441,140 +11929,7 @@ def snippet_for_set_settings48(): response = client.set_settings( index_name="", index_settings={ - "advancedSyntax": True, - "advancedSyntaxFeatures": [ - "exactPhrase", - ], - "allowCompressionOfIntegerArray": True, - "allowTyposOnNumericTokens": True, - "alternativesAsExact": [ - "singleWordSynonym", - ], - "attributeCriteriaComputedByMinProximity": True, - "attributeForDistinct": "test", - "attributesForFaceting": [ - "algolia", - ], - "attributesToHighlight": [ - "algolia", - ], - "attributesToRetrieve": [ - "algolia", - ], - "attributesToSnippet": [ - "algolia", - ], - "attributesToTransliterate": [ - "algolia", - ], - "camelCaseAttributes": [ - "algolia", - ], - "customNormalization": { - "algolia": { - "aloglia": "aglolia", - }, - }, - "customRanking": [ - "algolia", - ], - "decompoundQuery": False, - "decompoundedAttributes": { - "algolia": "aloglia", - }, - "disableExactOnAttributes": [ - "algolia", - ], - "disablePrefixOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnWords": [ - "algolia", - ], - "distinct": 3, - "enablePersonalization": True, - "enableReRanking": False, - "enableRules": True, - "exactOnSingleWordQuery": "attribute", - "highlightPreTag": "", - "highlightPostTag": "", - "hitsPerPage": 10, - "ignorePlurals": False, - "indexLanguages": [ - "fr", - ], - "keepDiacriticsOnCharacters": "abc", - "maxFacetHits": 20, - "maxValuesPerFacet": 30, - "minProximity": 6, - "minWordSizefor1Typo": 5, - "minWordSizefor2Typos": 11, - "mode": "neuralSearch", - "numericAttributesForFiltering": [ - "algolia", - ], - "optionalWords": [ - "myspace", - ], - "paginationLimitedTo": 0, - "queryLanguages": [ - "fr", - ], - "queryType": "prefixLast", - "ranking": [ - "geo", - ], - "reRankingApplyFilter": "mySearch:filters", - "relevancyStrictness": 10, - "removeStopWords": False, - "removeWordsIfNoResults": "lastWords", - "renderingContent": { - "facetOrdering": { - "facets": { - "order": [ - "a", - "b", - ], - }, - "values": { - "a": { - "order": [ - "b", - ], - "sortRemainingBy": "count", - }, - }, - }, - }, - "replaceSynonymsInHighlight": True, - "replicas": [ - "", - ], - "responseFields": [ - "algolia", - ], - "restrictHighlightAndSnippetArrays": True, - "searchableAttributes": [ - "foo", - ], - "semanticSearch": { - "eventSources": [ - "foo", - ], - }, - "separatorsToIndex": "bar", - "snippetEllipsisText": "---", - "sortFacetValuesBy": "date", - "typoTolerance": False, - "unretrievableAttributes": [ - "foo", - ], - "userData": { - "user": "data", - }, + "attributeForDistinct": "url", }, ) @@ -7584,13 +11939,13 @@ def snippet_for_set_settings48(): # SEPARATOR< -def snippet_for_set_settings49(): +def snippet_for_set_settings117(): """ Snippet for the setSettings method. - searchableAttributesWithCustomRankingsAndAttributesForFaceting + set_distinct """ - # >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + # >SEPARATOR setSettings set_distinct # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7599,21 +11954,8 @@ def snippet_for_set_settings49(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "brand", - "name", - "categories", - "unordered(description)", - ], - "customRanking": [ - "desc(popularity)", - ], - "attributesForFaceting": [ - "searchable(brand)", - "type", - "categories", - "price", - ], + "distinct": 1, + "attributeForDistinct": "url", }, ) @@ -7623,13 +11965,13 @@ def snippet_for_set_settings49(): # SEPARATOR< -def snippet_for_set_settings50(): +def snippet_for_set_settings118(): """ Snippet for the setSettings method. - searchableAttributesProductReferenceSuffixes + set_replace_synonyms_in_highlights """ - # >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + # >SEPARATOR setSettings set_replace_synonyms_in_highlights # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7638,11 +11980,7 @@ def snippet_for_set_settings50(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "name", - "product_reference", - "product_reference_suffixes", - ], + "replaceSynonymsInHighlight": False, }, ) @@ -7652,13 +11990,13 @@ def snippet_for_set_settings50(): # SEPARATOR< -def snippet_for_set_settings51(): +def snippet_for_set_settings119(): """ Snippet for the setSettings method. - queryLanguageAndIgnorePlurals + set_min_proximity """ - # >SEPARATOR setSettings queryLanguageAndIgnorePlurals + # >SEPARATOR setSettings set_min_proximity # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7667,10 +12005,7 @@ def snippet_for_set_settings51(): response = client.set_settings( index_name="", index_settings={ - "queryLanguages": [ - "en", - ], - "ignorePlurals": True, + "minProximity": 1, }, ) @@ -7680,13 +12015,13 @@ def snippet_for_set_settings51(): # SEPARATOR< -def snippet_for_set_settings52(): +def snippet_for_set_settings120(): """ Snippet for the setSettings method. - searchableAttributesInMovies + set_default_field """ - # >SEPARATOR setSettings searchableAttributesInMovies + # >SEPARATOR setSettings set_default_field # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7695,10 +12030,11 @@ def snippet_for_set_settings52(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "title_eng", - "title_fr", - "title_es", + "responseFields": [ + "hits", + "hitsPerPage", + "nbPages", + "page", ], }, ) @@ -7709,13 +12045,13 @@ def snippet_for_set_settings52(): # SEPARATOR< -def snippet_for_set_settings53(): +def snippet_for_set_settings121(): """ Snippet for the setSettings method. - disablePrefixOnAttributes + set_max_facet_hits """ - # >SEPARATOR setSettings disablePrefixOnAttributes + # >SEPARATOR setSettings set_max_facet_hits # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7724,9 +12060,7 @@ def snippet_for_set_settings53(): response = client.set_settings( index_name="", index_settings={ - "disablePrefixOnAttributes": [ - "serial_number", - ], + "maxFacetHits": 10, }, ) @@ -7736,13 +12070,13 @@ def snippet_for_set_settings53(): # SEPARATOR< -def snippet_for_set_settings54(): +def snippet_for_set_settings122(): """ Snippet for the setSettings method. - disableTypoToleranceOnAttributes + set_attribute_criteria_computed_by_min_proximity """ - # >SEPARATOR setSettings disableTypoToleranceOnAttributes + # >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7751,9 +12085,7 @@ def snippet_for_set_settings54(): response = client.set_settings( index_name="", index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", - ], + "attributeCriteriaComputedByMinProximity": True, }, ) @@ -7763,13 +12095,13 @@ def snippet_for_set_settings54(): # SEPARATOR< -def snippet_for_set_settings55(): +def snippet_for_set_settings123(): """ Snippet for the setSettings method. - searchableAttributesSimpleExample + set_user_data """ - # >SEPARATOR setSettings searchableAttributesSimpleExample + # >SEPARATOR setSettings set_user_data # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7778,9 +12110,9 @@ def snippet_for_set_settings55(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "serial_number", - ], + "userData": { + "extraData": "This is the custom data that you want to store in your index", + }, }, ) @@ -7790,13 +12122,13 @@ def snippet_for_set_settings55(): # SEPARATOR< -def snippet_for_set_settings56(): +def snippet_for_set_settings124(): """ Snippet for the setSettings method. - searchableAttributesSimpleExampleAlt + set_rendering_content """ - # >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + # >SEPARATOR setSettings set_rendering_content # Initialize the client # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods. client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -7805,10 +12137,35 @@ def snippet_for_set_settings56(): response = client.set_settings( index_name="", index_settings={ - "searchableAttributes": [ - "serial_number", - "serial_number_suffixes", - ], + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "size", + "brand", + ], + }, + "values": { + "brand": { + "order": [ + "uniqlo", + ], + "hide": [ + "muji", + ], + "sortRemainingBy": "count", + }, + "size": { + "order": [ + "S", + "M", + "L", + ], + "sortRemainingBy": "hidden", + }, + }, + }, + }, }, ) diff --git a/docs/snippets/ruby/search.rb b/docs/snippets/ruby/search.rb index c090c2817f..00689aacf9 100644 --- a/docs/snippets/ruby/search.rb +++ b/docs/snippets/ruby/search.rb @@ -4300,8 +4300,103 @@ def snippet_for_search_single_index13 # Snippet for the searchSingleIndex method. # -# facetFiltersNeg +# facetFiltersBook def snippet_for_search_single_index14 + # >SEPARATOR searchSingleIndex facetFiltersBook + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: ["category:Book"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# facetFiltersAND +def snippet_for_search_single_index15 + # >SEPARATOR searchSingleIndex facetFiltersAND + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: ["category:Book", "author:John Doe"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# facetFiltersOR +def snippet_for_search_single_index16 + # >SEPARATOR searchSingleIndex facetFiltersOR + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: [["category:Book", "author:John Doe"]]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# facetFiltersCombined +def snippet_for_search_single_index17 + # >SEPARATOR searchSingleIndex facetFiltersCombined + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + facet_filters: ["author:John Doe", ["category:Book", "category:Movie"]] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# facetFiltersNeg +def snippet_for_search_single_index18 # >SEPARATOR searchSingleIndex facetFiltersNeg # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4324,7 +4419,7 @@ def snippet_for_search_single_index14 # Snippet for the searchSingleIndex method. # # filtersAndFacetFilters -def snippet_for_search_single_index15 +def snippet_for_search_single_index19 # >SEPARATOR searchSingleIndex filtersAndFacetFilters # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4350,7 +4445,7 @@ def snippet_for_search_single_index15 # Snippet for the searchSingleIndex method. # # facet author genre -def snippet_for_search_single_index16 +def snippet_for_search_single_index20 # >SEPARATOR searchSingleIndex facet author genre # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4373,7 +4468,7 @@ def snippet_for_search_single_index16 # Snippet for the searchSingleIndex method. # # facet wildcard -def snippet_for_search_single_index17 +def snippet_for_search_single_index21 # >SEPARATOR searchSingleIndex facet wildcard # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4393,7 +4488,7 @@ def snippet_for_search_single_index17 # Snippet for the searchSingleIndex method. # # maxValuesPerFacet -def snippet_for_search_single_index18 +def snippet_for_search_single_index22 # >SEPARATOR searchSingleIndex maxValuesPerFacet # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4416,7 +4511,7 @@ def snippet_for_search_single_index18 # Snippet for the searchSingleIndex method. # # aroundLatLng -def snippet_for_search_single_index19 +def snippet_for_search_single_index23 # >SEPARATOR searchSingleIndex aroundLatLng # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4439,7 +4534,7 @@ def snippet_for_search_single_index19 # Snippet for the searchSingleIndex method. # # aroundLatLngViaIP -def snippet_for_search_single_index20 +def snippet_for_search_single_index24 # >SEPARATOR searchSingleIndex aroundLatLngViaIP # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4462,7 +4557,7 @@ def snippet_for_search_single_index20 # Snippet for the searchSingleIndex method. # # aroundRadius -def snippet_for_search_single_index21 +def snippet_for_search_single_index25 # >SEPARATOR searchSingleIndex aroundRadius # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4485,7 +4580,7 @@ def snippet_for_search_single_index21 # Snippet for the searchSingleIndex method. # # insideBoundingBox -def snippet_for_search_single_index22 +def snippet_for_search_single_index26 # >SEPARATOR searchSingleIndex insideBoundingBox # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4510,7 +4605,7 @@ def snippet_for_search_single_index22 # Snippet for the searchSingleIndex method. # # insidePolygon -def snippet_for_search_single_index23 +def snippet_for_search_single_index27 # >SEPARATOR searchSingleIndex insidePolygon # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4550,7 +4645,7 @@ def snippet_for_search_single_index23 # Snippet for the searchSingleIndex method. # # insidePolygon -def snippet_for_search_single_index24 +def snippet_for_search_single_index28 # >SEPARATOR searchSingleIndex insidePolygon # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4590,7 +4685,7 @@ def snippet_for_search_single_index24 # Snippet for the searchSingleIndex method. # # optionalFilters -def snippet_for_search_single_index25 +def snippet_for_search_single_index29 # >SEPARATOR searchSingleIndex optionalFilters # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4613,7 +4708,7 @@ def snippet_for_search_single_index25 # Snippet for the searchSingleIndex method. # # optionalFiltersMany -def snippet_for_search_single_index26 +def snippet_for_search_single_index30 # >SEPARATOR searchSingleIndex optionalFiltersMany # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4638,7 +4733,7 @@ def snippet_for_search_single_index26 # Snippet for the searchSingleIndex method. # # optionalFiltersSimple -def snippet_for_search_single_index27 +def snippet_for_search_single_index31 # >SEPARATOR searchSingleIndex optionalFiltersSimple # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4661,7 +4756,7 @@ def snippet_for_search_single_index27 # Snippet for the searchSingleIndex method. # # restrictSearchableAttributes -def snippet_for_search_single_index28 +def snippet_for_search_single_index32 # >SEPARATOR searchSingleIndex restrictSearchableAttributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4684,7 +4779,7 @@ def snippet_for_search_single_index28 # Snippet for the searchSingleIndex method. # # getRankingInfo -def snippet_for_search_single_index29 +def snippet_for_search_single_index33 # >SEPARATOR searchSingleIndex getRankingInfo # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4707,7 +4802,7 @@ def snippet_for_search_single_index29 # Snippet for the searchSingleIndex method. # # clickAnalytics -def snippet_for_search_single_index30 +def snippet_for_search_single_index34 # >SEPARATOR searchSingleIndex clickAnalytics # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4730,7 +4825,7 @@ def snippet_for_search_single_index30 # Snippet for the searchSingleIndex method. # # clickAnalyticsUserToken -def snippet_for_search_single_index31 +def snippet_for_search_single_index35 # >SEPARATOR searchSingleIndex clickAnalyticsUserToken # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4753,7 +4848,7 @@ def snippet_for_search_single_index31 # Snippet for the searchSingleIndex method. # # enablePersonalization -def snippet_for_search_single_index32 +def snippet_for_search_single_index36 # >SEPARATOR searchSingleIndex enablePersonalization # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4776,7 +4871,7 @@ def snippet_for_search_single_index32 # Snippet for the searchSingleIndex method. # # userToken -def snippet_for_search_single_index33 +def snippet_for_search_single_index37 # >SEPARATOR searchSingleIndex userToken # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4796,10 +4891,33 @@ def snippet_for_search_single_index33 # SEPARATOR< end +# Snippet for the searchSingleIndex method. +# +# userToken1234 +def snippet_for_search_single_index38 + # >SEPARATOR searchSingleIndex userToken1234 + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", user_token: "user-1234") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + # Snippet for the searchSingleIndex method. # # analyticsTag -def snippet_for_search_single_index34 +def snippet_for_search_single_index39 # >SEPARATOR searchSingleIndex analyticsTag # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4822,7 +4940,7 @@ def snippet_for_search_single_index34 # Snippet for the searchSingleIndex method. # # facetFiltersUsers -def snippet_for_search_single_index35 +def snippet_for_search_single_index40 # >SEPARATOR searchSingleIndex facetFiltersUsers # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4845,7 +4963,7 @@ def snippet_for_search_single_index35 # Snippet for the searchSingleIndex method. # # buildTheQuery -def snippet_for_search_single_index36 +def snippet_for_search_single_index41 # >SEPARATOR searchSingleIndex buildTheQuery # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") @@ -4869,16 +4987,19 @@ def snippet_for_search_single_index36 # SEPARATOR< end -# Snippet for the searchSynonyms method. +# Snippet for the searchSingleIndex method. # -# searchSynonyms with minimal parameters -def snippet_for_search_synonyms - # >SEPARATOR searchSynonyms searchSynonyms with minimal parameters +# attributesToHighlightOverride +def snippet_for_search_single_index42 + # >SEPARATOR searchSingleIndex attributesToHighlightOverride # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_synonyms("") + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_highlight: ["title", "content"]) + ) # >LOG # use the class directly @@ -4889,18 +5010,18 @@ def snippet_for_search_synonyms # SEPARATOR< end -# Snippet for the searchSynonyms method. +# Snippet for the searchSingleIndex method. # -# searchSynonyms with all parameters -def snippet_for_search_synonyms1 - # >SEPARATOR searchSynonyms searchSynonyms with all parameters +# disableTypoToleranceOnAttributes +def snippet_for_search_single_index43 + # >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_synonyms( + response = client.search_single_index( "", - Algolia::Search::SearchSynonymsParams.new(query: "myQuery", type: "altcorrection1", page: 10, hits_per_page: 10) + Algolia::Search::SearchParamsObject.new(query: "query", disable_typo_tolerance_on_attributes: ["serial_number"]) ) # >LOG @@ -4912,18 +5033,16 @@ def snippet_for_search_synonyms1 # SEPARATOR< end -# Snippet for the searchUserIds method. +# Snippet for the searchSingleIndex method. # -# searchUserIds -def snippet_for_search_user_ids - # >SEPARATOR searchUserIds default +# search_a_query +def snippet_for_search_single_index44 + # >SEPARATOR searchSingleIndex search_a_query # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.search_user_ids( - Algolia::Search::SearchUserIdsParams.new(query: "test", cluster_name: "theClusterName", page: 5, hits_per_page: 10) - ) + response = client.search_single_index("", Algolia::Search::SearchParamsObject.new(query: "shirt")) # >LOG # use the class directly @@ -4934,33 +5053,38 @@ def snippet_for_search_user_ids # SEPARATOR< end -# Snippet for the setClientApiKey method. +# Snippet for the searchSingleIndex method. # -# switch API key -def snippet_for_set_client_api_key - # >SEPARATOR setClientApiKey default +# search_everything +def snippet_for_search_single_index45 + # >SEPARATOR searchSingleIndex search_everything # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - client.set_client_api_key("updated-api-key") + response = client.search_single_index("", Algolia::Search::SearchParamsObject.new(query: "")) + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) # SEPARATOR< end -# Snippet for the setDictionarySettings method. +# Snippet for the searchSingleIndex method. # -# get setDictionarySettings results with minimal parameters -def snippet_for_set_dictionary_settings - # >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters +# api_filtering_range_example +def snippet_for_search_single_index46 + # >SEPARATOR searchSingleIndex api_filtering_range_example # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_dictionary_settings( - Algolia::Search::DictionarySettingsParams.new( - disable_standard_entries: Algolia::Search::StandardEntries.new(plurals: {fr: false, en: false, ru: true}) - ) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "books", filters: "price:10 TO 20") ) # >LOG @@ -4972,22 +5096,21 @@ def snippet_for_set_dictionary_settings # SEPARATOR< end -# Snippet for the setDictionarySettings method. +# Snippet for the searchSingleIndex method. # -# get setDictionarySettings results with all parameters -def snippet_for_set_dictionary_settings1 - # >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters +# search_a_query +def snippet_for_search_single_index47 + # >SEPARATOR searchSingleIndex search_a_query # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_dictionary_settings( - Algolia::Search::DictionarySettingsParams.new( - disable_standard_entries: Algolia::Search::StandardEntries.new( - plurals: {fr: false, en: false, ru: true}, - stopwords: {fr: false}, - compounds: {ru: true} - ) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "", + similar_query: "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001" ) ) @@ -5000,19 +5123,18 @@ def snippet_for_set_dictionary_settings1 # SEPARATOR< end -# Snippet for the setSettings method. +# Snippet for the searchSingleIndex method. # -# minimal parameters -def snippet_for_set_settings - # >SEPARATOR setSettings minimal parameters +# override_retrievable_attributes +def snippet_for_search_single_index48 + # >SEPARATOR searchSingleIndex override_retrievable_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( + response = client.search_single_index( "", - Algolia::Search::IndexSettings.new(pagination_limited_to: 10), - true + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_retrieve: ["title", "content"]) ) # >LOG @@ -5024,16 +5146,19 @@ def snippet_for_set_settings # SEPARATOR< end -# Snippet for the setSettings method. +# Snippet for the searchSingleIndex method. # -# boolean typoTolerance -def snippet_for_set_settings1 - # >SEPARATOR setSettings boolean typoTolerance +# restrict_searchable_attributes +def snippet_for_search_single_index49 + # >SEPARATOR searchSingleIndex restrict_searchable_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(typo_tolerance: true), true) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", restrict_searchable_attributes: ["title", "author"]) + ) # >LOG # use the class directly @@ -5044,16 +5169,19 @@ def snippet_for_set_settings1 # SEPARATOR< end -# Snippet for the setSettings method. +# Snippet for the searchSingleIndex method. # -# enum typoTolerance -def snippet_for_set_settings2 - # >SEPARATOR setSettings enum typoTolerance +# override_default_relevancy +def snippet_for_search_single_index50 + # >SEPARATOR searchSingleIndex override_default_relevancy # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(typo_tolerance: "min"), true) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", relevancy_strictness: 70) + ) # >LOG # use the class directly @@ -5064,16 +5192,22 @@ def snippet_for_set_settings2 # SEPARATOR< end -# Snippet for the setSettings method. +# Snippet for the searchSingleIndex method. # -# ignorePlurals -def snippet_for_set_settings3 - # >SEPARATOR setSettings ignorePlurals +# apply_filters +def snippet_for_search_single_index51 + # >SEPARATOR searchSingleIndex apply_filters # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(ignore_plurals: true), true) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published" + ) + ) # >LOG # use the class directly @@ -5084,16 +5218,3176 @@ def snippet_for_set_settings3 # SEPARATOR< end -# Snippet for the setSettings method. +# Snippet for the searchSingleIndex method. # -# list of string ignorePlurals -def snippet_for_set_settings4 - # >SEPARATOR setSettings list of string ignorePlurals +# apply_all_filters +def snippet_for_search_single_index52 + # >SEPARATOR searchSingleIndex apply_all_filters # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(ignore_plurals: ["fr"]), true) + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + 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\"" + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# escape_spaces +def snippet_for_search_single_index53 + # >SEPARATOR searchSingleIndex escape_spaces + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "category:\"Books and Comics\"") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# escape_keywords +def snippet_for_search_single_index54 + # >SEPARATOR searchSingleIndex escape_keywords + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "keyword:\"OR\"") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# escape_single_quotes +def snippet_for_search_single_index55 + # >SEPARATOR searchSingleIndex escape_single_quotes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "content:\"It's a wonderful day\"") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# escape_double_quotes +def snippet_for_search_single_index56 + # >SEPARATOR searchSingleIndex escape_double_quotes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "content:\"She said \"Hello World\"") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# apply_filters +def snippet_for_search_single_index57 + # >SEPARATOR searchSingleIndex apply_filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", optional_filters: ["category:Book", "author:John Doe"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# apply_negative_filters +def snippet_for_search_single_index58 + # >SEPARATOR searchSingleIndex apply_negative_filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", optional_filters: ["category:Book", "author:-John Doe"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# apply_numeric_filters +def snippet_for_search_single_index59 + # >SEPARATOR searchSingleIndex apply_numeric_filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + numeric_filters: ["price < 1000", ["inStock = 1", "deliveryDate < 1441755506"]] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# apply_tag_filters +def snippet_for_search_single_index60 + # >SEPARATOR searchSingleIndex apply_tag_filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", tag_filters: ["SciFi", ["Book", "Movie"]]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# apply_filters +def snippet_for_search_single_index61 + # >SEPARATOR searchSingleIndex apply_filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", sum_or_filters_scores: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# facets_all +def snippet_for_search_single_index62 + # >SEPARATOR searchSingleIndex facets_all + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", facets: ["*"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# retrieve_only_some_facets +def snippet_for_search_single_index63 + # >SEPARATOR searchSingleIndex retrieve_only_some_facets + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", facets: ["category", "author"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_max_values_per_facet +def snippet_for_search_single_index64 + # >SEPARATOR searchSingleIndex override_default_max_values_per_facet + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", max_values_per_facet: 20) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_faceting_after_distinct +def snippet_for_search_single_index65 + # >SEPARATOR searchSingleIndex enable_faceting_after_distinct + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", faceting_after_distinct: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# sort_facet_values_alphabetically +def snippet_for_search_single_index66 + # >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", sort_facet_values_by: "count") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_attributes_to_snippet +def snippet_for_search_single_index67 + # >SEPARATOR searchSingleIndex override_attributes_to_snippet + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_snippet: ["title", "content:80"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_highlight_pre_tag +def snippet_for_search_single_index68 + # >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", highlight_pre_tag: "") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_highlight_post_tag +def snippet_for_search_single_index69 + # >SEPARATOR searchSingleIndex override_default_highlight_post_tag + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", highlight_post_tag: "") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_snippet_ellipsis_text +def snippet_for_search_single_index70 + # >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", snippet_ellipsis_text: "") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_restrict_highlight_and_snippet_arrays +def snippet_for_search_single_index71 + # >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", restrict_highlight_and_snippet_arrays: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# access_page +def snippet_for_search_single_index72 + # >SEPARATOR searchSingleIndex access_page + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", page: 0) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_hits_per_page +def snippet_for_search_single_index73 + # >SEPARATOR searchSingleIndex override_default_hits_per_page + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", hits_per_page: 10) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# get_nth_hit +def snippet_for_search_single_index74 + # >SEPARATOR searchSingleIndex get_nth_hit + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", offset: 4) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# get_n_results +def snippet_for_search_single_index75 + # >SEPARATOR searchSingleIndex get_n_results + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", length: 4) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_min_word_size_for_one_typo +def snippet_for_search_single_index76 + # >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", min_word_sizefor1_typo: 2) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_min_word_size_for_two_typos +def snippet_for_search_single_index77 + # >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", min_word_sizefor2_typos: 2) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_typo_tolerance_mode +def snippet_for_search_single_index78 + # >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", typo_tolerance: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disable_typos_on_numeric_tokens_at_search_time +def snippet_for_search_single_index79 + # >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", allow_typos_on_numeric_tokens: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_around_a_position +def snippet_for_search_single_index80 + # >SEPARATOR searchSingleIndex search_around_a_position + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", around_lat_lng: "40.71, -74.01") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_around_server_ip +def snippet_for_search_single_index81 + # >SEPARATOR searchSingleIndex search_around_server_ip + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", around_lat_lng_via_ip: true), + { + :header_params => JSON.parse( + "{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you would like to search around\"}", + :symbolize_names => true + ) + } + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_around_radius +def snippet_for_search_single_index82 + # >SEPARATOR searchSingleIndex set_around_radius + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", around_radius: 1000) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disable_automatic_radius +def snippet_for_search_single_index83 + # >SEPARATOR searchSingleIndex disable_automatic_radius + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", around_radius: "all") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_geo_search_precision +def snippet_for_search_single_index84 + # >SEPARATOR searchSingleIndex set_geo_search_precision + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", around_precision: 100) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_geo_search_precision_non_linear +def snippet_for_search_single_index85 + # >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + around_precision: [ + Algolia::Search::Range.new(from: 0, value: 25), + Algolia::Search::Range.new(from: 2000, value: 1000) + ] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_minimum_geo_search_radius +def snippet_for_search_single_index86 + # >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", minimum_around_radius: 1000) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_inside_rectangular_area +def snippet_for_search_single_index87 + # >SEPARATOR searchSingleIndex search_inside_rectangular_area + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_bounding_box: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_inside_multiple_rectangular_areas +def snippet_for_search_single_index88 + # >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_bounding_box: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875] + ] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_inside_polygon_area +def snippet_for_search_single_index89 + # >SEPARATOR searchSingleIndex search_inside_polygon_area + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_polygon: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625] + ] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# search_inside_multiple_polygon_areas +def snippet_for_search_single_index90 + # >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_polygon: [ + [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 + ] + ] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_querylanguages_override +def snippet_for_search_single_index91 + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", ignore_plurals: ["ca", "es"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_querylanguages_override +def snippet_for_search_single_index92 + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", remove_stop_words: ["ca", "es"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_querylanguages_override +def snippet_for_search_single_index93 + # >SEPARATOR searchSingleIndex set_querylanguages_override + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", remove_stop_words: ["ca", "es"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_querylanguages_with_japanese_query +def snippet_for_search_single_index94 + # >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", query_languages: ["ja", "en"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_natural_languages +def snippet_for_search_single_index95 + # >SEPARATOR searchSingleIndex set_natural_languages + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "", natural_languages: ["fr"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_natural_languages_with_query +def snippet_for_search_single_index96 + # >SEPARATOR searchSingleIndex override_natural_languages_with_query + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "", + natural_languages: ["fr"], + remove_words_if_no_results: "firstWords" + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_decompound_query_search_time +def snippet_for_search_single_index97 + # >SEPARATOR searchSingleIndex enable_decompound_query_search_time + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", decompound_query: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_rules_search_time +def snippet_for_search_single_index98 + # >SEPARATOR searchSingleIndex enable_rules_search_time + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_rules: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_rule_contexts +def snippet_for_search_single_index99 + # >SEPARATOR searchSingleIndex set_rule_contexts + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", rule_contexts: ["front_end", "website2"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_personalization +def snippet_for_search_single_index100 + # >SEPARATOR searchSingleIndex enable_personalization + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_personalization_with_user_token +def snippet_for_search_single_index101 + # >SEPARATOR searchSingleIndex enable_personalization_with_user_token + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true, user_token: "123456") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# personalization_impact +def snippet_for_search_single_index102 + # >SEPARATOR searchSingleIndex personalization_impact + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", personalization_impact: 20) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_user_token +def snippet_for_search_single_index103 + # >SEPARATOR searchSingleIndex set_user_token + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", user_token: "123456") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_user_token_with_personalization +def snippet_for_search_single_index104 + # >SEPARATOR searchSingleIndex set_user_token_with_personalization + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true, user_token: "123456") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_query_type +def snippet_for_search_single_index105 + # >SEPARATOR searchSingleIndex override_default_query_type + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", query_type: "prefixAll") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_remove_words_if_no_results +def snippet_for_search_single_index106 + # >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", remove_words_if_no_results: "lastWords") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_advanced_syntax_search_time +def snippet_for_search_single_index107 + # >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", advanced_syntax: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# overide_default_optional_words +def snippet_for_search_single_index108 + # >SEPARATOR searchSingleIndex overide_default_optional_words + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", optional_words: ["toyota", "2020 2021"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disabling_exact_for_some_attributes_search_time +def snippet_for_search_single_index109 + # >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", disable_exact_on_attributes: ["description"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_exact_single_word_query +def snippet_for_search_single_index110 + # >SEPARATOR searchSingleIndex override_default_exact_single_word_query + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", exact_on_single_word_query: "none") + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_aternative_as_exact +def snippet_for_search_single_index111 + # >SEPARATOR searchSingleIndex override_default_aternative_as_exact + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", alternatives_as_exact: ["multiWordsSynonym"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_advanced_syntax_exact_phrase +def snippet_for_search_single_index112 + # >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + advanced_syntax: true, + advanced_syntax_features: ["exactPhrase"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_advanced_syntax_exclude_words +def snippet_for_search_single_index113 + # >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new( + query: "query", + advanced_syntax: true, + advanced_syntax_features: ["excludeWords"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_distinct +def snippet_for_search_single_index114 + # >SEPARATOR searchSingleIndex override_distinct + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", distinct: 0) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# get_ranking_info +def snippet_for_search_single_index115 + # >SEPARATOR searchSingleIndex get_ranking_info + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", get_ranking_info: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disable_click_analytics +def snippet_for_search_single_index116 + # >SEPARATOR searchSingleIndex disable_click_analytics + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", click_analytics: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# enable_click_analytics +def snippet_for_search_single_index117 + # >SEPARATOR searchSingleIndex enable_click_analytics + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", click_analytics: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disable_analytics +def snippet_for_search_single_index118 + # >SEPARATOR searchSingleIndex disable_analytics + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", analytics: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# add_analytics_tags +def snippet_for_search_single_index119 + # >SEPARATOR searchSingleIndex add_analytics_tags + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", analytics_tags: ["front_end", "website2"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# disable_synonyms +def snippet_for_search_single_index120 + # >SEPARATOR searchSingleIndex disable_synonyms + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", synonyms: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_replace_synonyms_in_highlights +def snippet_for_search_single_index121 + # >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", replace_synonyms_in_highlight: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_min_proximity +def snippet_for_search_single_index122 + # >SEPARATOR searchSingleIndex override_min_proximity + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", min_proximity: 2) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_default_field +def snippet_for_search_single_index123 + # >SEPARATOR searchSingleIndex override_default_field + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", response_fields: ["hits", "facets"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# override_percentile_computation +def snippet_for_search_single_index124 + # >SEPARATOR searchSingleIndex override_percentile_computation + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", percentile_computation: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_ab_test +def snippet_for_search_single_index125 + # >SEPARATOR searchSingleIndex set_ab_test + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_ab_test: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSingleIndex method. +# +# set_enable_re_ranking +def snippet_for_search_single_index126 + # >SEPARATOR searchSingleIndex set_enable_re_ranking + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_single_index( + "", + Algolia::Search::SearchParamsObject.new(query: "query", enable_re_ranking: false) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSynonyms method. +# +# searchSynonyms with minimal parameters +def snippet_for_search_synonyms + # >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_synonyms("") + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchSynonyms method. +# +# searchSynonyms with all parameters +def snippet_for_search_synonyms1 + # >SEPARATOR searchSynonyms searchSynonyms with all parameters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_synonyms( + "", + Algolia::Search::SearchSynonymsParams.new(query: "myQuery", type: "altcorrection1", page: 10, hits_per_page: 10) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the searchUserIds method. +# +# searchUserIds +def snippet_for_search_user_ids + # >SEPARATOR searchUserIds default + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.search_user_ids( + Algolia::Search::SearchUserIdsParams.new(query: "test", cluster_name: "theClusterName", page: 5, hits_per_page: 10) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setClientApiKey method. +# +# switch API key +def snippet_for_set_client_api_key + # >SEPARATOR setClientApiKey default + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + client.set_client_api_key("updated-api-key") + # >LOG + # SEPARATOR< +end + +# Snippet for the setDictionarySettings method. +# +# get setDictionarySettings results with minimal parameters +def snippet_for_set_dictionary_settings + # >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_dictionary_settings( + Algolia::Search::DictionarySettingsParams.new( + disable_standard_entries: Algolia::Search::StandardEntries.new(plurals: {fr: false, en: false, ru: true}) + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setDictionarySettings method. +# +# get setDictionarySettings results with all parameters +def snippet_for_set_dictionary_settings1 + # >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_dictionary_settings( + Algolia::Search::DictionarySettingsParams.new( + disable_standard_entries: Algolia::Search::StandardEntries.new( + plurals: {fr: false, en: false, ru: true}, + stopwords: {fr: false}, + compounds: {ru: true} + ) + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# minimal parameters +def snippet_for_set_settings + # >SEPARATOR setSettings minimal parameters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(pagination_limited_to: 10), + true + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# boolean typoTolerance +def snippet_for_set_settings1 + # >SEPARATOR setSettings boolean typoTolerance + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(typo_tolerance: true), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# enum typoTolerance +def snippet_for_set_settings2 + # >SEPARATOR setSettings enum typoTolerance + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(typo_tolerance: "min"), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# ignorePlurals +def snippet_for_set_settings3 + # >SEPARATOR setSettings ignorePlurals + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(ignore_plurals: true), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# list of string ignorePlurals +def snippet_for_set_settings4 + # >SEPARATOR setSettings list of string ignorePlurals + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(ignore_plurals: ["fr"]), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# removeStopWords boolean +def snippet_for_set_settings5 + # >SEPARATOR setSettings removeStopWords boolean + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(remove_stop_words: true), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# removeStopWords list of string +def snippet_for_set_settings6 + # >SEPARATOR setSettings removeStopWords list of string + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(remove_stop_words: ["fr"]), + true + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# boolean distinct +def snippet_for_set_settings7 + # >SEPARATOR setSettings boolean distinct + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: true), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# integer distinct +def snippet_for_set_settings8 + # >SEPARATOR setSettings integer distinct + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: 1), true) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# distinct company +def snippet_for_set_settings9 + # >SEPARATOR setSettings distinct company + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "company", distinct: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# distinct design +def snippet_for_set_settings10 + # >SEPARATOR setSettings distinct design + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "design", distinct: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# distinct true +def snippet_for_set_settings11 + # >SEPARATOR setSettings distinct true + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: true)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# distinct section +def snippet_for_set_settings12 + # >SEPARATOR setSettings distinct section + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "section", distinct: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting allergens +def snippet_for_set_settings13 + # >SEPARATOR setSettings attributesForFaceting allergens + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["allergens"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# api_attributes_for_faceting +def snippet_for_set_settings14 + # >SEPARATOR setSettings api_attributes_for_faceting + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["genre", "author"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# api_attributes_for_faceting_searchable +def snippet_for_set_settings15 + # >SEPARATOR setSettings api_attributes_for_faceting_searchable + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["genre", "searchable(author)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# api_attributes_for_filter_only +def snippet_for_set_settings16 + # >SEPARATOR setSettings api_attributes_for_filter_only + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(genre)", "author"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting categoryPageId +def snippet_for_set_settings17 + # >SEPARATOR setSettings attributesForFaceting categoryPageId + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["searchable(categoryPageId)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# unretrievableAttributes +def snippet_for_set_settings18 + # >SEPARATOR setSettings unretrievableAttributes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(unretrievable_attributes: ["visible_by"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting user restricted data +def snippet_for_set_settings19 + # >SEPARATOR setSettings attributesForFaceting user restricted data + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(visible_by)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting optional filters +def snippet_for_set_settings20 + # >SEPARATOR setSettings attributesForFaceting optional filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["can_deliver_quickly", "restaurant"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting redirect index +def snippet_for_set_settings21 + # >SEPARATOR setSettings attributesForFaceting redirect index + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["query_terms"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting multiple consequences +def snippet_for_set_settings22 + # >SEPARATOR setSettings attributesForFaceting multiple consequences + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["director"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting in-depth optional filters +def snippet_for_set_settings23 + # >SEPARATOR setSettings attributesForFaceting in-depth optional filters + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(brand)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# mode neuralSearch +def snippet_for_set_settings24 + # >SEPARATOR setSettings mode neuralSearch + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# mode keywordSearch +def snippet_for_set_settings25 + # >SEPARATOR setSettings mode keywordSearch + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributes same priority +def snippet_for_set_settings26 + # >SEPARATOR setSettings searchableAttributes same priority + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title,comments", "ingredients"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributes higher priority +def snippet_for_set_settings27 + # >SEPARATOR setSettings searchableAttributes higher priority + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title", "ingredients"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking retweets +def snippet_for_set_settings28 + # >SEPARATOR setSettings customRanking retweets + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(retweets)", "desc(likes)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking boosted +def snippet_for_set_settings29 + # >SEPARATOR setSettings customRanking boosted + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(boosted)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking pageviews +def snippet_for_set_settings30 + # >SEPARATOR setSettings customRanking pageviews + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(pageviews)", "desc(comments)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking applying search parameters for a specific query +def snippet_for_set_settings31 + # >SEPARATOR setSettings customRanking applying search parameters for a specific query + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + custom_ranking: ["desc(nb_airline_liaisons)"], + attributes_for_faceting: ["city, country"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking rounded pageviews +def snippet_for_set_settings32 + # >SEPARATOR setSettings customRanking rounded pageviews + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(rounded_pageviews)", "desc(comments)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking price +def snippet_for_set_settings33 + # >SEPARATOR setSettings customRanking price + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(price)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# ranking exhaustive +def snippet_for_set_settings34 + # >SEPARATOR setSettings ranking exhaustive + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# ranking standard replica +def snippet_for_set_settings35 + # >SEPARATOR setSettings ranking standard replica + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(ranking: ["desc(post_date_timestamp)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# ranking virtual replica +def snippet_for_set_settings36 + # >SEPARATOR setSettings ranking virtual replica + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(post_date_timestamp)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# customRanking and ranking sort alphabetically +def snippet_for_set_settings37 + # >SEPARATOR setSettings customRanking and ranking sort alphabetically + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + custom_ranking: ["asc(textual_attribute)"], + ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# relevancyStrictness +def snippet_for_set_settings38 + # >SEPARATOR setSettings relevancyStrictness + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(custom_ranking: ["asc(textual_attribute)"], relevancy_strictness: 0) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# create replica index +def snippet_for_set_settings39 + # >SEPARATOR setSettings create replica index + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(replicas: ["products_price_desc"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# create replica index articles +def snippet_for_set_settings40 + # >SEPARATOR setSettings create replica index articles + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(replicas: ["articles_date_desc"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# create virtual replica index +def snippet_for_set_settings41 + # >SEPARATOR setSettings create virtual replica index + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(replicas: ["virtual(products_price_desc)"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# unlink replica index +def snippet_for_set_settings42 + # >SEPARATOR setSettings unlink replica index + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(replicas: [""])) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# forwardToReplicas +def snippet_for_set_settings43 + # >SEPARATOR setSettings forwardToReplicas + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["name", "description"]), + true + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# maxValuesPerFacet +def snippet_for_set_settings44 + # >SEPARATOR setSettings maxValuesPerFacet + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(max_values_per_facet: 1000)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# maxFacetHits +def snippet_for_set_settings45 + # >SEPARATOR setSettings maxFacetHits + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(max_facet_hits: 1000)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesForFaceting complex +def snippet_for_set_settings46 + # >SEPARATOR setSettings attributesForFaceting complex + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + attributes_for_faceting: ["actor", "filterOnly(category)", "searchable(publisher)"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# ranking closest dates +def snippet_for_set_settings47 + # >SEPARATOR setSettings ranking closest dates + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + ranking: ["asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributes item variation +def snippet_for_set_settings48 + # >SEPARATOR setSettings searchableAttributes item variation + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["design", "type", "color"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributes around location +def snippet_for_set_settings49 + # >SEPARATOR setSettings searchableAttributes around location + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["name", "country", "code", "iata_code"], + custom_ranking: ["desc(links_count)"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesToHighlight +def snippet_for_set_settings50 + # >SEPARATOR setSettings attributesToHighlight + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_to_highlight: ["author", "title", "content"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# attributesToHighlightStar +def snippet_for_set_settings51 + # >SEPARATOR setSettings attributesToHighlightStar + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_to_highlight: ["*"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# everything +def snippet_for_set_settings52 + # >SEPARATOR setSettings everything + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + advanced_syntax: true, + advanced_syntax_features: ["exactPhrase"], + allow_compression_of_integer_array: true, + allow_typos_on_numeric_tokens: true, + alternatives_as_exact: ["singleWordSynonym"], + attribute_criteria_computed_by_min_proximity: true, + attribute_for_distinct: "test", + attributes_for_faceting: ["algolia"], + attributes_to_highlight: ["algolia"], + attributes_to_retrieve: ["algolia"], + attributes_to_snippet: ["algolia"], + attributes_to_transliterate: ["algolia"], + camel_case_attributes: ["algolia"], + custom_normalization: {algolia: {aloglia: "aglolia"}}, + custom_ranking: ["algolia"], + decompound_query: false, + decompounded_attributes: {algolia: "aloglia"}, + disable_exact_on_attributes: ["algolia"], + disable_prefix_on_attributes: ["algolia"], + disable_typo_tolerance_on_attributes: ["algolia"], + disable_typo_tolerance_on_words: ["algolia"], + distinct: 3, + enable_personalization: true, + enable_re_ranking: false, + enable_rules: true, + exact_on_single_word_query: "attribute", + highlight_pre_tag: "", + highlight_post_tag: "", + hits_per_page: 10, + ignore_plurals: false, + index_languages: ["fr"], + keep_diacritics_on_characters: "abc", + max_facet_hits: 20, + max_values_per_facet: 30, + min_proximity: 6, + min_word_sizefor1_typo: 5, + min_word_sizefor2_typos: 11, + mode: "neuralSearch", + numeric_attributes_for_filtering: ["algolia"], + optional_words: ["myspace"], + pagination_limited_to: 0, + query_languages: ["fr"], + query_type: "prefixLast", + ranking: ["geo"], + re_ranking_apply_filter: "mySearch:filters", + relevancy_strictness: 10, + remove_stop_words: false, + remove_words_if_no_results: "lastWords", + rendering_content: Algolia::Search::RenderingContent.new( + facet_ordering: Algolia::Search::FacetOrdering.new( + facets: Algolia::Search::Facets.new(order: ["a", "b"]), + values: {a: Algolia::Search::Value.new(order: ["b"], sort_remaining_by: "count")} + ) + ), + replace_synonyms_in_highlight: true, + replicas: [""], + response_fields: ["algolia"], + restrict_highlight_and_snippet_arrays: true, + searchable_attributes: ["foo"], + semantic_search: Algolia::Search::SemanticSearch.new(event_sources: ["foo"]), + separators_to_index: "bar", + snippet_ellipsis_text: "---", + sort_facet_values_by: "date", + typo_tolerance: false, + unretrievable_attributes: ["foo"], + user_data: {user: "data"} + ) + ) # >LOG # use the class directly @@ -5106,14 +8400,263 @@ def snippet_for_set_settings4 # Snippet for the setSettings method. # -# removeStopWords boolean -def snippet_for_set_settings5 - # >SEPARATOR setSettings removeStopWords boolean +# searchableAttributesWithCustomRankingsAndAttributesForFaceting +def snippet_for_set_settings53 + # >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(remove_stop_words: true), true) + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["brand", "name", "categories", "unordered(description)"], + custom_ranking: ["desc(popularity)"], + attributes_for_faceting: ["searchable(brand)", "type", "categories", "price"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributesOrdering +def snippet_for_set_settings54 + # >SEPARATOR setSettings searchableAttributesOrdering + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["unordered(title)", "cast"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributesProductReferenceSuffixes +def snippet_for_set_settings55 + # >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["name", "product_reference", "product_reference_suffixes"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# queryLanguageAndIgnorePlurals +def snippet_for_set_settings56 + # >SEPARATOR setSettings queryLanguageAndIgnorePlurals + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(query_languages: ["en"], ignore_plurals: true) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributesInMovies +def snippet_for_set_settings57 + # >SEPARATOR setSettings searchableAttributesInMovies + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title_eng", "title_fr", "title_es"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# disablePrefixOnAttributes +def snippet_for_set_settings58 + # >SEPARATOR setSettings disablePrefixOnAttributes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["serial_number"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# disableTypoToleranceOnAttributes +def snippet_for_set_settings59 + # >SEPARATOR setSettings disableTypoToleranceOnAttributes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributesSimpleExample +def snippet_for_set_settings60 + # >SEPARATOR setSettings searchableAttributesSimpleExample + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# searchableAttributesSimpleExampleAlt +def snippet_for_set_settings61 + # >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number", "serial_number_suffixes"]) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_searchable_attributes +def snippet_for_set_settings62 + # >SEPARATOR setSettings set_searchable_attributes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["title,alternative_title", "author", "unordered(text)", "emails.personal"] + ) + ) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_searchable_attributes +def snippet_for_set_settings63 + # >SEPARATOR setSettings set_searchable_attributes + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new( + attributes_for_faceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ] + ) + ) # >LOG # use the class directly @@ -5126,17 +8669,16 @@ def snippet_for_set_settings5 # Snippet for the setSettings method. # -# removeStopWords list of string -def snippet_for_set_settings6 - # >SEPARATOR setSettings removeStopWords list of string +# unretrievable_attributes +def snippet_for_set_settings64 + # >SEPARATOR setSettings unretrievable_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(remove_stop_words: ["fr"]), - true + Algolia::Search::IndexSettings.new(unretrievable_attributes: ["total_number_of_sales"]) ) # >LOG @@ -5150,14 +8692,17 @@ def snippet_for_set_settings6 # Snippet for the setSettings method. # -# boolean distinct -def snippet_for_set_settings7 - # >SEPARATOR setSettings boolean distinct +# set_retrievable_attributes +def snippet_for_set_settings65 + # >SEPARATOR setSettings set_retrievable_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: true), true) + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["author", "title", "content"]) + ) # >LOG # use the class directly @@ -5170,14 +8715,14 @@ def snippet_for_set_settings7 # Snippet for the setSettings method. # -# integer distinct -def snippet_for_set_settings8 - # >SEPARATOR setSettings integer distinct +# set_all_attributes_as_retrievable +def snippet_for_set_settings66 + # >SEPARATOR setSettings set_all_attributes_as_retrievable # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: 1), true) + response = client.set_settings("", Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["*"])) # >LOG # use the class directly @@ -5190,16 +8735,16 @@ def snippet_for_set_settings8 # Snippet for the setSettings method. # -# distinct company -def snippet_for_set_settings9 - # >SEPARATOR setSettings distinct company +# specify_attributes_not_to_retrieve +def snippet_for_set_settings67 + # >SEPARATOR setSettings specify_attributes_not_to_retrieve # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "company", distinct: true) + Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["*", "-SKU", "-internal_desc"]) ) # >LOG @@ -5213,17 +8758,14 @@ def snippet_for_set_settings9 # Snippet for the setSettings method. # -# distinct design -def snippet_for_set_settings10 - # >SEPARATOR setSettings distinct design +# neural_search +def snippet_for_set_settings68 + # >SEPARATOR setSettings neural_search # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "design", distinct: true) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) # >LOG # use the class directly @@ -5236,14 +8778,14 @@ def snippet_for_set_settings10 # Snippet for the setSettings method. # -# distinct true -def snippet_for_set_settings11 - # >SEPARATOR setSettings distinct true +# keyword_search +def snippet_for_set_settings69 + # >SEPARATOR setSettings keyword_search # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(distinct: true)) + response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) # >LOG # use the class directly @@ -5256,16 +8798,18 @@ def snippet_for_set_settings11 # Snippet for the setSettings method. # -# distinct section -def snippet_for_set_settings12 - # >SEPARATOR setSettings distinct section +# set_default_ranking +def snippet_for_set_settings70 + # >SEPARATOR setSettings set_default_ranking # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "section", distinct: true) + Algolia::Search::IndexSettings.new( + ranking: ["typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"] + ) ) # >LOG @@ -5279,16 +8823,18 @@ def snippet_for_set_settings12 # Snippet for the setSettings method. # -# attributesForFaceting allergens -def snippet_for_set_settings13 - # >SEPARATOR setSettings attributesForFaceting allergens +# set_ranking_by_attribute_asc +def snippet_for_set_settings71 + # >SEPARATOR setSettings set_ranking_by_attribute_asc # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["allergens"]) + Algolia::Search::IndexSettings.new( + ranking: ["asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) ) # >LOG @@ -5302,16 +8848,18 @@ def snippet_for_set_settings13 # Snippet for the setSettings method. # -# attributesForFaceting categoryPageId -def snippet_for_set_settings14 - # >SEPARATOR setSettings attributesForFaceting categoryPageId +# set_ranking_by_attribute_desc +def snippet_for_set_settings72 + # >SEPARATOR setSettings set_ranking_by_attribute_desc # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["searchable(categoryPageId)"]) + Algolia::Search::IndexSettings.new( + ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) ) # >LOG @@ -5325,16 +8873,16 @@ def snippet_for_set_settings14 # Snippet for the setSettings method. # -# unretrievableAttributes -def snippet_for_set_settings15 - # >SEPARATOR setSettings unretrievableAttributes +# restrict_searchable_attributes +def snippet_for_set_settings73 + # >SEPARATOR setSettings restrict_searchable_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(unretrievable_attributes: ["visible_by"]) + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(popularity)", "asc(price)"]) ) # >LOG @@ -5348,17 +8896,14 @@ def snippet_for_set_settings15 # Snippet for the setSettings method. # -# attributesForFaceting user restricted data -def snippet_for_set_settings16 - # >SEPARATOR setSettings attributesForFaceting user restricted data +# set_default_relevancy +def snippet_for_set_settings74 + # >SEPARATOR setSettings set_default_relevancy # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(visible_by)"]) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(relevancy_strictness: 90)) # >LOG # use the class directly @@ -5371,16 +8916,16 @@ def snippet_for_set_settings16 # Snippet for the setSettings method. # -# attributesForFaceting optional filters -def snippet_for_set_settings17 - # >SEPARATOR setSettings attributesForFaceting optional filters +# set_replicas +def snippet_for_set_settings75 + # >SEPARATOR setSettings set_replicas # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["can_deliver_quickly", "restaurant"]) + Algolia::Search::IndexSettings.new(replicas: ["name_of_replica_index1", "name_of_replica_index2"]) ) # >LOG @@ -5394,16 +8939,56 @@ def snippet_for_set_settings17 # Snippet for the setSettings method. # -# attributesForFaceting redirect index -def snippet_for_set_settings18 - # >SEPARATOR setSettings attributesForFaceting redirect index +# set_default_max_values_per_facet +def snippet_for_set_settings76 + # >SEPARATOR setSettings set_default_max_values_per_facet + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(max_values_per_facet: 100)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_default_sort_facet_values_by +def snippet_for_set_settings77 + # >SEPARATOR setSettings set_default_sort_facet_values_by + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(sort_facet_values_by: "alpha")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_attributes_to_snippet +def snippet_for_set_settings78 + # >SEPARATOR setSettings set_attributes_to_snippet # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["query_terms"]) + Algolia::Search::IndexSettings.new(attributes_to_snippet: ["content:80", "description"]) ) # >LOG @@ -5417,16 +9002,16 @@ def snippet_for_set_settings18 # Snippet for the setSettings method. # -# attributesForFaceting multiple consequences -def snippet_for_set_settings19 - # >SEPARATOR setSettings attributesForFaceting multiple consequences +# set_all_attributes_to_snippet +def snippet_for_set_settings79 + # >SEPARATOR setSettings set_all_attributes_to_snippet # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["director"]) + Algolia::Search::IndexSettings.new(attributes_to_snippet: ["*:80"]) ) # >LOG @@ -5440,16 +9025,76 @@ def snippet_for_set_settings19 # Snippet for the setSettings method. # -# attributesForFaceting in-depth optional filters -def snippet_for_set_settings20 - # >SEPARATOR setSettings attributesForFaceting in-depth optional filters +# set_default_highlight_pre_tag +def snippet_for_set_settings80 + # >SEPARATOR setSettings set_default_highlight_pre_tag + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(highlight_pre_tag: "")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_default_highlight_post_tag +def snippet_for_set_settings81 + # >SEPARATOR setSettings set_default_highlight_post_tag + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(highlight_post_tag: "")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_default_snippet_ellipsis_text +def snippet_for_set_settings82 + # >SEPARATOR setSettings set_default_snippet_ellipsis_text + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(snippet_ellipsis_text: "…")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# enable_restrict_highlight_and_snippet_arrays_by_default +def snippet_for_set_settings83 + # >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(brand)"]) + Algolia::Search::IndexSettings.new(restrict_highlight_and_snippet_arrays: true) ) # >LOG @@ -5463,14 +9108,14 @@ def snippet_for_set_settings20 # Snippet for the setSettings method. # -# mode neuralSearch -def snippet_for_set_settings21 - # >SEPARATOR setSettings mode neuralSearch +# set_default_hits_per_page +def snippet_for_set_settings84 + # >SEPARATOR setSettings set_default_hits_per_page # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) + response = client.set_settings("", Algolia::Search::IndexSettings.new(hits_per_page: 20)) # >LOG # use the class directly @@ -5483,14 +9128,14 @@ def snippet_for_set_settings21 # Snippet for the setSettings method. # -# mode keywordSearch -def snippet_for_set_settings22 - # >SEPARATOR setSettings mode keywordSearch +# set_pagination_limit +def snippet_for_set_settings85 + # >SEPARATOR setSettings set_pagination_limit # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) + response = client.set_settings("", Algolia::Search::IndexSettings.new(pagination_limited_to: 1000)) # >LOG # use the class directly @@ -5503,16 +9148,76 @@ def snippet_for_set_settings22 # Snippet for the setSettings method. # -# searchableAttributes same priority -def snippet_for_set_settings23 - # >SEPARATOR setSettings searchableAttributes same priority +# set_default_min_word_size_for_one_typo +def snippet_for_set_settings86 + # >SEPARATOR setSettings set_default_min_word_size_for_one_typo + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(min_word_sizefor1_typo: 4)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_default_min_word_size_for_two_typos +def snippet_for_set_settings87 + # >SEPARATOR setSettings set_default_min_word_size_for_two_typos + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(min_word_sizefor2_typos: 4)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_default_typo_tolerance_mode +def snippet_for_set_settings88 + # >SEPARATOR setSettings set_default_typo_tolerance_mode + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(typo_tolerance: true)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# disable_typos_on_numeric_tokens_by_default +def snippet_for_set_settings89 + # >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title,comments", "ingredients"]) + Algolia::Search::IndexSettings.new(allow_typos_on_numeric_tokens: false) ) # >LOG @@ -5526,16 +9231,16 @@ def snippet_for_set_settings23 # Snippet for the setSettings method. # -# searchableAttributes higher priority -def snippet_for_set_settings24 - # >SEPARATOR setSettings searchableAttributes higher priority +# disable_typo_tolerance_for_words +def snippet_for_set_settings90 + # >SEPARATOR setSettings disable_typo_tolerance_for_words # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title", "ingredients"]) + Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_words: ["wheel", "1X2BCD"]) ) # >LOG @@ -5549,16 +9254,36 @@ def snippet_for_set_settings24 # Snippet for the setSettings method. # -# customRanking retweets -def snippet_for_set_settings25 - # >SEPARATOR setSettings customRanking retweets +# set_separators_to_index +def snippet_for_set_settings91 + # >SEPARATOR setSettings set_separators_to_index + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(separators_to_index: "+#")) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_languages_using_querylanguages +def snippet_for_set_settings92 + # >SEPARATOR setSettings set_languages_using_querylanguages # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(retweets)", "desc(likes)"]) + Algolia::Search::IndexSettings.new(query_languages: ["es"], ignore_plurals: true) ) # >LOG @@ -5572,16 +9297,16 @@ def snippet_for_set_settings25 # Snippet for the setSettings method. # -# customRanking boosted -def snippet_for_set_settings26 - # >SEPARATOR setSettings customRanking boosted +# set_attributes_to_transliterate +def snippet_for_set_settings93 + # >SEPARATOR setSettings set_attributes_to_transliterate # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(boosted)"]) + Algolia::Search::IndexSettings.new(index_languages: ["ja"], attributes_to_transliterate: ["name", "description"]) ) # >LOG @@ -5595,16 +9320,16 @@ def snippet_for_set_settings26 # Snippet for the setSettings method. # -# customRanking pageviews -def snippet_for_set_settings27 - # >SEPARATOR setSettings customRanking pageviews +# set_languages_using_querylanguages +def snippet_for_set_settings94 + # >SEPARATOR setSettings set_languages_using_querylanguages # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(pageviews)", "desc(comments)"]) + Algolia::Search::IndexSettings.new(query_languages: ["es"], remove_stop_words: true) ) # >LOG @@ -5617,20 +9342,17 @@ def snippet_for_set_settings27 end # Snippet for the setSettings method. -# -# customRanking applying search parameters for a specific query -def snippet_for_set_settings28 - # >SEPARATOR setSettings customRanking applying search parameters for a specific query +# +# set_camel_case_attributes +def snippet_for_set_settings95 + # >SEPARATOR setSettings set_camel_case_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - custom_ranking: ["desc(nb_airline_liaisons)"], - attributes_for_faceting: ["city, country"] - ) + Algolia::Search::IndexSettings.new(camel_case_attributes: ["description"]) ) # >LOG @@ -5644,16 +9366,16 @@ def snippet_for_set_settings28 # Snippet for the setSettings method. # -# customRanking rounded pageviews -def snippet_for_set_settings29 - # >SEPARATOR setSettings customRanking rounded pageviews +# set_decompounded_attributes +def snippet_for_set_settings96 + # >SEPARATOR setSettings set_decompounded_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(rounded_pageviews)", "desc(comments)"]) + Algolia::Search::IndexSettings.new(decompounded_attributes: {de: ["name"]}) ) # >LOG @@ -5667,16 +9389,18 @@ def snippet_for_set_settings29 # Snippet for the setSettings method. # -# customRanking price -def snippet_for_set_settings30 - # >SEPARATOR setSettings customRanking price +# set_decompounded_multiple_attributes +def snippet_for_set_settings97 + # >SEPARATOR setSettings set_decompounded_multiple_attributes # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(price)"]) + Algolia::Search::IndexSettings.new( + decompounded_attributes: {de: ["name_de", "description_de"], fi: ["name_fi", "description_fi"]} + ) ) # >LOG @@ -5690,18 +9414,16 @@ def snippet_for_set_settings30 # Snippet for the setSettings method. # -# ranking exhaustive -def snippet_for_set_settings31 - # >SEPARATOR setSettings ranking exhaustive +# set_keep_diacritics_on_characters +def snippet_for_set_settings98 + # >SEPARATOR setSettings set_keep_diacritics_on_characters # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] - ) + Algolia::Search::IndexSettings.new(keep_diacritics_on_characters: "øé") ) # >LOG @@ -5715,16 +9437,16 @@ def snippet_for_set_settings31 # Snippet for the setSettings method. # -# ranking standard replica -def snippet_for_set_settings32 - # >SEPARATOR setSettings ranking standard replica +# set_custom_normalization +def snippet_for_set_settings99 + # >SEPARATOR setSettings set_custom_normalization # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(ranking: ["desc(post_date_timestamp)"]) + Algolia::Search::IndexSettings.new(custom_normalization: {default: {ä: "ae"}}) ) # >LOG @@ -5738,16 +9460,16 @@ def snippet_for_set_settings32 # Snippet for the setSettings method. # -# ranking virtual replica -def snippet_for_set_settings33 - # >SEPARATOR setSettings ranking virtual replica +# set_languages_using_querylanguages +def snippet_for_set_settings100 + # >SEPARATOR setSettings set_languages_using_querylanguages # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(post_date_timestamp)"]) + Algolia::Search::IndexSettings.new(query_languages: ["es"], remove_stop_words: true, ignore_plurals: true) ) # >LOG @@ -5761,20 +9483,14 @@ def snippet_for_set_settings33 # Snippet for the setSettings method. # -# customRanking and ranking sort alphabetically -def snippet_for_set_settings34 - # >SEPARATOR setSettings customRanking and ranking sort alphabetically +# set_indexlanguages +def snippet_for_set_settings101 + # >SEPARATOR setSettings set_indexlanguages # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new( - custom_ranking: ["asc(textual_attribute)"], - ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] - ) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(index_languages: ["ja"])) # >LOG # use the class directly @@ -5787,17 +9503,14 @@ def snippet_for_set_settings34 # Snippet for the setSettings method. # -# relevancyStrictness -def snippet_for_set_settings35 - # >SEPARATOR setSettings relevancyStrictness +# enable_decompound_query_by_default +def snippet_for_set_settings102 + # >SEPARATOR setSettings enable_decompound_query_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(custom_ranking: ["asc(textual_attribute)"], relevancy_strictness: 0) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(decompound_query: true)) # >LOG # use the class directly @@ -5810,17 +9523,14 @@ def snippet_for_set_settings35 # Snippet for the setSettings method. # -# create replica index -def snippet_for_set_settings36 - # >SEPARATOR setSettings create replica index +# enable_rules_syntax_by_default +def snippet_for_set_settings103 + # >SEPARATOR setSettings enable_rules_syntax_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(replicas: ["products_price_desc"]) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(enable_rules: true)) # >LOG # use the class directly @@ -5833,17 +9543,14 @@ def snippet_for_set_settings36 # Snippet for the setSettings method. # -# create virtual replica index -def snippet_for_set_settings37 - # >SEPARATOR setSettings create virtual replica index +# enable_personalization_settings +def snippet_for_set_settings104 + # >SEPARATOR setSettings enable_personalization_settings # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(replicas: ["virtual(products_price_desc)"]) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(enable_personalization: true)) # >LOG # use the class directly @@ -5856,14 +9563,14 @@ def snippet_for_set_settings37 # Snippet for the setSettings method. # -# unlink replica index -def snippet_for_set_settings38 - # >SEPARATOR setSettings unlink replica index +# set_default_query_type +def snippet_for_set_settings105 + # >SEPARATOR setSettings set_default_query_type # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(replicas: [""])) + response = client.set_settings("", Algolia::Search::IndexSettings.new(query_type: "prefixLast")) # >LOG # use the class directly @@ -5876,17 +9583,16 @@ def snippet_for_set_settings38 # Snippet for the setSettings method. # -# forwardToReplicas -def snippet_for_set_settings39 - # >SEPARATOR setSettings forwardToReplicas +# set_default_remove_words_if_no_result +def snippet_for_set_settings106 + # >SEPARATOR setSettings set_default_remove_words_if_no_result # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["name", "description"]), - true + Algolia::Search::IndexSettings.new(remove_words_if_no_results: "none") ) # >LOG @@ -5900,14 +9606,14 @@ def snippet_for_set_settings39 # Snippet for the setSettings method. # -# maxValuesPerFacet -def snippet_for_set_settings40 - # >SEPARATOR setSettings maxValuesPerFacet +# enable_advanced_syntax_by_default +def snippet_for_set_settings107 + # >SEPARATOR setSettings enable_advanced_syntax_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(max_values_per_facet: 1000)) + response = client.set_settings("", Algolia::Search::IndexSettings.new(advanced_syntax: true)) # >LOG # use the class directly @@ -5920,14 +9626,17 @@ def snippet_for_set_settings40 # Snippet for the setSettings method. # -# maxFacetHits -def snippet_for_set_settings41 - # >SEPARATOR setSettings maxFacetHits +# set_default_optional_words +def snippet_for_set_settings108 + # >SEPARATOR setSettings set_default_optional_words # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings("", Algolia::Search::IndexSettings.new(max_facet_hits: 1000)) + response = client.set_settings( + "", + Algolia::Search::IndexSettings.new(optional_words: ["blue", "iphone case"]) + ) # >LOG # use the class directly @@ -5940,18 +9649,16 @@ def snippet_for_set_settings41 # Snippet for the setSettings method. # -# attributesForFaceting complex -def snippet_for_set_settings42 - # >SEPARATOR setSettings attributesForFaceting complex +# disabling_prefix_search_for_some_attributes_by_default +def snippet_for_set_settings109 + # >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - attributes_for_faceting: ["actor", "filterOnly(category)", "searchable(publisher)"] - ) + Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["sku"]) ) # >LOG @@ -5965,18 +9672,16 @@ def snippet_for_set_settings42 # Snippet for the setSettings method. # -# ranking closest dates -def snippet_for_set_settings43 - # >SEPARATOR setSettings ranking closest dates +# disabling_exact_for_some_attributes_by_default +def snippet_for_set_settings110 + # >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - ranking: ["asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] - ) + Algolia::Search::IndexSettings.new(disable_exact_on_attributes: ["description"]) ) # >LOG @@ -5990,16 +9695,16 @@ def snippet_for_set_settings43 # Snippet for the setSettings method. # -# searchableAttributes item variation -def snippet_for_set_settings44 - # >SEPARATOR setSettings searchableAttributes item variation +# set_default_exact_single_word_query +def snippet_for_set_settings111 + # >SEPARATOR setSettings set_default_exact_single_word_query # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["design", "type", "color"]) + Algolia::Search::IndexSettings.new(exact_on_single_word_query: "attribute") ) # >LOG @@ -6013,19 +9718,16 @@ def snippet_for_set_settings44 # Snippet for the setSettings method. # -# searchableAttributes around location -def snippet_for_set_settings45 - # >SEPARATOR setSettings searchableAttributes around location +# set_default_aternative_as_exact +def snippet_for_set_settings112 + # >SEPARATOR setSettings set_default_aternative_as_exact # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "country", "code", "iata_code"], - custom_ranking: ["desc(links_count)"] - ) + Algolia::Search::IndexSettings.new(alternatives_as_exact: ["ignorePlurals", "singleWordSynonym"]) ) # >LOG @@ -6039,20 +9741,14 @@ def snippet_for_set_settings45 # Snippet for the setSettings method. # -# searchableAttributes around location -def snippet_for_set_settings46 - # >SEPARATOR setSettings searchableAttributes around location +# enable_advanced_syntax_by_default +def snippet_for_set_settings113 + # >SEPARATOR setSettings enable_advanced_syntax_by_default # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "country", "code", "iata_code"], - custom_ranking: ["desc(links_count)"] - ) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(advanced_syntax: true)) # >LOG # use the class directly @@ -6065,16 +9761,16 @@ def snippet_for_set_settings46 # Snippet for the setSettings method. # -# disableTypoToleranceOnAttributes -def snippet_for_set_settings47 - # >SEPARATOR setSettings disableTypoToleranceOnAttributes +# set_numeric_attributes_for_filtering +def snippet_for_set_settings114 + # >SEPARATOR setSettings set_numeric_attributes_for_filtering # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new(numeric_attributes_for_filtering: ["quantity", "popularity"]) ) # >LOG @@ -6088,83 +9784,16 @@ def snippet_for_set_settings47 # Snippet for the setSettings method. # -# everything -def snippet_for_set_settings48 - # >SEPARATOR setSettings everything +# enable_compression_of_integer_array +def snippet_for_set_settings115 + # >SEPARATOR setSettings enable_compression_of_integer_array # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - advanced_syntax: true, - advanced_syntax_features: ["exactPhrase"], - allow_compression_of_integer_array: true, - allow_typos_on_numeric_tokens: true, - alternatives_as_exact: ["singleWordSynonym"], - attribute_criteria_computed_by_min_proximity: true, - attribute_for_distinct: "test", - attributes_for_faceting: ["algolia"], - attributes_to_highlight: ["algolia"], - attributes_to_retrieve: ["algolia"], - attributes_to_snippet: ["algolia"], - attributes_to_transliterate: ["algolia"], - camel_case_attributes: ["algolia"], - custom_normalization: {algolia: {aloglia: "aglolia"}}, - custom_ranking: ["algolia"], - decompound_query: false, - decompounded_attributes: {algolia: "aloglia"}, - disable_exact_on_attributes: ["algolia"], - disable_prefix_on_attributes: ["algolia"], - disable_typo_tolerance_on_attributes: ["algolia"], - disable_typo_tolerance_on_words: ["algolia"], - distinct: 3, - enable_personalization: true, - enable_re_ranking: false, - enable_rules: true, - exact_on_single_word_query: "attribute", - highlight_pre_tag: "", - highlight_post_tag: "", - hits_per_page: 10, - ignore_plurals: false, - index_languages: ["fr"], - keep_diacritics_on_characters: "abc", - max_facet_hits: 20, - max_values_per_facet: 30, - min_proximity: 6, - min_word_sizefor1_typo: 5, - min_word_sizefor2_typos: 11, - mode: "neuralSearch", - numeric_attributes_for_filtering: ["algolia"], - optional_words: ["myspace"], - pagination_limited_to: 0, - query_languages: ["fr"], - query_type: "prefixLast", - ranking: ["geo"], - re_ranking_apply_filter: "mySearch:filters", - relevancy_strictness: 10, - remove_stop_words: false, - remove_words_if_no_results: "lastWords", - rendering_content: Algolia::Search::RenderingContent.new( - facet_ordering: Algolia::Search::FacetOrdering.new( - facets: Algolia::Search::Facets.new(order: ["a", "b"]), - values: {a: Algolia::Search::Value.new(order: ["b"], sort_remaining_by: "count")} - ) - ), - replace_synonyms_in_highlight: true, - replicas: [""], - response_fields: ["algolia"], - restrict_highlight_and_snippet_arrays: true, - searchable_attributes: ["foo"], - semantic_search: Algolia::Search::SemanticSearch.new(event_sources: ["foo"]), - separators_to_index: "bar", - snippet_ellipsis_text: "---", - sort_facet_values_by: "date", - typo_tolerance: false, - unretrievable_attributes: ["foo"], - user_data: {user: "data"} - ) + Algolia::Search::IndexSettings.new(allow_compression_of_integer_array: true) ) # >LOG @@ -6178,21 +9807,14 @@ def snippet_for_set_settings48 # Snippet for the setSettings method. # -# searchableAttributesWithCustomRankingsAndAttributesForFaceting -def snippet_for_set_settings49 - # >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting +# set_attributes_for_distinct +def snippet_for_set_settings116 + # >SEPARATOR setSettings set_attributes_for_distinct # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["brand", "name", "categories", "unordered(description)"], - custom_ranking: ["desc(popularity)"], - attributes_for_faceting: ["searchable(brand)", "type", "categories", "price"] - ) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(attribute_for_distinct: "url")) # >LOG # use the class directly @@ -6205,18 +9827,16 @@ def snippet_for_set_settings49 # Snippet for the setSettings method. # -# searchableAttributesProductReferenceSuffixes -def snippet_for_set_settings50 - # >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes +# set_distinct +def snippet_for_set_settings117 + # >SEPARATOR setSettings set_distinct # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "product_reference", "product_reference_suffixes"] - ) + Algolia::Search::IndexSettings.new(distinct: 1, attribute_for_distinct: "url") ) # >LOG @@ -6230,16 +9850,16 @@ def snippet_for_set_settings50 # Snippet for the setSettings method. # -# queryLanguageAndIgnorePlurals -def snippet_for_set_settings51 - # >SEPARATOR setSettings queryLanguageAndIgnorePlurals +# set_replace_synonyms_in_highlights +def snippet_for_set_settings118 + # >SEPARATOR setSettings set_replace_synonyms_in_highlights # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(query_languages: ["en"], ignore_plurals: true) + Algolia::Search::IndexSettings.new(replace_synonyms_in_highlight: false) ) # >LOG @@ -6253,17 +9873,14 @@ def snippet_for_set_settings51 # Snippet for the setSettings method. # -# searchableAttributesInMovies -def snippet_for_set_settings52 - # >SEPARATOR setSettings searchableAttributesInMovies +# set_min_proximity +def snippet_for_set_settings119 + # >SEPARATOR setSettings set_min_proximity # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API - response = client.set_settings( - "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title_eng", "title_fr", "title_es"]) - ) + response = client.set_settings("", Algolia::Search::IndexSettings.new(min_proximity: 1)) # >LOG # use the class directly @@ -6276,16 +9893,16 @@ def snippet_for_set_settings52 # Snippet for the setSettings method. # -# disablePrefixOnAttributes -def snippet_for_set_settings53 - # >SEPARATOR setSettings disablePrefixOnAttributes +# set_default_field +def snippet_for_set_settings120 + # >SEPARATOR setSettings set_default_field # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new(response_fields: ["hits", "hitsPerPage", "nbPages", "page"]) ) # >LOG @@ -6299,16 +9916,36 @@ def snippet_for_set_settings53 # Snippet for the setSettings method. # -# disableTypoToleranceOnAttributes -def snippet_for_set_settings54 - # >SEPARATOR setSettings disableTypoToleranceOnAttributes +# set_max_facet_hits +def snippet_for_set_settings121 + # >SEPARATOR setSettings set_max_facet_hits + # Initialize the client + client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") + + # Call the API + response = client.set_settings("", Algolia::Search::IndexSettings.new(max_facet_hits: 10)) + + # >LOG + # use the class directly + puts(response) + + # print the JSON response + puts(response.to_json) + # SEPARATOR< +end + +# Snippet for the setSettings method. +# +# set_attribute_criteria_computed_by_min_proximity +def snippet_for_set_settings122 + # >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new(attribute_criteria_computed_by_min_proximity: true) ) # >LOG @@ -6322,16 +9959,18 @@ def snippet_for_set_settings54 # Snippet for the setSettings method. # -# searchableAttributesSimpleExample -def snippet_for_set_settings55 - # >SEPARATOR setSettings searchableAttributesSimpleExample +# set_user_data +def snippet_for_set_settings123 + # >SEPARATOR setSettings set_user_data # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new( + user_data: {extraData: "This is the custom data that you want to store in your index"} + ) ) # >LOG @@ -6345,16 +9984,26 @@ def snippet_for_set_settings55 # Snippet for the setSettings method. # -# searchableAttributesSimpleExampleAlt -def snippet_for_set_settings56 - # >SEPARATOR setSettings searchableAttributesSimpleExampleAlt +# set_rendering_content +def snippet_for_set_settings124 + # >SEPARATOR setSettings set_rendering_content # Initialize the client client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY") # Call the API response = client.set_settings( "", - Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number", "serial_number_suffixes"]) + Algolia::Search::IndexSettings.new( + rendering_content: Algolia::Search::RenderingContent.new( + facet_ordering: Algolia::Search::FacetOrdering.new( + facets: Algolia::Search::Facets.new(order: ["size", "brand"]), + values: { + brand: Algolia::Search::Value.new(order: ["uniqlo"], hide: ["muji"], sort_remaining_by: "count"), + size: Algolia::Search::Value.new(order: ["S", "M", "L"], sort_remaining_by: "hidden") + } + ) + ) + ) ) # >LOG diff --git a/docs/snippets/scala/src/main/scala/Search.scala b/docs/snippets/scala/src/main/scala/Search.scala index 843b8117d3..d74b8e9e72 100644 --- a/docs/snippets/scala/src/main/scala/Search.scala +++ b/docs/snippets/scala/src/main/scala/Search.scala @@ -4431,9 +4431,121 @@ class SnippetSearchClient { /** Snippet for the searchSingleIndex method. * - * facetFiltersNeg + * facetFiltersBook */ def snippetForSearchClientSearchSingleIndex14(): Unit = { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some(FacetFilters(Seq(FacetFilters("category:Book")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * facetFiltersAND + */ + def snippetForSearchClientSearchSingleIndex15(): Unit = { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some(FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("author:John Doe")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * facetFiltersOR + */ + def snippetForSearchClientSearchSingleIndex16(): Unit = { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = + Some(FacetFilters(Seq(FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("author:John Doe")))))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * facetFiltersCombined + */ + def snippetForSearchClientSearchSingleIndex17(): Unit = { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some( + FacetFilters( + Seq( + FacetFilters("author:John Doe"), + FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("category:Movie"))) + ) + ) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * facetFiltersNeg + */ + def snippetForSearchClientSearchSingleIndex18(): Unit = { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4458,7 +4570,7 @@ class SnippetSearchClient { * * filtersAndFacetFilters */ - def snippetForSearchClientSearchSingleIndex15(): Unit = { + def snippetForSearchClientSearchSingleIndex19(): Unit = { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4484,7 +4596,7 @@ class SnippetSearchClient { * * facet author genre */ - def snippetForSearchClientSearchSingleIndex16(): Unit = { + def snippetForSearchClientSearchSingleIndex20(): Unit = { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4509,7 +4621,7 @@ class SnippetSearchClient { * * facet wildcard */ - def snippetForSearchClientSearchSingleIndex17(): Unit = { + def snippetForSearchClientSearchSingleIndex21(): Unit = { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4534,7 +4646,7 @@ class SnippetSearchClient { * * maxValuesPerFacet */ - def snippetForSearchClientSearchSingleIndex18(): Unit = { + def snippetForSearchClientSearchSingleIndex22(): Unit = { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4559,7 +4671,7 @@ class SnippetSearchClient { * * aroundLatLng */ - def snippetForSearchClientSearchSingleIndex19(): Unit = { + def snippetForSearchClientSearchSingleIndex23(): Unit = { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4584,7 +4696,7 @@ class SnippetSearchClient { * * aroundLatLngViaIP */ - def snippetForSearchClientSearchSingleIndex20(): Unit = { + def snippetForSearchClientSearchSingleIndex24(): Unit = { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4609,7 +4721,7 @@ class SnippetSearchClient { * * aroundRadius */ - def snippetForSearchClientSearchSingleIndex21(): Unit = { + def snippetForSearchClientSearchSingleIndex25(): Unit = { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4635,7 +4747,7 @@ class SnippetSearchClient { * * insideBoundingBox */ - def snippetForSearchClientSearchSingleIndex22(): Unit = { + def snippetForSearchClientSearchSingleIndex26(): Unit = { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4661,7 +4773,7 @@ class SnippetSearchClient { * * insidePolygon */ - def snippetForSearchClientSearchSingleIndex23(): Unit = { + def snippetForSearchClientSearchSingleIndex27(): Unit = { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4692,7 +4804,7 @@ class SnippetSearchClient { * * insidePolygon */ - def snippetForSearchClientSearchSingleIndex24(): Unit = { + def snippetForSearchClientSearchSingleIndex28(): Unit = { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4723,7 +4835,7 @@ class SnippetSearchClient { * * optionalFilters */ - def snippetForSearchClientSearchSingleIndex25(): Unit = { + def snippetForSearchClientSearchSingleIndex29(): Unit = { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4748,7 +4860,7 @@ class SnippetSearchClient { * * optionalFiltersMany */ - def snippetForSearchClientSearchSingleIndex26(): Unit = { + def snippetForSearchClientSearchSingleIndex30(): Unit = { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4781,7 +4893,7 @@ class SnippetSearchClient { * * optionalFiltersSimple */ - def snippetForSearchClientSearchSingleIndex27(): Unit = { + def snippetForSearchClientSearchSingleIndex31(): Unit = { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4807,7 +4919,7 @@ class SnippetSearchClient { * * restrictSearchableAttributes */ - def snippetForSearchClientSearchSingleIndex28(): Unit = { + def snippetForSearchClientSearchSingleIndex32(): Unit = { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4832,7 +4944,7 @@ class SnippetSearchClient { * * getRankingInfo */ - def snippetForSearchClientSearchSingleIndex29(): Unit = { + def snippetForSearchClientSearchSingleIndex33(): Unit = { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4857,7 +4969,7 @@ class SnippetSearchClient { * * clickAnalytics */ - def snippetForSearchClientSearchSingleIndex30(): Unit = { + def snippetForSearchClientSearchSingleIndex34(): Unit = { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4882,7 +4994,7 @@ class SnippetSearchClient { * * clickAnalyticsUserToken */ - def snippetForSearchClientSearchSingleIndex31(): Unit = { + def snippetForSearchClientSearchSingleIndex35(): Unit = { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4908,7 +5020,7 @@ class SnippetSearchClient { * * enablePersonalization */ - def snippetForSearchClientSearchSingleIndex32(): Unit = { + def snippetForSearchClientSearchSingleIndex36(): Unit = { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4934,7 +5046,7 @@ class SnippetSearchClient { * * userToken */ - def snippetForSearchClientSearchSingleIndex33(): Unit = { + def snippetForSearchClientSearchSingleIndex37(): Unit = { // >SEPARATOR searchSingleIndex userToken // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4955,11 +5067,37 @@ class SnippetSearchClient { // SEPARATOR< } + /** Snippet for the searchSingleIndex method. + * + * userToken1234 + */ + def snippetForSearchClientSearchSingleIndex38(): Unit = { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + userToken = Some("user-1234") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + /** Snippet for the searchSingleIndex method. * * analyticsTag */ - def snippetForSearchClientSearchSingleIndex34(): Unit = { + def snippetForSearchClientSearchSingleIndex39(): Unit = { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -4984,7 +5122,7 @@ class SnippetSearchClient { * * facetFiltersUsers */ - def snippetForSearchClientSearchSingleIndex35(): Unit = { + def snippetForSearchClientSearchSingleIndex40(): Unit = { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5009,7 +5147,7 @@ class SnippetSearchClient { * * buildTheQuery */ - def snippetForSearchClientSearchSingleIndex36(): Unit = { + def snippetForSearchClientSearchSingleIndex41(): Unit = { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5032,18 +5170,24 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the searchSynonyms method. + /** Snippet for the searchSingleIndex method. * - * searchSynonyms with minimal parameters + * attributesToHighlightOverride */ - def snippetForSearchClientSearchSynonyms(): Unit = { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + def snippetForSearchClientSearchSingleIndex42(): Unit = { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.searchSynonyms( - indexName = "" + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToHighlight = Some(Seq("title", "content")) + ) + ) ) // >LOG @@ -5052,24 +5196,22 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the searchSynonyms method. + /** Snippet for the searchSingleIndex method. * - * searchSynonyms with all parameters + * disableTypoToleranceOnAttributes */ - def snippetForSearchClientSearchSynonyms1(): Unit = { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + def snippetForSearchClientSearchSingleIndex43(): Unit = { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.searchSynonyms( + val response = client.searchSingleIndex( indexName = "", - searchSynonymsParams = Some( - SearchSynonymsParams( - query = Some("myQuery"), - `type` = Some(SynonymType.withName("altcorrection1")), - page = Some(10), - hitsPerPage = Some(10) + searchParams = Some( + SearchParamsObject( + query = Some("query"), + disableTypoToleranceOnAttributes = Some(Seq("serial_number")) ) ) ) @@ -5080,22 +5222,22 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the searchUserIds method. + /** Snippet for the searchSingleIndex method. * - * searchUserIds + * search_a_query */ - def snippetForSearchClientSearchUserIds(): Unit = { - // >SEPARATOR searchUserIds default + def snippetForSearchClientSearchSingleIndex44(): Unit = { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.searchUserIds( - searchUserIdsParams = SearchUserIdsParams( - query = "test", - clusterName = Some("theClusterName"), - page = Some(5), - hitsPerPage = Some(10) + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("shirt") + ) ) ) @@ -5105,20 +5247,21 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the setDictionarySettings method. + /** Snippet for the searchSingleIndex method. * - * get setDictionarySettings results with minimal parameters + * search_everything */ - def snippetForSearchClientSetDictionarySettings(): Unit = { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + def snippetForSearchClientSearchSingleIndex45(): Unit = { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)) + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("") ) ) ) @@ -5129,22 +5272,22 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the setDictionarySettings method. + /** Snippet for the searchSingleIndex method. * - * get setDictionarySettings results with all parameters + * api_filtering_range_example */ - def snippetForSearchClientSetDictionarySettings1(): Unit = { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + def snippetForSearchClientSearchSingleIndex46(): Unit = { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)), - stopwords = Some(Map("fr" -> false)), - compounds = Some(Map("ru" -> true)) + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("books"), + filters = Some("price:10 TO 20") ) ) ) @@ -5155,22 +5298,25 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the setSettings method. + /** Snippet for the searchSingleIndex method. * - * minimal parameters + * search_a_query */ - def snippetForSearchClientSetSettings(): Unit = { - // >SEPARATOR setSettings minimal parameters + def snippetForSearchClientSearchSingleIndex47(): Unit = { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.setSettings( + val response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - paginationLimitedTo = Some(10) - ), - forwardToReplicas = Some(true) + searchParams = Some( + SearchParamsObject( + query = Some(""), + similarQuery = Some("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen"), + filters = Some("year:1991 TO 2001") + ) + ) ) // >LOG @@ -5179,22 +5325,3788 @@ class SnippetSearchClient { // SEPARATOR< } - /** Snippet for the setSettings method. + /** Snippet for the searchSingleIndex method. * - * boolean typoTolerance + * override_retrievable_attributes */ - def snippetForSearchClientSetSettings1(): Unit = { - // >SEPARATOR setSettings boolean typoTolerance + def snippetForSearchClientSearchSingleIndex48(): Unit = { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") // Call the API - val response = client.setSettings( + val response = client.searchSingleIndex( indexName = "", - indexSettings = IndexSettings( - typoTolerance = Some(TypoTolerance(true)) - ), - forwardToReplicas = Some(true) + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToRetrieve = Some(Seq("title", "content")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * restrict_searchable_attributes + */ + def snippetForSearchClientSearchSingleIndex49(): Unit = { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + restrictSearchableAttributes = Some(Seq("title", "author")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_relevancy + */ + def snippetForSearchClientSearchSingleIndex50(): Unit = { + // >SEPARATOR searchSingleIndex override_default_relevancy + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + relevancyStrictness = Some(70) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_filters + */ + def snippetForSearchClientSearchSingleIndex51(): Unit = { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("(category:Book OR category:Ebook) AND _tags:published") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_all_filters + */ + def snippetForSearchClientSearchSingleIndex52(): Unit = { + // >SEPARATOR searchSingleIndex apply_all_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some( + "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\"" + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * escape_spaces + */ + def snippetForSearchClientSearchSingleIndex53(): Unit = { + // >SEPARATOR searchSingleIndex escape_spaces + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("category:\"Books and Comics\"") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * escape_keywords + */ + def snippetForSearchClientSearchSingleIndex54(): Unit = { + // >SEPARATOR searchSingleIndex escape_keywords + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("keyword:\"OR\"") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * escape_single_quotes + */ + def snippetForSearchClientSearchSingleIndex55(): Unit = { + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("content:\"It's a wonderful day\"") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * escape_double_quotes + */ + def snippetForSearchClientSearchSingleIndex56(): Unit = { + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("content:\"She said \"Hello World\"") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_filters + */ + def snippetForSearchClientSearchSingleIndex57(): Unit = { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalFilters = + Some(OptionalFilters(Seq(OptionalFilters("category:Book"), OptionalFilters("author:John Doe")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_negative_filters + */ + def snippetForSearchClientSearchSingleIndex58(): Unit = { + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalFilters = + Some(OptionalFilters(Seq(OptionalFilters("category:Book"), OptionalFilters("author:-John Doe")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_numeric_filters + */ + def snippetForSearchClientSearchSingleIndex59(): Unit = { + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + numericFilters = Some( + NumericFilters( + Seq( + NumericFilters("price < 1000"), + NumericFilters(Seq(NumericFilters("inStock = 1"), NumericFilters("deliveryDate < 1441755506"))) + ) + ) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_tag_filters + */ + def snippetForSearchClientSearchSingleIndex60(): Unit = { + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + tagFilters = + Some(TagFilters(Seq(TagFilters("SciFi"), TagFilters(Seq(TagFilters("Book"), TagFilters("Movie")))))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * apply_filters + */ + def snippetForSearchClientSearchSingleIndex61(): Unit = { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + sumOrFiltersScores = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * facets_all + */ + def snippetForSearchClientSearchSingleIndex62(): Unit = { + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facets = Some(Seq("*")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * retrieve_only_some_facets + */ + def snippetForSearchClientSearchSingleIndex63(): Unit = { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facets = Some(Seq("category", "author")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_max_values_per_facet + */ + def snippetForSearchClientSearchSingleIndex64(): Unit = { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + maxValuesPerFacet = Some(20) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_faceting_after_distinct + */ + def snippetForSearchClientSearchSingleIndex65(): Unit = { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetingAfterDistinct = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * sort_facet_values_alphabetically + */ + def snippetForSearchClientSearchSingleIndex66(): Unit = { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + sortFacetValuesBy = Some("count") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_attributes_to_snippet + */ + def snippetForSearchClientSearchSingleIndex67(): Unit = { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToSnippet = Some(Seq("title", "content:80")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_highlight_pre_tag + */ + def snippetForSearchClientSearchSingleIndex68(): Unit = { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + highlightPreTag = Some("") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_highlight_post_tag + */ + def snippetForSearchClientSearchSingleIndex69(): Unit = { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + highlightPostTag = Some("") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_snippet_ellipsis_text + */ + def snippetForSearchClientSearchSingleIndex70(): Unit = { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + snippetEllipsisText = Some("") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_restrict_highlight_and_snippet_arrays + */ + def snippetForSearchClientSearchSingleIndex71(): Unit = { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + restrictHighlightAndSnippetArrays = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * access_page + */ + def snippetForSearchClientSearchSingleIndex72(): Unit = { + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + page = Some(0) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_hits_per_page + */ + def snippetForSearchClientSearchSingleIndex73(): Unit = { + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + hitsPerPage = Some(10) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * get_nth_hit + */ + def snippetForSearchClientSearchSingleIndex74(): Unit = { + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + offset = Some(4) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * get_n_results + */ + def snippetForSearchClientSearchSingleIndex75(): Unit = { + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + length = Some(4) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_min_word_size_for_one_typo + */ + def snippetForSearchClientSearchSingleIndex76(): Unit = { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minWordSizefor1Typo = Some(2) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_min_word_size_for_two_typos + */ + def snippetForSearchClientSearchSingleIndex77(): Unit = { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minWordSizefor2Typos = Some(2) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_typo_tolerance_mode + */ + def snippetForSearchClientSearchSingleIndex78(): Unit = { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + typoTolerance = Some(TypoTolerance(false)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disable_typos_on_numeric_tokens_at_search_time + */ + def snippetForSearchClientSearchSingleIndex79(): Unit = { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + allowTyposOnNumericTokens = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_around_a_position + */ + def snippetForSearchClientSearchSingleIndex80(): Unit = { + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundLatLng = Some("40.71, -74.01") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_around_server_ip + */ + def snippetForSearchClientSearchSingleIndex81(): Unit = { + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundLatLngViaIP = Some(true) + ) + ), + requestOptions = Some( + RequestOptions + .builder() + .withHeader( + "x-forwarded-for", + "94.228.178.246 // should be replaced with the actual IP you would like to search around" + ) + .build() + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_around_radius + */ + def snippetForSearchClientSearchSingleIndex82(): Unit = { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundRadius = Some(AroundRadius(1000)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disable_automatic_radius + */ + def snippetForSearchClientSearchSingleIndex83(): Unit = { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundRadius = Some(AroundRadiusAll.withName("all")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_geo_search_precision + */ + def snippetForSearchClientSearchSingleIndex84(): Unit = { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundPrecision = Some(AroundPrecision(100)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_geo_search_precision_non_linear + */ + def snippetForSearchClientSearchSingleIndex85(): Unit = { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundPrecision = Some( + AroundPrecision( + Seq( + Range( + from = Some(0), + value = Some(25) + ), + Range( + from = Some(2000), + value = Some(1000) + ) + ) + ) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_minimum_geo_search_radius + */ + def snippetForSearchClientSearchSingleIndex86(): Unit = { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minimumAroundRadius = Some(1000) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_inside_rectangular_area + */ + def snippetForSearchClientSearchSingleIndex87(): Unit = { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insideBoundingBox = + Some(InsideBoundingBox(Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625)))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_inside_multiple_rectangular_areas + */ + def snippetForSearchClientSearchSingleIndex88(): Unit = { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insideBoundingBox = Some( + InsideBoundingBox( + Seq( + Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), + Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875) + ) + ) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_inside_polygon_area + */ + def snippetForSearchClientSearchSingleIndex89(): Unit = { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insidePolygon = Some( + Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * search_inside_multiple_polygon_areas + */ + def snippetForSearchClientSearchSingleIndex90(): Unit = { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insidePolygon = Some( + Seq( + Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), + Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, + 50.62626704081, 4.6181640625) + ) + ) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_querylanguages_override + */ + def snippetForSearchClientSearchSingleIndex91(): Unit = { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_querylanguages_override + */ + def snippetForSearchClientSearchSingleIndex92(): Unit = { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeStopWords = + Some(RemoveStopWords(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_querylanguages_override + */ + def snippetForSearchClientSearchSingleIndex93(): Unit = { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeStopWords = + Some(RemoveStopWords(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_querylanguages_with_japanese_query + */ + def snippetForSearchClientSearchSingleIndex94(): Unit = { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + queryLanguages = Some(Seq(SupportedLanguage.withName("ja"), SupportedLanguage.withName("en"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_natural_languages + */ + def snippetForSearchClientSearchSingleIndex95(): Unit = { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some(""), + naturalLanguages = Some(Seq(SupportedLanguage.withName("fr"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_natural_languages_with_query + */ + def snippetForSearchClientSearchSingleIndex96(): Unit = { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some(""), + naturalLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("firstWords")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_decompound_query_search_time + */ + def snippetForSearchClientSearchSingleIndex97(): Unit = { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + decompoundQuery = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_rules_search_time + */ + def snippetForSearchClientSearchSingleIndex98(): Unit = { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableRules = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_rule_contexts + */ + def snippetForSearchClientSearchSingleIndex99(): Unit = { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + ruleContexts = Some(Seq("front_end", "website2")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_personalization + */ + def snippetForSearchClientSearchSingleIndex100(): Unit = { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_personalization_with_user_token + */ + def snippetForSearchClientSearchSingleIndex101(): Unit = { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true), + userToken = Some("123456") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * personalization_impact + */ + def snippetForSearchClientSearchSingleIndex102(): Unit = { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + personalizationImpact = Some(20) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_user_token + */ + def snippetForSearchClientSearchSingleIndex103(): Unit = { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + userToken = Some("123456") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_user_token_with_personalization + */ + def snippetForSearchClientSearchSingleIndex104(): Unit = { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true), + userToken = Some("123456") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_query_type + */ + def snippetForSearchClientSearchSingleIndex105(): Unit = { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + queryType = Some(QueryType.withName("prefixAll")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_remove_words_if_no_results + */ + def snippetForSearchClientSearchSingleIndex106(): Unit = { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_advanced_syntax_search_time + */ + def snippetForSearchClientSearchSingleIndex107(): Unit = { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * overide_default_optional_words + */ + def snippetForSearchClientSearchSingleIndex108(): Unit = { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalWords = Some(OptionalWords(Seq("toyota", "2020 2021"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disabling_exact_for_some_attributes_search_time + */ + def snippetForSearchClientSearchSingleIndex109(): Unit = { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + disableExactOnAttributes = Some(Seq("description")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_exact_single_word_query + */ + def snippetForSearchClientSearchSingleIndex110(): Unit = { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("none")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_aternative_as_exact + */ + def snippetForSearchClientSearchSingleIndex111(): Unit = { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + alternativesAsExact = Some(Seq(AlternativesAsExact.withName("multiWordsSynonym"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_advanced_syntax_exact_phrase + */ + def snippetForSearchClientSearchSingleIndex112(): Unit = { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_advanced_syntax_exclude_words + */ + def snippetForSearchClientSearchSingleIndex113(): Unit = { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("excludeWords"))) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_distinct + */ + def snippetForSearchClientSearchSingleIndex114(): Unit = { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + distinct = Some(Distinct(0)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * get_ranking_info + */ + def snippetForSearchClientSearchSingleIndex115(): Unit = { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + getRankingInfo = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disable_click_analytics + */ + def snippetForSearchClientSearchSingleIndex116(): Unit = { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + clickAnalytics = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * enable_click_analytics + */ + def snippetForSearchClientSearchSingleIndex117(): Unit = { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + clickAnalytics = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disable_analytics + */ + def snippetForSearchClientSearchSingleIndex118(): Unit = { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + analytics = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * add_analytics_tags + */ + def snippetForSearchClientSearchSingleIndex119(): Unit = { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + analyticsTags = Some(Seq("front_end", "website2")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * disable_synonyms + */ + def snippetForSearchClientSearchSingleIndex120(): Unit = { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + synonyms = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_replace_synonyms_in_highlights + */ + def snippetForSearchClientSearchSingleIndex121(): Unit = { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + replaceSynonymsInHighlight = Some(true) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_min_proximity + */ + def snippetForSearchClientSearchSingleIndex122(): Unit = { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minProximity = Some(2) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_default_field + */ + def snippetForSearchClientSearchSingleIndex123(): Unit = { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + responseFields = Some(Seq("hits", "facets")) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * override_percentile_computation + */ + def snippetForSearchClientSearchSingleIndex124(): Unit = { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + percentileComputation = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_ab_test + */ + def snippetForSearchClientSearchSingleIndex125(): Unit = { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableABTest = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSingleIndex method. + * + * set_enable_re_ranking + */ + def snippetForSearchClientSearchSingleIndex126(): Unit = { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSingleIndex( + indexName = "", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableReRanking = Some(false) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSynonyms method. + * + * searchSynonyms with minimal parameters + */ + def snippetForSearchClientSearchSynonyms(): Unit = { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSynonyms( + indexName = "" + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchSynonyms method. + * + * searchSynonyms with all parameters + */ + def snippetForSearchClientSearchSynonyms1(): Unit = { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchSynonyms( + indexName = "", + searchSynonymsParams = Some( + SearchSynonymsParams( + query = Some("myQuery"), + `type` = Some(SynonymType.withName("altcorrection1")), + page = Some(10), + hitsPerPage = Some(10) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the searchUserIds method. + * + * searchUserIds + */ + def snippetForSearchClientSearchUserIds(): Unit = { + // >SEPARATOR searchUserIds default + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.searchUserIds( + searchUserIdsParams = SearchUserIdsParams( + query = "test", + clusterName = Some("theClusterName"), + page = Some(5), + hitsPerPage = Some(10) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setDictionarySettings method. + * + * get setDictionarySettings results with minimal parameters + */ + def snippetForSearchClientSetDictionarySettings(): Unit = { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setDictionarySettings method. + * + * get setDictionarySettings results with all parameters + */ + def snippetForSearchClientSetDictionarySettings1(): Unit = { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)), + stopwords = Some(Map("fr" -> false)), + compounds = Some(Map("ru" -> true)) + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * minimal parameters + */ + def snippetForSearchClientSetSettings(): Unit = { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + paginationLimitedTo = Some(10) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * boolean typoTolerance + */ + def snippetForSearchClientSetSettings1(): Unit = { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + typoTolerance = Some(TypoTolerance(true)) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * enum typoTolerance + */ + def snippetForSearchClientSetSettings2(): Unit = { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + typoTolerance = Some(TypoToleranceEnum.withName("min")) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * ignorePlurals + */ + def snippetForSearchClientSetSettings3(): Unit = { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ignorePlurals = Some(IgnorePlurals(true)) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * list of string ignorePlurals + */ + def snippetForSearchClientSetSettings4(): Unit = { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("fr")))) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * removeStopWords boolean + */ + def snippetForSearchClientSetSettings5(): Unit = { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + removeStopWords = Some(RemoveStopWords(true)) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * removeStopWords list of string + */ + def snippetForSearchClientSetSettings6(): Unit = { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + removeStopWords = Some(RemoveStopWords(Seq(SupportedLanguage.withName("fr")))) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * boolean distinct + */ + def snippetForSearchClientSetSettings7(): Unit = { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Some(Distinct(true)) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * integer distinct + */ + def snippetForSearchClientSetSettings8(): Unit = { + // >SEPARATOR setSettings integer distinct + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Some(Distinct(1)) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * distinct company + */ + def snippetForSearchClientSetSettings9(): Unit = { + // >SEPARATOR setSettings distinct company + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = Some("company"), + distinct = Some(Distinct(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * distinct design + */ + def snippetForSearchClientSetSettings10(): Unit = { + // >SEPARATOR setSettings distinct design + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = Some("design"), + distinct = Some(Distinct(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * distinct true + */ + def snippetForSearchClientSetSettings11(): Unit = { + // >SEPARATOR setSettings distinct true + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + distinct = Some(Distinct(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * distinct section + */ + def snippetForSearchClientSetSettings12(): Unit = { + // >SEPARATOR setSettings distinct section + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributeForDistinct = Some("section"), + distinct = Some(Distinct(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting allergens + */ + def snippetForSearchClientSetSettings13(): Unit = { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("allergens")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * api_attributes_for_faceting + */ + def snippetForSearchClientSetSettings14(): Unit = { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("genre", "author")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * api_attributes_for_faceting_searchable + */ + def snippetForSearchClientSetSettings15(): Unit = { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("genre", "searchable(author)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * api_attributes_for_filter_only + */ + def snippetForSearchClientSetSettings16(): Unit = { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(genre)", "author")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting categoryPageId + */ + def snippetForSearchClientSetSettings17(): Unit = { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("searchable(categoryPageId)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * unretrievableAttributes + */ + def snippetForSearchClientSetSettings18(): Unit = { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + unretrievableAttributes = Some(Seq("visible_by")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting user restricted data + */ + def snippetForSearchClientSetSettings19(): Unit = { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(visible_by)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting optional filters + */ + def snippetForSearchClientSetSettings20(): Unit = { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("can_deliver_quickly", "restaurant")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting redirect index + */ + def snippetForSearchClientSetSettings21(): Unit = { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("query_terms")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting multiple consequences + */ + def snippetForSearchClientSetSettings22(): Unit = { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("director")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting in-depth optional filters + */ + def snippetForSearchClientSetSettings23(): Unit = { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(brand)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * mode neuralSearch + */ + def snippetForSearchClientSetSettings24(): Unit = { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + mode = Some(Mode.withName("neuralSearch")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * mode keywordSearch + */ + def snippetForSearchClientSetSettings25(): Unit = { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + mode = Some(Mode.withName("keywordSearch")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributes same priority + */ + def snippetForSearchClientSetSettings26(): Unit = { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title,comments", "ingredients")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributes higher priority + */ + def snippetForSearchClientSetSettings27(): Unit = { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title", "ingredients")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking retweets + */ + def snippetForSearchClientSetSettings28(): Unit = { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(retweets)", "desc(likes)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking boosted + */ + def snippetForSearchClientSetSettings29(): Unit = { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(boosted)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking pageviews + */ + def snippetForSearchClientSetSettings30(): Unit = { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(pageviews)", "desc(comments)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking applying search parameters for a specific query + */ + def snippetForSearchClientSetSettings31(): Unit = { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(nb_airline_liaisons)")), + attributesForFaceting = Some(Seq("city, country")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking rounded pageviews + */ + def snippetForSearchClientSetSettings32(): Unit = { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(rounded_pageviews)", "desc(comments)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking price + */ + def snippetForSearchClientSetSettings33(): Unit = { + // >SEPARATOR setSettings customRanking price + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(price)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * ranking exhaustive + */ + def snippetForSearchClientSetSettings34(): Unit = { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = + Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * ranking standard replica + */ + def snippetForSearchClientSetSettings35(): Unit = { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = Some(Seq("desc(post_date_timestamp)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * ranking virtual replica + */ + def snippetForSearchClientSetSettings36(): Unit = { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(post_date_timestamp)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * customRanking and ranking sort alphabetically + */ + def snippetForSearchClientSetSettings37(): Unit = { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("asc(textual_attribute)")), + ranking = Some(Seq("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * relevancyStrictness + */ + def snippetForSearchClientSetSettings38(): Unit = { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + customRanking = Some(Seq("asc(textual_attribute)")), + relevancyStrictness = Some(0) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * create replica index + */ + def snippetForSearchClientSetSettings39(): Unit = { + // >SEPARATOR setSettings create replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = Some(Seq("products_price_desc")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * create replica index articles + */ + def snippetForSearchClientSetSettings40(): Unit = { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = Some(Seq("articles_date_desc")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * create virtual replica index + */ + def snippetForSearchClientSetSettings41(): Unit = { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = Some(Seq("virtual(products_price_desc)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * unlink replica index + */ + def snippetForSearchClientSetSettings42(): Unit = { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + replicas = Some(Seq("")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * forwardToReplicas + */ + def snippetForSearchClientSetSettings43(): Unit = { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "description")) + ), + forwardToReplicas = Some(true) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * maxValuesPerFacet + */ + def snippetForSearchClientSetSettings44(): Unit = { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + maxValuesPerFacet = Some(1000) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * maxFacetHits + */ + def snippetForSearchClientSetSettings45(): Unit = { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + maxFacetHits = Some(1000) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesForFaceting complex + */ + def snippetForSearchClientSetSettings46(): Unit = { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("actor", "filterOnly(category)", "searchable(publisher)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * ranking closest dates + */ + def snippetForSearchClientSetSettings47(): Unit = { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + ranking = Some( + Seq("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom") + ) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributes item variation + */ + def snippetForSearchClientSetSettings48(): Unit = { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("design", "type", "color")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributes around location + */ + def snippetForSearchClientSetSettings49(): Unit = { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), + customRanking = Some(Seq("desc(links_count)")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesToHighlight + */ + def snippetForSearchClientSetSettings50(): Unit = { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToHighlight = Some(Seq("author", "title", "content")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * attributesToHighlightStar + */ + def snippetForSearchClientSetSettings51(): Unit = { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesToHighlight = Some(Seq("*")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * everything + */ + def snippetForSearchClientSetSettings52(): Unit = { + // >SEPARATOR setSettings everything + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))), + allowCompressionOfIntegerArray = Some(true), + allowTyposOnNumericTokens = Some(true), + alternativesAsExact = Some(Seq(AlternativesAsExact.withName("singleWordSynonym"))), + attributeCriteriaComputedByMinProximity = Some(true), + attributeForDistinct = Some("test"), + attributesForFaceting = Some(Seq("algolia")), + attributesToHighlight = Some(Seq("algolia")), + attributesToRetrieve = Some(Seq("algolia")), + attributesToSnippet = Some(Seq("algolia")), + attributesToTransliterate = Some(Seq("algolia")), + camelCaseAttributes = Some(Seq("algolia")), + customNormalization = Some(Map("algolia" -> Map("aloglia" -> "aglolia"))), + customRanking = Some(Seq("algolia")), + decompoundQuery = Some(false), + decompoundedAttributes = Some(JObject(List(JField("algolia", JString("aloglia"))))), + disableExactOnAttributes = Some(Seq("algolia")), + disablePrefixOnAttributes = Some(Seq("algolia")), + disableTypoToleranceOnAttributes = Some(Seq("algolia")), + disableTypoToleranceOnWords = Some(Seq("algolia")), + distinct = Some(Distinct(3)), + enablePersonalization = Some(true), + enableReRanking = Some(false), + enableRules = Some(true), + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")), + highlightPreTag = Some(""), + highlightPostTag = Some(""), + hitsPerPage = Some(10), + ignorePlurals = Some(IgnorePlurals(false)), + indexLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + keepDiacriticsOnCharacters = Some("abc"), + maxFacetHits = Some(20), + maxValuesPerFacet = Some(30), + minProximity = Some(6), + minWordSizefor1Typo = Some(5), + minWordSizefor2Typos = Some(11), + mode = Some(Mode.withName("neuralSearch")), + numericAttributesForFiltering = Some(Seq("algolia")), + optionalWords = Some(OptionalWords(Seq("myspace"))), + paginationLimitedTo = Some(0), + queryLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + queryType = Some(QueryType.withName("prefixLast")), + ranking = Some(Seq("geo")), + reRankingApplyFilter = Some(ReRankingApplyFilter("mySearch:filters")), + relevancyStrictness = Some(10), + removeStopWords = Some(RemoveStopWords(false)), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")), + renderingContent = Some( + RenderingContent( + facetOrdering = Some( + FacetOrdering( + facets = Some( + Facets( + order = Some(Seq("a", "b")) + ) + ), + values = Some( + Map( + "a" -> Value( + order = Some(Seq("b")), + sortRemainingBy = Some(SortRemainingBy.withName("count")) + ) + ) + ) + ) + ) + ) + ), + replaceSynonymsInHighlight = Some(true), + replicas = Some(Seq("")), + responseFields = Some(Seq("algolia")), + restrictHighlightAndSnippetArrays = Some(true), + searchableAttributes = Some(Seq("foo")), + semanticSearch = Some( + SemanticSearch( + eventSources = Some(Seq("foo")) + ) + ), + separatorsToIndex = Some("bar"), + snippetEllipsisText = Some("---"), + sortFacetValuesBy = Some("date"), + typoTolerance = Some(TypoTolerance(false)), + unretrievableAttributes = Some(Seq("foo")), + userData = Some(JObject(List(JField("user", JString("data"))))) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesWithCustomRankingsAndAttributesForFaceting + */ + def snippetForSearchClientSetSettings53(): Unit = { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("brand", "name", "categories", "unordered(description)")), + customRanking = Some(Seq("desc(popularity)")), + attributesForFaceting = Some(Seq("searchable(brand)", "type", "categories", "price")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesOrdering + */ + def snippetForSearchClientSetSettings54(): Unit = { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("unordered(title)", "cast")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesProductReferenceSuffixes + */ + def snippetForSearchClientSetSettings55(): Unit = { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "product_reference", "product_reference_suffixes")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * queryLanguageAndIgnorePlurals + */ + def snippetForSearchClientSetSettings56(): Unit = { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + queryLanguages = Some(Seq(SupportedLanguage.withName("en"))), + ignorePlurals = Some(IgnorePlurals(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesInMovies + */ + def snippetForSearchClientSetSettings57(): Unit = { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title_eng", "title_fr", "title_es")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * disablePrefixOnAttributes + */ + def snippetForSearchClientSetSettings58(): Unit = { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + disablePrefixOnAttributes = Some(Seq("serial_number")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * disableTypoToleranceOnAttributes + */ + def snippetForSearchClientSetSettings59(): Unit = { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesSimpleExample + */ + def snippetForSearchClientSetSettings60(): Unit = { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("serial_number")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * searchableAttributesSimpleExampleAlt + */ + def snippetForSearchClientSetSettings61(): Unit = { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("serial_number", "serial_number_suffixes")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_searchable_attributes + */ + def snippetForSearchClientSetSettings62(): Unit = { + // >SEPARATOR setSettings set_searchable_attributes + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title,alternative_title", "author", "unordered(text)", "emails.personal")) + ) ) // >LOG @@ -5205,10 +9117,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * enum typoTolerance + * set_searchable_attributes */ - def snippetForSearchClientSetSettings2(): Unit = { - // >SEPARATOR setSettings enum typoTolerance + def snippetForSearchClientSetSettings63(): Unit = { + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5216,9 +9128,16 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - typoTolerance = Some(TypoToleranceEnum.withName("min")) - ), - forwardToReplicas = Some(true) + attributesForFaceting = Some( + Seq( + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ) + ) + ) ) // >LOG @@ -5229,10 +9148,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * ignorePlurals + * unretrievable_attributes */ - def snippetForSearchClientSetSettings3(): Unit = { - // >SEPARATOR setSettings ignorePlurals + def snippetForSearchClientSetSettings64(): Unit = { + // >SEPARATOR setSettings unretrievable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5240,9 +9159,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ignorePlurals = Some(IgnorePlurals(true)) - ), - forwardToReplicas = Some(true) + unretrievableAttributes = Some(Seq("total_number_of_sales")) + ) ) // >LOG @@ -5253,10 +9171,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * list of string ignorePlurals + * set_retrievable_attributes */ - def snippetForSearchClientSetSettings4(): Unit = { - // >SEPARATOR setSettings list of string ignorePlurals + def snippetForSearchClientSetSettings65(): Unit = { + // >SEPARATOR setSettings set_retrievable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5264,9 +9182,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("fr")))) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("author", "title", "content")) + ) ) // >LOG @@ -5277,10 +9194,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * removeStopWords boolean + * set_all_attributes_as_retrievable */ - def snippetForSearchClientSetSettings5(): Unit = { - // >SEPARATOR setSettings removeStopWords boolean + def snippetForSearchClientSetSettings66(): Unit = { + // >SEPARATOR setSettings set_all_attributes_as_retrievable // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5288,9 +9205,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - removeStopWords = Some(RemoveStopWords(true)) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("*")) + ) ) // >LOG @@ -5301,10 +9217,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * removeStopWords list of string + * specify_attributes_not_to_retrieve */ - def snippetForSearchClientSetSettings6(): Unit = { - // >SEPARATOR setSettings removeStopWords list of string + def snippetForSearchClientSetSettings67(): Unit = { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5312,9 +9228,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - removeStopWords = Some(RemoveStopWords(Seq(SupportedLanguage.withName("fr")))) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("*", "-SKU", "-internal_desc")) + ) ) // >LOG @@ -5325,10 +9240,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * boolean distinct + * neural_search */ - def snippetForSearchClientSetSettings7(): Unit = { - // >SEPARATOR setSettings boolean distinct + def snippetForSearchClientSetSettings68(): Unit = { + // >SEPARATOR setSettings neural_search // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5336,9 +9251,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - distinct = Some(Distinct(true)) - ), - forwardToReplicas = Some(true) + mode = Some(Mode.withName("neuralSearch")) + ) ) // >LOG @@ -5349,10 +9263,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * integer distinct + * keyword_search */ - def snippetForSearchClientSetSettings8(): Unit = { - // >SEPARATOR setSettings integer distinct + def snippetForSearchClientSetSettings69(): Unit = { + // >SEPARATOR setSettings keyword_search // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5360,9 +9274,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - distinct = Some(Distinct(1)) - ), - forwardToReplicas = Some(true) + mode = Some(Mode.withName("keywordSearch")) + ) ) // >LOG @@ -5373,10 +9286,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * distinct company + * set_default_ranking */ - def snippetForSearchClientSetSettings9(): Unit = { - // >SEPARATOR setSettings distinct company + def snippetForSearchClientSetSettings70(): Unit = { + // >SEPARATOR setSettings set_default_ranking // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5384,8 +9297,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributeForDistinct = Some("company"), - distinct = Some(Distinct(true)) + ranking = Some(Seq("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom")) ) ) @@ -5397,10 +9309,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * distinct design + * set_ranking_by_attribute_asc */ - def snippetForSearchClientSetSettings10(): Unit = { - // >SEPARATOR setSettings distinct design + def snippetForSearchClientSetSettings71(): Unit = { + // >SEPARATOR setSettings set_ranking_by_attribute_asc // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5408,8 +9320,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributeForDistinct = Some("design"), - distinct = Some(Distinct(true)) + ranking = + Some(Seq("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) ) ) @@ -5421,10 +9333,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * distinct true + * set_ranking_by_attribute_desc */ - def snippetForSearchClientSetSettings11(): Unit = { - // >SEPARATOR setSettings distinct true + def snippetForSearchClientSetSettings72(): Unit = { + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5432,7 +9344,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - distinct = Some(Distinct(true)) + ranking = + Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) ) ) @@ -5444,10 +9357,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * distinct section + * restrict_searchable_attributes */ - def snippetForSearchClientSetSettings12(): Unit = { - // >SEPARATOR setSettings distinct section + def snippetForSearchClientSetSettings73(): Unit = { + // >SEPARATOR setSettings restrict_searchable_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5455,8 +9368,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributeForDistinct = Some("section"), - distinct = Some(Distinct(true)) + customRanking = Some(Seq("desc(popularity)", "asc(price)")) ) ) @@ -5468,10 +9380,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting allergens + * set_default_relevancy */ - def snippetForSearchClientSetSettings13(): Unit = { - // >SEPARATOR setSettings attributesForFaceting allergens + def snippetForSearchClientSetSettings74(): Unit = { + // >SEPARATOR setSettings set_default_relevancy // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5479,7 +9391,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("allergens")) + relevancyStrictness = Some(90) ) ) @@ -5491,10 +9403,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting categoryPageId + * set_replicas */ - def snippetForSearchClientSetSettings14(): Unit = { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + def snippetForSearchClientSetSettings75(): Unit = { + // >SEPARATOR setSettings set_replicas // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5502,7 +9414,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("searchable(categoryPageId)")) + replicas = Some(Seq("name_of_replica_index1", "name_of_replica_index2")) ) ) @@ -5514,10 +9426,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * unretrievableAttributes + * set_default_max_values_per_facet */ - def snippetForSearchClientSetSettings15(): Unit = { - // >SEPARATOR setSettings unretrievableAttributes + def snippetForSearchClientSetSettings76(): Unit = { + // >SEPARATOR setSettings set_default_max_values_per_facet // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5525,7 +9437,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - unretrievableAttributes = Some(Seq("visible_by")) + maxValuesPerFacet = Some(100) ) ) @@ -5537,10 +9449,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting user restricted data + * set_default_sort_facet_values_by */ - def snippetForSearchClientSetSettings16(): Unit = { - // >SEPARATOR setSettings attributesForFaceting user restricted data + def snippetForSearchClientSetSettings77(): Unit = { + // >SEPARATOR setSettings set_default_sort_facet_values_by // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5548,7 +9460,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("filterOnly(visible_by)")) + sortFacetValuesBy = Some("alpha") ) ) @@ -5560,10 +9472,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting optional filters + * set_attributes_to_snippet */ - def snippetForSearchClientSetSettings17(): Unit = { - // >SEPARATOR setSettings attributesForFaceting optional filters + def snippetForSearchClientSetSettings78(): Unit = { + // >SEPARATOR setSettings set_attributes_to_snippet // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5571,7 +9483,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("can_deliver_quickly", "restaurant")) + attributesToSnippet = Some(Seq("content:80", "description")) ) ) @@ -5583,10 +9495,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting redirect index + * set_all_attributes_to_snippet */ - def snippetForSearchClientSetSettings18(): Unit = { - // >SEPARATOR setSettings attributesForFaceting redirect index + def snippetForSearchClientSetSettings79(): Unit = { + // >SEPARATOR setSettings set_all_attributes_to_snippet // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5594,7 +9506,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("query_terms")) + attributesToSnippet = Some(Seq("*:80")) ) ) @@ -5606,10 +9518,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting multiple consequences + * set_default_highlight_pre_tag */ - def snippetForSearchClientSetSettings19(): Unit = { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + def snippetForSearchClientSetSettings80(): Unit = { + // >SEPARATOR setSettings set_default_highlight_pre_tag // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5617,7 +9529,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("director")) + highlightPreTag = Some("") ) ) @@ -5629,10 +9541,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting in-depth optional filters + * set_default_highlight_post_tag */ - def snippetForSearchClientSetSettings20(): Unit = { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + def snippetForSearchClientSetSettings81(): Unit = { + // >SEPARATOR setSettings set_default_highlight_post_tag // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5640,7 +9552,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("filterOnly(brand)")) + highlightPostTag = Some("") ) ) @@ -5652,10 +9564,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * mode neuralSearch + * set_default_snippet_ellipsis_text */ - def snippetForSearchClientSetSettings21(): Unit = { - // >SEPARATOR setSettings mode neuralSearch + def snippetForSearchClientSetSettings82(): Unit = { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5663,7 +9575,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - mode = Some(Mode.withName("neuralSearch")) + snippetEllipsisText = Some("…") ) ) @@ -5675,10 +9587,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * mode keywordSearch + * enable_restrict_highlight_and_snippet_arrays_by_default */ - def snippetForSearchClientSetSettings22(): Unit = { - // >SEPARATOR setSettings mode keywordSearch + def snippetForSearchClientSetSettings83(): Unit = { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5686,7 +9598,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - mode = Some(Mode.withName("keywordSearch")) + restrictHighlightAndSnippetArrays = Some(true) ) ) @@ -5698,10 +9610,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributes same priority + * set_default_hits_per_page */ - def snippetForSearchClientSetSettings23(): Unit = { - // >SEPARATOR setSettings searchableAttributes same priority + def snippetForSearchClientSetSettings84(): Unit = { + // >SEPARATOR setSettings set_default_hits_per_page // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5709,7 +9621,168 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title,comments", "ingredients")) + hitsPerPage = Some(20) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_pagination_limit + */ + def snippetForSearchClientSetSettings85(): Unit = { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + paginationLimitedTo = Some(1000) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_default_min_word_size_for_one_typo + */ + def snippetForSearchClientSetSettings86(): Unit = { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + minWordSizefor1Typo = Some(4) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_default_min_word_size_for_two_typos + */ + def snippetForSearchClientSetSettings87(): Unit = { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + minWordSizefor2Typos = Some(4) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_default_typo_tolerance_mode + */ + def snippetForSearchClientSetSettings88(): Unit = { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + typoTolerance = Some(TypoTolerance(true)) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * disable_typos_on_numeric_tokens_by_default + */ + def snippetForSearchClientSetSettings89(): Unit = { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + allowTyposOnNumericTokens = Some(false) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * disable_typo_tolerance_for_words + */ + def snippetForSearchClientSetSettings90(): Unit = { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + disableTypoToleranceOnWords = Some(Seq("wheel", "1X2BCD")) + ) + ) + + // >LOG + // Use the response + val value = Await.result(response, Duration(100, "sec")) + // SEPARATOR< + } + + /** Snippet for the setSettings method. + * + * set_separators_to_index + */ + def snippetForSearchClientSetSettings91(): Unit = { + // >SEPARATOR setSettings set_separators_to_index + // Initialize the client + val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") + + // Call the API + val response = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + separatorsToIndex = Some("+#") ) ) @@ -5721,10 +9794,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributes higher priority + * set_languages_using_querylanguages */ - def snippetForSearchClientSetSettings24(): Unit = { - // >SEPARATOR setSettings searchableAttributes higher priority + def snippetForSearchClientSetSettings92(): Unit = { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5732,7 +9805,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title", "ingredients")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + ignorePlurals = Some(IgnorePlurals(true)) ) ) @@ -5744,10 +9818,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking retweets + * set_attributes_to_transliterate */ - def snippetForSearchClientSetSettings25(): Unit = { - // >SEPARATOR setSettings customRanking retweets + def snippetForSearchClientSetSettings93(): Unit = { + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5755,7 +9829,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(retweets)", "desc(likes)")) + indexLanguages = Some(Seq(SupportedLanguage.withName("ja"))), + attributesToTransliterate = Some(Seq("name", "description")) ) ) @@ -5767,10 +9842,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking boosted + * set_languages_using_querylanguages */ - def snippetForSearchClientSetSettings26(): Unit = { - // >SEPARATOR setSettings customRanking boosted + def snippetForSearchClientSetSettings94(): Unit = { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5778,7 +9853,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(boosted)")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + removeStopWords = Some(RemoveStopWords(true)) ) ) @@ -5790,10 +9866,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking pageviews + * set_camel_case_attributes */ - def snippetForSearchClientSetSettings27(): Unit = { - // >SEPARATOR setSettings customRanking pageviews + def snippetForSearchClientSetSettings95(): Unit = { + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5801,7 +9877,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(pageviews)", "desc(comments)")) + camelCaseAttributes = Some(Seq("description")) ) ) @@ -5813,10 +9889,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking applying search parameters for a specific query + * set_decompounded_attributes */ - def snippetForSearchClientSetSettings28(): Unit = { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + def snippetForSearchClientSetSettings96(): Unit = { + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5824,8 +9900,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(nb_airline_liaisons)")), - attributesForFaceting = Some(Seq("city, country")) + decompoundedAttributes = Some(JObject(List(JField("de", JArray(List(JString("name"))))))) ) ) @@ -5837,10 +9912,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking rounded pageviews + * set_decompounded_multiple_attributes */ - def snippetForSearchClientSetSettings29(): Unit = { - // >SEPARATOR setSettings customRanking rounded pageviews + def snippetForSearchClientSetSettings97(): Unit = { + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5848,7 +9923,14 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(rounded_pageviews)", "desc(comments)")) + decompoundedAttributes = Some( + JObject( + List( + JField("de", JArray(List(JString("name_de"), JString("description_de")))), + JField("fi", JArray(List(JString("name_fi"), JString("description_fi")))) + ) + ) + ) ) ) @@ -5860,10 +9942,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking price + * set_keep_diacritics_on_characters */ - def snippetForSearchClientSetSettings30(): Unit = { - // >SEPARATOR setSettings customRanking price + def snippetForSearchClientSetSettings98(): Unit = { + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5871,7 +9953,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(price)")) + keepDiacriticsOnCharacters = Some("øé") ) ) @@ -5883,10 +9965,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * ranking exhaustive + * set_custom_normalization */ - def snippetForSearchClientSetSettings31(): Unit = { - // >SEPARATOR setSettings ranking exhaustive + def snippetForSearchClientSetSettings99(): Unit = { + // >SEPARATOR setSettings set_custom_normalization // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5894,8 +9976,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = - Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + customNormalization = Some(Map("default" -> Map("ä" -> "ae"))) ) ) @@ -5907,10 +9988,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * ranking standard replica + * set_languages_using_querylanguages */ - def snippetForSearchClientSetSettings32(): Unit = { - // >SEPARATOR setSettings ranking standard replica + def snippetForSearchClientSetSettings100(): Unit = { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5918,7 +9999,9 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = Some(Seq("desc(post_date_timestamp)")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + removeStopWords = Some(RemoveStopWords(true)), + ignorePlurals = Some(IgnorePlurals(true)) ) ) @@ -5930,10 +10013,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * ranking virtual replica + * set_indexlanguages */ - def snippetForSearchClientSetSettings33(): Unit = { - // >SEPARATOR setSettings ranking virtual replica + def snippetForSearchClientSetSettings101(): Unit = { + // >SEPARATOR setSettings set_indexlanguages // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5941,7 +10024,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(post_date_timestamp)")) + indexLanguages = Some(Seq(SupportedLanguage.withName("ja"))) ) ) @@ -5953,10 +10036,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * customRanking and ranking sort alphabetically + * enable_decompound_query_by_default */ - def snippetForSearchClientSetSettings34(): Unit = { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + def snippetForSearchClientSetSettings102(): Unit = { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5964,8 +10047,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("asc(textual_attribute)")), - ranking = Some(Seq("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + decompoundQuery = Some(true) ) ) @@ -5977,10 +10059,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * relevancyStrictness + * enable_rules_syntax_by_default */ - def snippetForSearchClientSetSettings35(): Unit = { - // >SEPARATOR setSettings relevancyStrictness + def snippetForSearchClientSetSettings103(): Unit = { + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -5988,8 +10070,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - customRanking = Some(Seq("asc(textual_attribute)")), - relevancyStrictness = Some(0) + enableRules = Some(true) ) ) @@ -6001,10 +10082,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * create replica index + * enable_personalization_settings */ - def snippetForSearchClientSetSettings36(): Unit = { - // >SEPARATOR setSettings create replica index + def snippetForSearchClientSetSettings104(): Unit = { + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6012,7 +10093,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = Some(Seq("products_price_desc")) + enablePersonalization = Some(true) ) ) @@ -6024,10 +10105,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * create virtual replica index + * set_default_query_type */ - def snippetForSearchClientSetSettings37(): Unit = { - // >SEPARATOR setSettings create virtual replica index + def snippetForSearchClientSetSettings105(): Unit = { + // >SEPARATOR setSettings set_default_query_type // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6035,7 +10116,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = Some(Seq("virtual(products_price_desc)")) + queryType = Some(QueryType.withName("prefixLast")) ) ) @@ -6047,10 +10128,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * unlink replica index + * set_default_remove_words_if_no_result */ - def snippetForSearchClientSetSettings38(): Unit = { - // >SEPARATOR setSettings unlink replica index + def snippetForSearchClientSetSettings106(): Unit = { + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6058,7 +10139,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - replicas = Some(Seq("")) + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("none")) ) ) @@ -6070,10 +10151,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * forwardToReplicas + * enable_advanced_syntax_by_default */ - def snippetForSearchClientSetSettings39(): Unit = { - // >SEPARATOR setSettings forwardToReplicas + def snippetForSearchClientSetSettings107(): Unit = { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6081,9 +10162,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "description")) - ), - forwardToReplicas = Some(true) + advancedSyntax = Some(true) + ) ) // >LOG @@ -6094,10 +10174,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * maxValuesPerFacet + * set_default_optional_words */ - def snippetForSearchClientSetSettings40(): Unit = { - // >SEPARATOR setSettings maxValuesPerFacet + def snippetForSearchClientSetSettings108(): Unit = { + // >SEPARATOR setSettings set_default_optional_words // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6105,7 +10185,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - maxValuesPerFacet = Some(1000) + optionalWords = Some(OptionalWords(Seq("blue", "iphone case"))) ) ) @@ -6117,10 +10197,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * maxFacetHits + * disabling_prefix_search_for_some_attributes_by_default */ - def snippetForSearchClientSetSettings41(): Unit = { - // >SEPARATOR setSettings maxFacetHits + def snippetForSearchClientSetSettings109(): Unit = { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6128,7 +10208,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - maxFacetHits = Some(1000) + disablePrefixOnAttributes = Some(Seq("sku")) ) ) @@ -6140,10 +10220,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * attributesForFaceting complex + * disabling_exact_for_some_attributes_by_default */ - def snippetForSearchClientSetSettings42(): Unit = { - // >SEPARATOR setSettings attributesForFaceting complex + def snippetForSearchClientSetSettings110(): Unit = { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6151,7 +10231,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("actor", "filterOnly(category)", "searchable(publisher)")) + disableExactOnAttributes = Some(Seq("description")) ) ) @@ -6163,10 +10243,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * ranking closest dates + * set_default_exact_single_word_query */ - def snippetForSearchClientSetSettings43(): Unit = { - // >SEPARATOR setSettings ranking closest dates + def snippetForSearchClientSetSettings111(): Unit = { + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6174,9 +10254,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - ranking = Some( - Seq("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom") - ) + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")) ) ) @@ -6188,10 +10266,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributes item variation + * set_default_aternative_as_exact */ - def snippetForSearchClientSetSettings44(): Unit = { - // >SEPARATOR setSettings searchableAttributes item variation + def snippetForSearchClientSetSettings112(): Unit = { + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6199,7 +10277,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("design", "type", "color")) + alternativesAsExact = + Some(Seq(AlternativesAsExact.withName("ignorePlurals"), AlternativesAsExact.withName("singleWordSynonym"))) ) ) @@ -6211,10 +10290,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributes around location + * enable_advanced_syntax_by_default */ - def snippetForSearchClientSetSettings45(): Unit = { - // >SEPARATOR setSettings searchableAttributes around location + def snippetForSearchClientSetSettings113(): Unit = { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6222,8 +10301,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), - customRanking = Some(Seq("desc(links_count)")) + advancedSyntax = Some(true) ) ) @@ -6235,10 +10313,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributes around location + * set_numeric_attributes_for_filtering */ - def snippetForSearchClientSetSettings46(): Unit = { - // >SEPARATOR setSettings searchableAttributes around location + def snippetForSearchClientSetSettings114(): Unit = { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6246,8 +10324,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), - customRanking = Some(Seq("desc(links_count)")) + numericAttributesForFiltering = Some(Seq("quantity", "popularity")) ) ) @@ -6259,10 +10336,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * disableTypoToleranceOnAttributes + * enable_compression_of_integer_array */ - def snippetForSearchClientSetSettings47(): Unit = { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + def snippetForSearchClientSetSettings115(): Unit = { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6270,7 +10347,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + allowCompressionOfIntegerArray = Some(true) ) ) @@ -6282,10 +10359,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * everything + * set_attributes_for_distinct */ - def snippetForSearchClientSetSettings48(): Unit = { - // >SEPARATOR setSettings everything + def snippetForSearchClientSetSettings116(): Unit = { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6293,91 +10370,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - advancedSyntax = Some(true), - advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))), - allowCompressionOfIntegerArray = Some(true), - allowTyposOnNumericTokens = Some(true), - alternativesAsExact = Some(Seq(AlternativesAsExact.withName("singleWordSynonym"))), - attributeCriteriaComputedByMinProximity = Some(true), - attributeForDistinct = Some("test"), - attributesForFaceting = Some(Seq("algolia")), - attributesToHighlight = Some(Seq("algolia")), - attributesToRetrieve = Some(Seq("algolia")), - attributesToSnippet = Some(Seq("algolia")), - attributesToTransliterate = Some(Seq("algolia")), - camelCaseAttributes = Some(Seq("algolia")), - customNormalization = Some(Map("algolia" -> Map("aloglia" -> "aglolia"))), - customRanking = Some(Seq("algolia")), - decompoundQuery = Some(false), - decompoundedAttributes = Some(JObject(List(JField("algolia", JString("aloglia"))))), - disableExactOnAttributes = Some(Seq("algolia")), - disablePrefixOnAttributes = Some(Seq("algolia")), - disableTypoToleranceOnAttributes = Some(Seq("algolia")), - disableTypoToleranceOnWords = Some(Seq("algolia")), - distinct = Some(Distinct(3)), - enablePersonalization = Some(true), - enableReRanking = Some(false), - enableRules = Some(true), - exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")), - highlightPreTag = Some(""), - highlightPostTag = Some(""), - hitsPerPage = Some(10), - ignorePlurals = Some(IgnorePlurals(false)), - indexLanguages = Some(Seq(SupportedLanguage.withName("fr"))), - keepDiacriticsOnCharacters = Some("abc"), - maxFacetHits = Some(20), - maxValuesPerFacet = Some(30), - minProximity = Some(6), - minWordSizefor1Typo = Some(5), - minWordSizefor2Typos = Some(11), - mode = Some(Mode.withName("neuralSearch")), - numericAttributesForFiltering = Some(Seq("algolia")), - optionalWords = Some(OptionalWords(Seq("myspace"))), - paginationLimitedTo = Some(0), - queryLanguages = Some(Seq(SupportedLanguage.withName("fr"))), - queryType = Some(QueryType.withName("prefixLast")), - ranking = Some(Seq("geo")), - reRankingApplyFilter = Some(ReRankingApplyFilter("mySearch:filters")), - relevancyStrictness = Some(10), - removeStopWords = Some(RemoveStopWords(false)), - removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")), - renderingContent = Some( - RenderingContent( - facetOrdering = Some( - FacetOrdering( - facets = Some( - Facets( - order = Some(Seq("a", "b")) - ) - ), - values = Some( - Map( - "a" -> Value( - order = Some(Seq("b")), - sortRemainingBy = Some(SortRemainingBy.withName("count")) - ) - ) - ) - ) - ) - ) - ), - replaceSynonymsInHighlight = Some(true), - replicas = Some(Seq("")), - responseFields = Some(Seq("algolia")), - restrictHighlightAndSnippetArrays = Some(true), - searchableAttributes = Some(Seq("foo")), - semanticSearch = Some( - SemanticSearch( - eventSources = Some(Seq("foo")) - ) - ), - separatorsToIndex = Some("bar"), - snippetEllipsisText = Some("---"), - sortFacetValuesBy = Some("date"), - typoTolerance = Some(TypoTolerance(false)), - unretrievableAttributes = Some(Seq("foo")), - userData = Some(JObject(List(JField("user", JString("data"))))) + attributeForDistinct = Some("url") ) ) @@ -6389,10 +10382,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributesWithCustomRankingsAndAttributesForFaceting + * set_distinct */ - def snippetForSearchClientSetSettings49(): Unit = { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + def snippetForSearchClientSetSettings117(): Unit = { + // >SEPARATOR setSettings set_distinct // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6400,9 +10393,8 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("brand", "name", "categories", "unordered(description)")), - customRanking = Some(Seq("desc(popularity)")), - attributesForFaceting = Some(Seq("searchable(brand)", "type", "categories", "price")) + distinct = Some(Distinct(1)), + attributeForDistinct = Some("url") ) ) @@ -6414,10 +10406,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributesProductReferenceSuffixes + * set_replace_synonyms_in_highlights */ - def snippetForSearchClientSetSettings50(): Unit = { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + def snippetForSearchClientSetSettings118(): Unit = { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6425,7 +10417,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "product_reference", "product_reference_suffixes")) + replaceSynonymsInHighlight = Some(false) ) ) @@ -6437,10 +10429,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * queryLanguageAndIgnorePlurals + * set_min_proximity */ - def snippetForSearchClientSetSettings51(): Unit = { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + def snippetForSearchClientSetSettings119(): Unit = { + // >SEPARATOR setSettings set_min_proximity // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6448,8 +10440,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - queryLanguages = Some(Seq(SupportedLanguage.withName("en"))), - ignorePlurals = Some(IgnorePlurals(true)) + minProximity = Some(1) ) ) @@ -6461,10 +10452,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributesInMovies + * set_default_field */ - def snippetForSearchClientSetSettings52(): Unit = { - // >SEPARATOR setSettings searchableAttributesInMovies + def snippetForSearchClientSetSettings120(): Unit = { + // >SEPARATOR setSettings set_default_field // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6472,7 +10463,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title_eng", "title_fr", "title_es")) + responseFields = Some(Seq("hits", "hitsPerPage", "nbPages", "page")) ) ) @@ -6484,10 +10475,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * disablePrefixOnAttributes + * set_max_facet_hits */ - def snippetForSearchClientSetSettings53(): Unit = { - // >SEPARATOR setSettings disablePrefixOnAttributes + def snippetForSearchClientSetSettings121(): Unit = { + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6495,7 +10486,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disablePrefixOnAttributes = Some(Seq("serial_number")) + maxFacetHits = Some(10) ) ) @@ -6507,10 +10498,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * disableTypoToleranceOnAttributes + * set_attribute_criteria_computed_by_min_proximity */ - def snippetForSearchClientSetSettings54(): Unit = { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + def snippetForSearchClientSetSettings122(): Unit = { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6518,7 +10509,7 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + attributeCriteriaComputedByMinProximity = Some(true) ) ) @@ -6530,10 +10521,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributesSimpleExample + * set_user_data */ - def snippetForSearchClientSetSettings55(): Unit = { - // >SEPARATOR setSettings searchableAttributesSimpleExample + def snippetForSearchClientSetSettings123(): Unit = { + // >SEPARATOR setSettings set_user_data // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6541,7 +10532,9 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("serial_number")) + userData = Some( + JObject(List(JField("extraData", JString("This is the custom data that you want to store in your index")))) + ) ) ) @@ -6553,10 +10546,10 @@ class SnippetSearchClient { /** Snippet for the setSettings method. * - * searchableAttributesSimpleExampleAlt + * set_rendering_content */ - def snippetForSearchClientSetSettings56(): Unit = { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + def snippetForSearchClientSetSettings124(): Unit = { + // >SEPARATOR setSettings set_rendering_content // Initialize the client val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY") @@ -6564,7 +10557,32 @@ class SnippetSearchClient { val response = client.setSettings( indexName = "", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("serial_number", "serial_number_suffixes")) + renderingContent = Some( + RenderingContent( + facetOrdering = Some( + FacetOrdering( + facets = Some( + Facets( + order = Some(Seq("size", "brand")) + ) + ), + values = Some( + Map( + "brand" -> Value( + order = Some(Seq("uniqlo")), + hide = Some(Seq("muji")), + sortRemainingBy = Some(SortRemainingBy.withName("count")) + ), + "size" -> Value( + order = Some(Seq("S", "M", "L")), + sortRemainingBy = Some(SortRemainingBy.withName("hidden")) + ) + ) + ) + ) + ) + ) + ) ) ) diff --git a/docs/snippets/swift/Sources/Search.swift b/docs/snippets/swift/Sources/Search.swift index a7bd713d57..533259029c 100644 --- a/docs/snippets/swift/Sources/Search.swift +++ b/docs/snippets/swift/Sources/Search.swift @@ -3403,8 +3403,101 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// - /// facetFiltersNeg + /// facetFiltersBook func snippetForSearchSingleIndex14() async throws { + // >SEPARATOR searchSingleIndex facetFiltersBook + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([SearchFacetFilters.string("category:Book")]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// facetFiltersAND + func snippetForSearchSingleIndex15() async throws { + // >SEPARATOR searchSingleIndex facetFiltersAND + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("author:John Doe"), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// facetFiltersOR + func snippetForSearchSingleIndex16() async throws { + // >SEPARATOR searchSingleIndex facetFiltersOR + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters + .arrayOfSearchFacetFilters([SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("author:John Doe"), + ])]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// facetFiltersCombined + func snippetForSearchSingleIndex17() async throws { + // >SEPARATOR searchSingleIndex facetFiltersCombined + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("author:John Doe"), + SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("category:Movie"), + ]), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// facetFiltersNeg + func snippetForSearchSingleIndex18() async throws { // >SEPARATOR searchSingleIndex facetFiltersNeg // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3425,7 +3518,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// filtersAndFacetFilters - func snippetForSearchSingleIndex15() async throws { + func snippetForSearchSingleIndex19() async throws { // >SEPARATOR searchSingleIndex filtersAndFacetFilters // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3446,7 +3539,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// facet author genre - func snippetForSearchSingleIndex16() async throws { + func snippetForSearchSingleIndex20() async throws { // >SEPARATOR searchSingleIndex facet author genre // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3466,7 +3559,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// facet wildcard - func snippetForSearchSingleIndex17() async throws { + func snippetForSearchSingleIndex21() async throws { // >SEPARATOR searchSingleIndex facet wildcard // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3483,7 +3576,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// maxValuesPerFacet - func snippetForSearchSingleIndex18() async throws { + func snippetForSearchSingleIndex22() async throws { // >SEPARATOR searchSingleIndex maxValuesPerFacet // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3500,7 +3593,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// aroundLatLng - func snippetForSearchSingleIndex19() async throws { + func snippetForSearchSingleIndex23() async throws { // >SEPARATOR searchSingleIndex aroundLatLng // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3518,7 +3611,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// aroundLatLngViaIP - func snippetForSearchSingleIndex20() async throws { + func snippetForSearchSingleIndex24() async throws { // >SEPARATOR searchSingleIndex aroundLatLngViaIP // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3535,7 +3628,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// aroundRadius - func snippetForSearchSingleIndex21() async throws { + func snippetForSearchSingleIndex25() async throws { // >SEPARATOR searchSingleIndex aroundRadius // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3555,7 +3648,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// insideBoundingBox - func snippetForSearchSingleIndex22() async throws { + func snippetForSearchSingleIndex26() async throws { // >SEPARATOR searchSingleIndex insideBoundingBox // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3581,7 +3674,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// insidePolygon - func snippetForSearchSingleIndex23() async throws { + func snippetForSearchSingleIndex27() async throws { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3611,7 +3704,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// insidePolygon - func snippetForSearchSingleIndex24() async throws { + func snippetForSearchSingleIndex28() async throws { // >SEPARATOR searchSingleIndex insidePolygon // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3641,7 +3734,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// optionalFilters - func snippetForSearchSingleIndex25() async throws { + func snippetForSearchSingleIndex29() async throws { // >SEPARATOR searchSingleIndex optionalFilters // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3662,7 +3755,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// optionalFiltersMany - func snippetForSearchSingleIndex26() async throws { + func snippetForSearchSingleIndex30() async throws { // >SEPARATOR searchSingleIndex optionalFiltersMany // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3687,7 +3780,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// optionalFiltersSimple - func snippetForSearchSingleIndex27() async throws { + func snippetForSearchSingleIndex31() async throws { // >SEPARATOR searchSingleIndex optionalFiltersSimple // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3711,7 +3804,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// restrictSearchableAttributes - func snippetForSearchSingleIndex28() async throws { + func snippetForSearchSingleIndex32() async throws { // >SEPARATOR searchSingleIndex restrictSearchableAttributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3729,7 +3822,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// getRankingInfo - func snippetForSearchSingleIndex29() async throws { + func snippetForSearchSingleIndex33() async throws { // >SEPARATOR searchSingleIndex getRankingInfo // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3746,7 +3839,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// clickAnalytics - func snippetForSearchSingleIndex30() async throws { + func snippetForSearchSingleIndex34() async throws { // >SEPARATOR searchSingleIndex clickAnalytics // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3763,7 +3856,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// clickAnalyticsUserToken - func snippetForSearchSingleIndex31() async throws { + func snippetForSearchSingleIndex35() async throws { // >SEPARATOR searchSingleIndex clickAnalyticsUserToken // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3783,7 +3876,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// enablePersonalization - func snippetForSearchSingleIndex32() async throws { + func snippetForSearchSingleIndex36() async throws { // >SEPARATOR searchSingleIndex enablePersonalization // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3803,7 +3896,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// userToken - func snippetForSearchSingleIndex33() async throws { + func snippetForSearchSingleIndex37() async throws { // >SEPARATOR searchSingleIndex userToken // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3817,10 +3910,30 @@ final class SearchClientSnippet { // SEPARATOR< } + /// Snippet for the searchSingleIndex method. + /// + /// userToken1234 + func snippetForSearchSingleIndex38() async throws { + // >SEPARATOR searchSingleIndex userToken1234 + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "user-1234" + )) + ) + // >LOG + // SEPARATOR< + } + /// Snippet for the searchSingleIndex method. /// /// analyticsTag - func snippetForSearchSingleIndex34() async throws { + func snippetForSearchSingleIndex39() async throws { // >SEPARATOR searchSingleIndex analyticsTag // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3838,7 +3951,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// facetFiltersUsers - func snippetForSearchSingleIndex35() async throws { + func snippetForSearchSingleIndex40() async throws { // >SEPARATOR searchSingleIndex facetFiltersUsers // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3862,7 +3975,7 @@ final class SearchClientSnippet { /// Snippet for the searchSingleIndex method. /// /// buildTheQuery - func snippetForSearchSingleIndex36() async throws { + func snippetForSearchSingleIndex41() async throws { // >SEPARATOR searchSingleIndex buildTheQuery // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") @@ -3880,187 +3993,3075 @@ final class SearchClientSnippet { // SEPARATOR< } - /// Snippet for the searchSynonyms method. + /// Snippet for the searchSingleIndex method. /// - /// searchSynonyms with minimal parameters - func snippetForSearchSynonyms() async throws { - // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + /// attributesToHighlightOverride + func snippetForSearchSingleIndex42() async throws { + // >SEPARATOR searchSingleIndex attributesToHighlightOverride // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.searchSynonyms(indexName: "") + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToHighlight: ["title", "content"] + )) + ) // >LOG // SEPARATOR< } - /// Snippet for the searchSynonyms method. + /// Snippet for the searchSingleIndex method. /// - /// searchSynonyms with all parameters - func snippetForSearchSynonyms1() async throws { - // >SEPARATOR searchSynonyms searchSynonyms with all parameters + /// disableTypoToleranceOnAttributes + func snippetForSearchSingleIndex43() async throws { + // >SEPARATOR searchSingleIndex disableTypoToleranceOnAttributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.searchSynonyms( + let response: SearchResponse = try await client.searchSingleIndex( indexName: "", - searchSynonymsParams: SearchSynonymsParams( - query: "myQuery", - type: SynonymType.altcorrection1, - page: 10, - hitsPerPage: 10 - ) + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + disableTypoToleranceOnAttributes: ["serial_number"] + )) ) // >LOG // SEPARATOR< } - /// Snippet for the searchUserIds method. + /// Snippet for the searchSingleIndex method. /// - /// searchUserIds - func snippetForSearchUserIds() async throws { - // >SEPARATOR searchUserIds default + /// search_a_query + func snippetForSearchSingleIndex44() async throws { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.searchUserIds(searchUserIdsParams: SearchUserIdsParams( - query: "test", - clusterName: "theClusterName", - page: 5, - hitsPerPage: 10 - )) + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "shirt")) + ) // >LOG // SEPARATOR< } - /// Snippet for the setClientApiKey method. + /// Snippet for the searchSingleIndex method. /// - /// switch API key - func snippetForSetClientApiKey() async throws { - // >SEPARATOR setClientApiKey default + /// search_everything + func snippetForSearchSingleIndex45() async throws { + // >SEPARATOR searchSingleIndex search_everything // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - try client.setClientApiKey(apiKey: "updated-api-key") + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "")) + ) // >LOG // SEPARATOR< } - /// Snippet for the setDictionarySettings method. + /// Snippet for the searchSingleIndex method. /// - /// get setDictionarySettings results with minimal parameters - func snippetForSetDictionarySettings() async throws { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + /// api_filtering_range_example + func snippetForSearchSingleIndex46() async throws { + // >SEPARATOR searchSingleIndex api_filtering_range_example // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client - .setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries(plurals: [ - "fr": false, - "en": false, - "ru": true, - ])) - ) + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "books", + filters: "price:10 TO 20" + )) + ) // >LOG // SEPARATOR< } - /// Snippet for the setDictionarySettings method. + /// Snippet for the searchSingleIndex method. /// - /// get setDictionarySettings results with all parameters - func snippetForSetDictionarySettings1() async throws { - // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + /// search_a_query + func snippetForSearchSingleIndex47() async throws { + // >SEPARATOR searchSingleIndex search_a_query // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client - .setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries( - plurals: ["fr": false, "en": false, "ru": true], - stopwords: ["fr": false], - compounds: ["ru": true] - )) - ) + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + similarQuery: "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001" + )) + ) // >LOG // SEPARATOR< } - /// Snippet for the setSettings method. + /// Snippet for the searchSingleIndex method. /// - /// minimal parameters - func snippetForSetSettings() async throws { - // >SEPARATOR setSettings minimal parameters + /// override_retrievable_attributes + func snippetForSearchSingleIndex48() async throws { + // >SEPARATOR searchSingleIndex override_retrievable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.setSettings( + let response: SearchResponse = try await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings(paginationLimitedTo: 10), - forwardToReplicas: true + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToRetrieve: ["title", "content"] + )) ) // >LOG // SEPARATOR< } - /// Snippet for the setSettings method. + /// Snippet for the searchSingleIndex method. /// - /// boolean typoTolerance - func snippetForSetSettings1() async throws { - // >SEPARATOR setSettings boolean typoTolerance + /// restrict_searchable_attributes + func snippetForSearchSingleIndex49() async throws { + // >SEPARATOR searchSingleIndex restrict_searchable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.setSettings( + let response: SearchResponse = try await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)), - forwardToReplicas: true + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + restrictSearchableAttributes: ["title", "author"] + )) ) // >LOG // SEPARATOR< } - /// Snippet for the setSettings method. + /// Snippet for the searchSingleIndex method. /// - /// enum typoTolerance - func snippetForSetSettings2() async throws { - // >SEPARATOR setSettings enum typoTolerance + /// override_default_relevancy + func snippetForSearchSingleIndex50() async throws { + // >SEPARATOR searchSingleIndex override_default_relevancy // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API - let response = try await client.setSettings( + let response: SearchResponse = try await client.searchSingleIndex( indexName: "", - indexSettings: IndexSettings( - typoTolerance: SearchTypoTolerance - .searchTypoToleranceEnum(SearchTypoToleranceEnum.min) - ), - forwardToReplicas: true + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + relevancyStrictness: 70 + )) ) // >LOG // SEPARATOR< } - /// Snippet for the setSettings method. + /// Snippet for the searchSingleIndex method. /// - /// ignorePlurals - func snippetForSetSettings3() async throws { - // >SEPARATOR setSettings ignorePlurals + /// apply_filters + func snippetForSearchSingleIndex51() async throws { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_all_filters + func snippetForSearchSingleIndex52() async throws { + // >SEPARATOR searchSingleIndex apply_all_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + 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\"" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// escape_spaces + func snippetForSearchSingleIndex53() async throws { + // >SEPARATOR searchSingleIndex escape_spaces + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "category:\"Books and Comics\"" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// escape_keywords + func snippetForSearchSingleIndex54() async throws { + // >SEPARATOR searchSingleIndex escape_keywords + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "keyword:\"OR\"" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// escape_single_quotes + func snippetForSearchSingleIndex55() async throws { + // >SEPARATOR searchSingleIndex escape_single_quotes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "content:\"It's a wonderful day\"" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// escape_double_quotes + func snippetForSearchSingleIndex56() async throws { + // >SEPARATOR searchSingleIndex escape_double_quotes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "content:\"She said \"Hello World\"" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_filters + func snippetForSearchSingleIndex57() async throws { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalFilters: SearchOptionalFilters.arrayOfSearchOptionalFilters([ + SearchOptionalFilters.string("category:Book"), + SearchOptionalFilters.string("author:John Doe"), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_negative_filters + func snippetForSearchSingleIndex58() async throws { + // >SEPARATOR searchSingleIndex apply_negative_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalFilters: SearchOptionalFilters.arrayOfSearchOptionalFilters([ + SearchOptionalFilters.string("category:Book"), + SearchOptionalFilters.string("author:-John Doe"), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_numeric_filters + func snippetForSearchSingleIndex59() async throws { + // >SEPARATOR searchSingleIndex apply_numeric_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + numericFilters: SearchNumericFilters.arrayOfSearchNumericFilters([ + SearchNumericFilters.string("price < 1000"), + SearchNumericFilters.arrayOfSearchNumericFilters([ + SearchNumericFilters.string("inStock = 1"), + SearchNumericFilters.string("deliveryDate < 1441755506"), + ]), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_tag_filters + func snippetForSearchSingleIndex60() async throws { + // >SEPARATOR searchSingleIndex apply_tag_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + tagFilters: SearchTagFilters.arrayOfSearchTagFilters([ + SearchTagFilters.string("SciFi"), + SearchTagFilters.arrayOfSearchTagFilters([ + SearchTagFilters.string("Book"), + SearchTagFilters.string("Movie"), + ]), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// apply_filters + func snippetForSearchSingleIndex61() async throws { + // >SEPARATOR searchSingleIndex apply_filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + sumOrFiltersScores: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// facets_all + func snippetForSearchSingleIndex62() async throws { + // >SEPARATOR searchSingleIndex facets_all + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facets: ["*"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// retrieve_only_some_facets + func snippetForSearchSingleIndex63() async throws { + // >SEPARATOR searchSingleIndex retrieve_only_some_facets + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facets: ["category", "author"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_max_values_per_facet + func snippetForSearchSingleIndex64() async throws { + // >SEPARATOR searchSingleIndex override_default_max_values_per_facet + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + maxValuesPerFacet: 20 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_faceting_after_distinct + func snippetForSearchSingleIndex65() async throws { + // >SEPARATOR searchSingleIndex enable_faceting_after_distinct + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetingAfterDistinct: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// sort_facet_values_alphabetically + func snippetForSearchSingleIndex66() async throws { + // >SEPARATOR searchSingleIndex sort_facet_values_alphabetically + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + sortFacetValuesBy: "count" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_attributes_to_snippet + func snippetForSearchSingleIndex67() async throws { + // >SEPARATOR searchSingleIndex override_attributes_to_snippet + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToSnippet: ["title", "content:80"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_highlight_pre_tag + func snippetForSearchSingleIndex68() async throws { + // >SEPARATOR searchSingleIndex override_default_highlight_pre_tag + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + highlightPreTag: "" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_highlight_post_tag + func snippetForSearchSingleIndex69() async throws { + // >SEPARATOR searchSingleIndex override_default_highlight_post_tag + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + highlightPostTag: "" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_snippet_ellipsis_text + func snippetForSearchSingleIndex70() async throws { + // >SEPARATOR searchSingleIndex override_default_snippet_ellipsis_text + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + snippetEllipsisText: "" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_restrict_highlight_and_snippet_arrays + func snippetForSearchSingleIndex71() async throws { + // >SEPARATOR searchSingleIndex enable_restrict_highlight_and_snippet_arrays + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + restrictHighlightAndSnippetArrays: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// access_page + func snippetForSearchSingleIndex72() async throws { + // >SEPARATOR searchSingleIndex access_page + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "query", page: 0)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_hits_per_page + func snippetForSearchSingleIndex73() async throws { + // >SEPARATOR searchSingleIndex override_default_hits_per_page + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + hitsPerPage: 10 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// get_nth_hit + func snippetForSearchSingleIndex74() async throws { + // >SEPARATOR searchSingleIndex get_nth_hit + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + offset: 4 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// get_n_results + func snippetForSearchSingleIndex75() async throws { + // >SEPARATOR searchSingleIndex get_n_results + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + length: 4 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_min_word_size_for_one_typo + func snippetForSearchSingleIndex76() async throws { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_one_typo + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minWordSizefor1Typo: 2 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_min_word_size_for_two_typos + func snippetForSearchSingleIndex77() async throws { + // >SEPARATOR searchSingleIndex override_default_min_word_size_for_two_typos + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minWordSizefor2Typos: 2 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_typo_tolerance_mode + func snippetForSearchSingleIndex78() async throws { + // >SEPARATOR searchSingleIndex override_default_typo_tolerance_mode + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + typoTolerance: SearchTypoTolerance.bool(false) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disable_typos_on_numeric_tokens_at_search_time + func snippetForSearchSingleIndex79() async throws { + // >SEPARATOR searchSingleIndex disable_typos_on_numeric_tokens_at_search_time + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + allowTyposOnNumericTokens: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_around_a_position + func snippetForSearchSingleIndex80() async throws { + // >SEPARATOR searchSingleIndex search_around_a_position + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundLatLng: "40.71, -74.01" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_around_server_ip + func snippetForSearchSingleIndex81() async throws { + // >SEPARATOR searchSingleIndex search_around_server_ip + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundLatLngViaIP: true + )), + requestOptions: RequestOptions( + headers: [ + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around", + ] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_around_radius + func snippetForSearchSingleIndex82() async throws { + // >SEPARATOR searchSingleIndex set_around_radius + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundRadius: SearchAroundRadius.int(1000) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disable_automatic_radius + func snippetForSearchSingleIndex83() async throws { + // >SEPARATOR searchSingleIndex disable_automatic_radius + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundRadius: SearchAroundRadius.searchAroundRadiusAll(SearchAroundRadiusAll.all) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_geo_search_precision + func snippetForSearchSingleIndex84() async throws { + // >SEPARATOR searchSingleIndex set_geo_search_precision + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundPrecision: SearchAroundPrecision.int(100) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_geo_search_precision_non_linear + func snippetForSearchSingleIndex85() async throws { + // >SEPARATOR searchSingleIndex set_geo_search_precision_non_linear + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundPrecision: SearchAroundPrecision.arrayOfSearchRange([ + SearchRange(from: 0, value: 25), + SearchRange(from: 2000, value: 1000), + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_minimum_geo_search_radius + func snippetForSearchSingleIndex86() async throws { + // >SEPARATOR searchSingleIndex set_minimum_geo_search_radius + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minimumAroundRadius: 1000 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_inside_rectangular_area + func snippetForSearchSingleIndex87() async throws { + // >SEPARATOR searchSingleIndex search_inside_rectangular_area + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([[ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ]]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_inside_multiple_rectangular_areas + func snippetForSearchSingleIndex88() async throws { + // >SEPARATOR searchSingleIndex search_inside_multiple_rectangular_areas + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875], + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_inside_polygon_area + func snippetForSearchSingleIndex89() async throws { + // >SEPARATOR searchSingleIndex search_inside_polygon_area + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insidePolygon: [[ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ]] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// search_inside_multiple_polygon_areas + func snippetForSearchSingleIndex90() async throws { + // >SEPARATOR searchSingleIndex search_inside_multiple_polygon_areas + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + 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, + ], + ] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_querylanguages_override + func snippetForSearchSingleIndex91() async throws { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + ignorePlurals: SearchIgnorePlurals.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_querylanguages_override + func snippetForSearchSingleIndex92() async throws { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeStopWords: SearchRemoveStopWords.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_querylanguages_override + func snippetForSearchSingleIndex93() async throws { + // >SEPARATOR searchSingleIndex set_querylanguages_override + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeStopWords: SearchRemoveStopWords.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_querylanguages_with_japanese_query + func snippetForSearchSingleIndex94() async throws { + // >SEPARATOR searchSingleIndex set_querylanguages_with_japanese_query + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + queryLanguages: [SearchSupportedLanguage.ja, SearchSupportedLanguage.en] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_natural_languages + func snippetForSearchSingleIndex95() async throws { + // >SEPARATOR searchSingleIndex set_natural_languages + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + naturalLanguages: [SearchSupportedLanguage.fr] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_natural_languages_with_query + func snippetForSearchSingleIndex96() async throws { + // >SEPARATOR searchSingleIndex override_natural_languages_with_query + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + naturalLanguages: [SearchSupportedLanguage.fr], + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.firstWords + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_decompound_query_search_time + func snippetForSearchSingleIndex97() async throws { + // >SEPARATOR searchSingleIndex enable_decompound_query_search_time + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + decompoundQuery: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_rules_search_time + func snippetForSearchSingleIndex98() async throws { + // >SEPARATOR searchSingleIndex enable_rules_search_time + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableRules: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_rule_contexts + func snippetForSearchSingleIndex99() async throws { + // >SEPARATOR searchSingleIndex set_rule_contexts + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + ruleContexts: ["front_end", "website2"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_personalization + func snippetForSearchSingleIndex100() async throws { + // >SEPARATOR searchSingleIndex enable_personalization + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enablePersonalization: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_personalization_with_user_token + func snippetForSearchSingleIndex101() async throws { + // >SEPARATOR searchSingleIndex enable_personalization_with_user_token + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456", + enablePersonalization: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// personalization_impact + func snippetForSearchSingleIndex102() async throws { + // >SEPARATOR searchSingleIndex personalization_impact + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + personalizationImpact: 20 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_user_token + func snippetForSearchSingleIndex103() async throws { + // >SEPARATOR searchSingleIndex set_user_token + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456" + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_user_token_with_personalization + func snippetForSearchSingleIndex104() async throws { + // >SEPARATOR searchSingleIndex set_user_token_with_personalization + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456", + enablePersonalization: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_query_type + func snippetForSearchSingleIndex105() async throws { + // >SEPARATOR searchSingleIndex override_default_query_type + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + queryType: SearchQueryType.prefixAll + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_remove_words_if_no_results + func snippetForSearchSingleIndex106() async throws { + // >SEPARATOR searchSingleIndex override_default_remove_words_if_no_results + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_advanced_syntax_search_time + func snippetForSearchSingleIndex107() async throws { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_search_time + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// overide_default_optional_words + func snippetForSearchSingleIndex108() async throws { + // >SEPARATOR searchSingleIndex overide_default_optional_words + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalWords: SearchOptionalWords.arrayOfString(["toyota", "2020 2021"]) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disabling_exact_for_some_attributes_search_time + func snippetForSearchSingleIndex109() async throws { + // >SEPARATOR searchSingleIndex disabling_exact_for_some_attributes_search_time + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + disableExactOnAttributes: ["description"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_exact_single_word_query + func snippetForSearchSingleIndex110() async throws { + // >SEPARATOR searchSingleIndex override_default_exact_single_word_query + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + exactOnSingleWordQuery: SearchExactOnSingleWordQuery.`none` + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_aternative_as_exact + func snippetForSearchSingleIndex111() async throws { + // >SEPARATOR searchSingleIndex override_default_aternative_as_exact + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + alternativesAsExact: [SearchAlternativesAsExact.multiWordsSynonym] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_advanced_syntax_exact_phrase + func snippetForSearchSingleIndex112() async throws { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exact_phrase + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_advanced_syntax_exclude_words + func snippetForSearchSingleIndex113() async throws { + // >SEPARATOR searchSingleIndex enable_advanced_syntax_exclude_words + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.excludeWords] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_distinct + func snippetForSearchSingleIndex114() async throws { + // >SEPARATOR searchSingleIndex override_distinct + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + distinct: SearchDistinct.int(0) + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// get_ranking_info + func snippetForSearchSingleIndex115() async throws { + // >SEPARATOR searchSingleIndex get_ranking_info + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + getRankingInfo: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disable_click_analytics + func snippetForSearchSingleIndex116() async throws { + // >SEPARATOR searchSingleIndex disable_click_analytics + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + clickAnalytics: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// enable_click_analytics + func snippetForSearchSingleIndex117() async throws { + // >SEPARATOR searchSingleIndex enable_click_analytics + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + clickAnalytics: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disable_analytics + func snippetForSearchSingleIndex118() async throws { + // >SEPARATOR searchSingleIndex disable_analytics + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + analytics: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// add_analytics_tags + func snippetForSearchSingleIndex119() async throws { + // >SEPARATOR searchSingleIndex add_analytics_tags + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + analyticsTags: ["front_end", "website2"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// disable_synonyms + func snippetForSearchSingleIndex120() async throws { + // >SEPARATOR searchSingleIndex disable_synonyms + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + synonyms: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_replace_synonyms_in_highlights + func snippetForSearchSingleIndex121() async throws { + // >SEPARATOR searchSingleIndex override_replace_synonyms_in_highlights + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + replaceSynonymsInHighlight: true + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_min_proximity + func snippetForSearchSingleIndex122() async throws { + // >SEPARATOR searchSingleIndex override_min_proximity + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minProximity: 2 + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_default_field + func snippetForSearchSingleIndex123() async throws { + // >SEPARATOR searchSingleIndex override_default_field + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + responseFields: ["hits", "facets"] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// override_percentile_computation + func snippetForSearchSingleIndex124() async throws { + // >SEPARATOR searchSingleIndex override_percentile_computation + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + percentileComputation: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_ab_test + func snippetForSearchSingleIndex125() async throws { + // >SEPARATOR searchSingleIndex set_ab_test + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableABTest: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSingleIndex method. + /// + /// set_enable_re_ranking + func snippetForSearchSingleIndex126() async throws { + // >SEPARATOR searchSingleIndex set_enable_re_ranking + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response: SearchResponse = try await client.searchSingleIndex( + indexName: "", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableReRanking: false + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSynonyms method. + /// + /// searchSynonyms with minimal parameters + func snippetForSearchSynonyms() async throws { + // >SEPARATOR searchSynonyms searchSynonyms with minimal parameters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.searchSynonyms(indexName: "") + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchSynonyms method. + /// + /// searchSynonyms with all parameters + func snippetForSearchSynonyms1() async throws { + // >SEPARATOR searchSynonyms searchSynonyms with all parameters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.searchSynonyms( + indexName: "", + searchSynonymsParams: SearchSynonymsParams( + query: "myQuery", + type: SynonymType.altcorrection1, + page: 10, + hitsPerPage: 10 + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the searchUserIds method. + /// + /// searchUserIds + func snippetForSearchUserIds() async throws { + // >SEPARATOR searchUserIds default + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.searchUserIds(searchUserIdsParams: SearchUserIdsParams( + query: "test", + clusterName: "theClusterName", + page: 5, + hitsPerPage: 10 + )) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setClientApiKey method. + /// + /// switch API key + func snippetForSetClientApiKey() async throws { + // >SEPARATOR setClientApiKey default + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + try client.setClientApiKey(apiKey: "updated-api-key") + // >LOG + // SEPARATOR< + } + + /// Snippet for the setDictionarySettings method. + /// + /// get setDictionarySettings results with minimal parameters + func snippetForSetDictionarySettings() async throws { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with minimal parameters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client + .setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries(plurals: [ + "fr": false, + "en": false, + "ru": true, + ])) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setDictionarySettings method. + /// + /// get setDictionarySettings results with all parameters + func snippetForSetDictionarySettings1() async throws { + // >SEPARATOR setDictionarySettings get setDictionarySettings results with all parameters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client + .setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries( + plurals: ["fr": false, "en": false, "ru": true], + stopwords: ["fr": false], + compounds: ["ru": true] + )) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// minimal parameters + func snippetForSetSettings() async throws { + // >SEPARATOR setSettings minimal parameters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(paginationLimitedTo: 10), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// boolean typoTolerance + func snippetForSetSettings1() async throws { + // >SEPARATOR setSettings boolean typoTolerance + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// enum typoTolerance + func snippetForSetSettings2() async throws { + // >SEPARATOR setSettings enum typoTolerance + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + typoTolerance: SearchTypoTolerance + .searchTypoToleranceEnum(SearchTypoToleranceEnum.min) + ), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// ignorePlurals + func snippetForSetSettings3() async throws { + // >SEPARATOR setSettings ignorePlurals + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(ignorePlurals: SearchIgnorePlurals.bool(true)), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// list of string ignorePlurals + func snippetForSetSettings4() async throws { + // >SEPARATOR setSettings list of string ignorePlurals + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals + .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) + ), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// removeStopWords boolean + func snippetForSetSettings5() async throws { + // >SEPARATOR setSettings removeStopWords boolean + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(removeStopWords: SearchRemoveStopWords.bool(true)), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// removeStopWords list of string + func snippetForSetSettings6() async throws { + // >SEPARATOR setSettings removeStopWords list of string + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + removeStopWords: SearchRemoveStopWords + .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) + ), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// boolean distinct + func snippetForSetSettings7() async throws { + // >SEPARATOR setSettings boolean distinct + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// integer distinct + func snippetForSetSettings8() async throws { + // >SEPARATOR setSettings integer distinct + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(distinct: SearchDistinct.int(1)), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// distinct company + func snippetForSetSettings9() async throws { + // >SEPARATOR setSettings distinct company + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributeForDistinct: "company", distinct: SearchDistinct.bool(true)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// distinct design + func snippetForSetSettings10() async throws { + // >SEPARATOR setSettings distinct design + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributeForDistinct: "design", distinct: SearchDistinct.bool(true)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// distinct true + func snippetForSetSettings11() async throws { + // >SEPARATOR setSettings distinct true + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// distinct section + func snippetForSetSettings12() async throws { + // >SEPARATOR setSettings distinct section + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributeForDistinct: "section", distinct: SearchDistinct.bool(true)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting allergens + func snippetForSetSettings13() async throws { + // >SEPARATOR setSettings attributesForFaceting allergens + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["allergens"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// api_attributes_for_faceting + func snippetForSetSettings14() async throws { + // >SEPARATOR setSettings api_attributes_for_faceting + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["genre", "author"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// api_attributes_for_faceting_searchable + func snippetForSetSettings15() async throws { + // >SEPARATOR setSettings api_attributes_for_faceting_searchable + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["genre", "searchable(author)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// api_attributes_for_filter_only + func snippetForSetSettings16() async throws { + // >SEPARATOR setSettings api_attributes_for_filter_only + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(genre)", "author"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting categoryPageId + func snippetForSetSettings17() async throws { + // >SEPARATOR setSettings attributesForFaceting categoryPageId + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["searchable(categoryPageId)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// unretrievableAttributes + func snippetForSetSettings18() async throws { + // >SEPARATOR setSettings unretrievableAttributes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(unretrievableAttributes: ["visible_by"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting user restricted data + func snippetForSetSettings19() async throws { + // >SEPARATOR setSettings attributesForFaceting user restricted data + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(visible_by)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting optional filters + func snippetForSetSettings20() async throws { + // >SEPARATOR setSettings attributesForFaceting optional filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["can_deliver_quickly", "restaurant"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting redirect index + func snippetForSetSettings21() async throws { + // >SEPARATOR setSettings attributesForFaceting redirect index + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["query_terms"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting multiple consequences + func snippetForSetSettings22() async throws { + // >SEPARATOR setSettings attributesForFaceting multiple consequences + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["director"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting in-depth optional filters + func snippetForSetSettings23() async throws { + // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(brand)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// mode neuralSearch + func snippetForSetSettings24() async throws { + // >SEPARATOR setSettings mode neuralSearch + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(mode: SearchMode.neuralSearch) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// mode keywordSearch + func snippetForSetSettings25() async throws { + // >SEPARATOR setSettings mode keywordSearch + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(mode: SearchMode.keywordSearch) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributes same priority + func snippetForSetSettings26() async throws { + // >SEPARATOR setSettings searchableAttributes same priority + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["title,comments", "ingredients"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributes higher priority + func snippetForSetSettings27() async throws { + // >SEPARATOR setSettings searchableAttributes higher priority + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["title", "ingredients"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking retweets + func snippetForSetSettings28() async throws { + // >SEPARATOR setSettings customRanking retweets + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(retweets)", "desc(likes)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking boosted + func snippetForSetSettings29() async throws { + // >SEPARATOR setSettings customRanking boosted + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(boosted)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking pageviews + func snippetForSetSettings30() async throws { + // >SEPARATOR setSettings customRanking pageviews + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(pageviews)", "desc(comments)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking applying search parameters for a specific query + func snippetForSetSettings31() async throws { + // >SEPARATOR setSettings customRanking applying search parameters for a specific query + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: ["city, country"], + customRanking: ["desc(nb_airline_liaisons)"] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking rounded pageviews + func snippetForSetSettings32() async throws { + // >SEPARATOR setSettings customRanking rounded pageviews + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(rounded_pageviews)", "desc(comments)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking price + func snippetForSetSettings33() async throws { + // >SEPARATOR setSettings customRanking price + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(price)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// ranking exhaustive + func snippetForSetSettings34() async throws { + // >SEPARATOR setSettings ranking exhaustive + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// ranking standard replica + func snippetForSetSettings35() async throws { + // >SEPARATOR setSettings ranking standard replica + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(ranking: ["desc(post_date_timestamp)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// ranking virtual replica + func snippetForSetSettings36() async throws { + // >SEPARATOR setSettings ranking virtual replica + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["desc(post_date_timestamp)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// customRanking and ranking sort alphabetically + func snippetForSetSettings37() async throws { + // >SEPARATOR setSettings customRanking and ranking sort alphabetically + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + customRanking: ["asc(textual_attribute)"], + ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// relevancyStrictness + func snippetForSetSettings38() async throws { + // >SEPARATOR setSettings relevancyStrictness + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(customRanking: ["asc(textual_attribute)"], relevancyStrictness: 0) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// create replica index + func snippetForSetSettings39() async throws { + // >SEPARATOR setSettings create replica index + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(replicas: ["products_price_desc"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// create replica index articles + func snippetForSetSettings40() async throws { + // >SEPARATOR setSettings create replica index articles + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(replicas: ["articles_date_desc"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// create virtual replica index + func snippetForSetSettings41() async throws { + // >SEPARATOR setSettings create virtual replica index + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(replicas: ["virtual(products_price_desc)"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// unlink replica index + func snippetForSetSettings42() async throws { + // >SEPARATOR setSettings unlink replica index + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(replicas: [""]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// forwardToReplicas + func snippetForSetSettings43() async throws { + // >SEPARATOR setSettings forwardToReplicas + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["name", "description"]), + forwardToReplicas: true + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// maxValuesPerFacet + func snippetForSetSettings44() async throws { + // >SEPARATOR setSettings maxValuesPerFacet + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(maxValuesPerFacet: 1000) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// maxFacetHits + func snippetForSetSettings45() async throws { + // >SEPARATOR setSettings maxFacetHits + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(maxFacetHits: 1000) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesForFaceting complex + func snippetForSetSettings46() async throws { + // >SEPARATOR setSettings attributesForFaceting complex + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// ranking closest dates + func snippetForSetSettings47() async throws { + // >SEPARATOR setSettings ranking closest dates + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(ranking: [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributes item variation + func snippetForSetSettings48() async throws { + // >SEPARATOR setSettings searchableAttributes item variation + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["design", "type", "color"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributes around location + func snippetForSetSettings49() async throws { + // >SEPARATOR setSettings searchableAttributes around location + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + searchableAttributes: ["name", "country", "code", "iata_code"], + customRanking: ["desc(links_count)"] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesToHighlight + func snippetForSetSettings50() async throws { + // >SEPARATOR setSettings attributesToHighlight + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesToHighlight: ["author", "title", "content"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// attributesToHighlightStar + func snippetForSetSettings51() async throws { + // >SEPARATOR setSettings attributesToHighlightStar + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(attributesToHighlight: ["*"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// everything + func snippetForSetSettings52() async throws { + // >SEPARATOR setSettings everything + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: ["algolia"], + replicas: [""], + paginationLimitedTo: 0, + unretrievableAttributes: ["foo"], + disableTypoToleranceOnWords: ["algolia"], + attributesToTransliterate: ["algolia"], + camelCaseAttributes: ["algolia"], + decompoundedAttributes: ["algolia": "aloglia"], + indexLanguages: [SearchSupportedLanguage.fr], + disablePrefixOnAttributes: ["algolia"], + allowCompressionOfIntegerArray: true, + numericAttributesForFiltering: ["algolia"], + separatorsToIndex: "bar", + searchableAttributes: ["foo"], + userData: ["user": "data"], + customNormalization: ["algolia": ["aloglia": "aglolia"]], + attributeForDistinct: "test", + maxFacetHits: 20, + keepDiacriticsOnCharacters: "abc", + customRanking: ["algolia"], + attributesToRetrieve: ["algolia"], + ranking: ["geo"], + relevancyStrictness: 10, + attributesToHighlight: ["algolia"], + attributesToSnippet: ["algolia"], + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "---", + restrictHighlightAndSnippetArrays: true, + hitsPerPage: 10, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + typoTolerance: SearchTypoTolerance.bool(false), + allowTyposOnNumericTokens: true, + disableTypoToleranceOnAttributes: ["algolia"], + ignorePlurals: SearchIgnorePlurals.bool(false), + removeStopWords: SearchRemoveStopWords.bool(false), + queryLanguages: [SearchSupportedLanguage.fr], + decompoundQuery: false, + enableRules: true, + enablePersonalization: true, + queryType: SearchQueryType.prefixLast, + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords, + mode: SearchMode.neuralSearch, + semanticSearch: SearchSemanticSearch(eventSources: ["foo"]), + advancedSyntax: true, + optionalWords: SearchOptionalWords.arrayOfString(["myspace"]), + disableExactOnAttributes: ["algolia"], + exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute, + alternativesAsExact: [SearchAlternativesAsExact.singleWordSynonym], + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase], + distinct: SearchDistinct.int(3), + replaceSynonymsInHighlight: true, + minProximity: 6, + responseFields: ["algolia"], + maxValuesPerFacet: 30, + sortFacetValuesBy: "date", + attributeCriteriaComputedByMinProximity: true, + renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( + facets: SearchFacets(order: ["a", "b"]), + values: ["a": SearchValue(order: ["b"], sortRemainingBy: SearchSortRemainingBy.count)] + )), + enableReRanking: false, + reRankingApplyFilter: SearchReRankingApplyFilter.string("mySearch:filters") + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesWithCustomRankingsAndAttributesForFaceting + func snippetForSetSettings53() async throws { + // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: ["searchable(brand)", "type", "categories", "price"], + searchableAttributes: ["brand", "name", "categories", "unordered(description)"], + customRanking: ["desc(popularity)"] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesOrdering + func snippetForSetSettings54() async throws { + // >SEPARATOR setSettings searchableAttributesOrdering + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["unordered(title)", "cast"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesProductReferenceSuffixes + func snippetForSetSettings55() async throws { + // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: [ + "name", + "product_reference", + "product_reference_suffixes", + ]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// queryLanguageAndIgnorePlurals + func snippetForSetSettings56() async throws { + // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + queryLanguages: [SearchSupportedLanguage.en] + ) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesInMovies + func snippetForSetSettings57() async throws { + // >SEPARATOR setSettings searchableAttributesInMovies + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["title_eng", "title_fr", "title_es"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// disablePrefixOnAttributes + func snippetForSetSettings58() async throws { + // >SEPARATOR setSettings disablePrefixOnAttributes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(disablePrefixOnAttributes: ["serial_number"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// disableTypoToleranceOnAttributes + func snippetForSetSettings59() async throws { + // >SEPARATOR setSettings disableTypoToleranceOnAttributes + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesSimpleExample + func snippetForSetSettings60() async throws { + // >SEPARATOR setSettings searchableAttributesSimpleExample + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["serial_number"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// searchableAttributesSimpleExampleAlt + func snippetForSetSettings61() async throws { + // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(searchableAttributes: ["serial_number", "serial_number_suffixes"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_searchable_attributes + func snippetForSetSettings62() async throws { + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(ignorePlurals: SearchIgnorePlurals.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(searchableAttributes: [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ]) ) // >LOG // SEPARATOR< @@ -4068,20 +7069,22 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// list of string ignorePlurals - func snippetForSetSettings4() async throws { - // >SEPARATOR setSettings list of string ignorePlurals + /// set_searchable_attributes + func snippetForSetSettings63() async throws { + // >SEPARATOR setSettings set_searchable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - ignorePlurals: SearchIgnorePlurals - .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) - ), - forwardToReplicas: true + indexSettings: IndexSettings(attributesForFaceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ]) ) // >LOG // SEPARATOR< @@ -4089,17 +7092,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// removeStopWords boolean - func snippetForSetSettings5() async throws { - // >SEPARATOR setSettings removeStopWords boolean + /// unretrievable_attributes + func snippetForSetSettings64() async throws { + // >SEPARATOR setSettings unretrievable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(removeStopWords: SearchRemoveStopWords.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(unretrievableAttributes: ["total_number_of_sales"]) ) // >LOG // SEPARATOR< @@ -4107,20 +7109,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// removeStopWords list of string - func snippetForSetSettings6() async throws { - // >SEPARATOR setSettings removeStopWords list of string + /// set_retrievable_attributes + func snippetForSetSettings65() async throws { + // >SEPARATOR setSettings set_retrievable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - removeStopWords: SearchRemoveStopWords - .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) - ), - forwardToReplicas: true + indexSettings: IndexSettings(attributesToRetrieve: ["author", "title", "content"]) ) // >LOG // SEPARATOR< @@ -4128,17 +7126,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// boolean distinct - func snippetForSetSettings7() async throws { - // >SEPARATOR setSettings boolean distinct + /// set_all_attributes_as_retrievable + func snippetForSetSettings66() async throws { + // >SEPARATOR setSettings set_all_attributes_as_retrievable // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(attributesToRetrieve: ["*"]) ) // >LOG // SEPARATOR< @@ -4146,17 +7143,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// integer distinct - func snippetForSetSettings8() async throws { - // >SEPARATOR setSettings integer distinct + /// specify_attributes_not_to_retrieve + func snippetForSetSettings67() async throws { + // >SEPARATOR setSettings specify_attributes_not_to_retrieve // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(distinct: SearchDistinct.int(1)), - forwardToReplicas: true + indexSettings: IndexSettings(attributesToRetrieve: ["*", "-SKU", "-internal_desc"]) ) // >LOG // SEPARATOR< @@ -4164,16 +7160,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// distinct company - func snippetForSetSettings9() async throws { - // >SEPARATOR setSettings distinct company + /// neural_search + func snippetForSetSettings68() async throws { + // >SEPARATOR setSettings neural_search // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributeForDistinct: "company", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(mode: SearchMode.neuralSearch) ) // >LOG // SEPARATOR< @@ -4181,16 +7177,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// distinct design - func snippetForSetSettings10() async throws { - // >SEPARATOR setSettings distinct design + /// keyword_search + func snippetForSetSettings69() async throws { + // >SEPARATOR setSettings keyword_search // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributeForDistinct: "design", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(mode: SearchMode.keywordSearch) ) // >LOG // SEPARATOR< @@ -4198,16 +7194,25 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// distinct true - func snippetForSetSettings11() async throws { - // >SEPARATOR setSettings distinct true + /// set_default_ranking + func snippetForSetSettings70() async throws { + // >SEPARATOR setSettings set_default_ranking // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(ranking: [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ]) ) // >LOG // SEPARATOR< @@ -4215,16 +7220,26 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// distinct section - func snippetForSetSettings12() async throws { - // >SEPARATOR setSettings distinct section + /// set_ranking_by_attribute_asc + func snippetForSetSettings71() async throws { + // >SEPARATOR setSettings set_ranking_by_attribute_asc // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributeForDistinct: "section", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(ranking: [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) ) // >LOG // SEPARATOR< @@ -4232,16 +7247,26 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting allergens - func snippetForSetSettings13() async throws { - // >SEPARATOR setSettings attributesForFaceting allergens + /// set_ranking_by_attribute_desc + func snippetForSetSettings72() async throws { + // >SEPARATOR setSettings set_ranking_by_attribute_desc // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["allergens"]) + indexSettings: IndexSettings(ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) ) // >LOG // SEPARATOR< @@ -4249,16 +7274,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting categoryPageId - func snippetForSetSettings14() async throws { - // >SEPARATOR setSettings attributesForFaceting categoryPageId + /// restrict_searchable_attributes + func snippetForSetSettings73() async throws { + // >SEPARATOR setSettings restrict_searchable_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["searchable(categoryPageId)"]) + indexSettings: IndexSettings(customRanking: ["desc(popularity)", "asc(price)"]) ) // >LOG // SEPARATOR< @@ -4266,16 +7291,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// unretrievableAttributes - func snippetForSetSettings15() async throws { - // >SEPARATOR setSettings unretrievableAttributes + /// set_default_relevancy + func snippetForSetSettings74() async throws { + // >SEPARATOR setSettings set_default_relevancy // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(unretrievableAttributes: ["visible_by"]) + indexSettings: IndexSettings(relevancyStrictness: 90) ) // >LOG // SEPARATOR< @@ -4283,16 +7308,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting user restricted data - func snippetForSetSettings16() async throws { - // >SEPARATOR setSettings attributesForFaceting user restricted data + /// set_replicas + func snippetForSetSettings75() async throws { + // >SEPARATOR setSettings set_replicas // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(visible_by)"]) + indexSettings: IndexSettings(replicas: ["name_of_replica_index1", "name_of_replica_index2"]) ) // >LOG // SEPARATOR< @@ -4300,16 +7325,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting optional filters - func snippetForSetSettings17() async throws { - // >SEPARATOR setSettings attributesForFaceting optional filters + /// set_default_max_values_per_facet + func snippetForSetSettings76() async throws { + // >SEPARATOR setSettings set_default_max_values_per_facet // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["can_deliver_quickly", "restaurant"]) + indexSettings: IndexSettings(maxValuesPerFacet: 100) ) // >LOG // SEPARATOR< @@ -4317,16 +7342,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting redirect index - func snippetForSetSettings18() async throws { - // >SEPARATOR setSettings attributesForFaceting redirect index + /// set_default_sort_facet_values_by + func snippetForSetSettings77() async throws { + // >SEPARATOR setSettings set_default_sort_facet_values_by // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["query_terms"]) + indexSettings: IndexSettings(sortFacetValuesBy: "alpha") ) // >LOG // SEPARATOR< @@ -4334,16 +7359,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting multiple consequences - func snippetForSetSettings19() async throws { - // >SEPARATOR setSettings attributesForFaceting multiple consequences + /// set_attributes_to_snippet + func snippetForSetSettings78() async throws { + // >SEPARATOR setSettings set_attributes_to_snippet // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["director"]) + indexSettings: IndexSettings(attributesToSnippet: ["content:80", "description"]) ) // >LOG // SEPARATOR< @@ -4351,16 +7376,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting in-depth optional filters - func snippetForSetSettings20() async throws { - // >SEPARATOR setSettings attributesForFaceting in-depth optional filters + /// set_all_attributes_to_snippet + func snippetForSetSettings79() async throws { + // >SEPARATOR setSettings set_all_attributes_to_snippet // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(brand)"]) + indexSettings: IndexSettings(attributesToSnippet: ["*:80"]) ) // >LOG // SEPARATOR< @@ -4368,16 +7393,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// mode neuralSearch - func snippetForSetSettings21() async throws { - // >SEPARATOR setSettings mode neuralSearch + /// set_default_highlight_pre_tag + func snippetForSetSettings80() async throws { + // >SEPARATOR setSettings set_default_highlight_pre_tag // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(mode: SearchMode.neuralSearch) + indexSettings: IndexSettings(highlightPreTag: "") ) // >LOG // SEPARATOR< @@ -4385,16 +7410,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// mode keywordSearch - func snippetForSetSettings22() async throws { - // >SEPARATOR setSettings mode keywordSearch + /// set_default_highlight_post_tag + func snippetForSetSettings81() async throws { + // >SEPARATOR setSettings set_default_highlight_post_tag // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(mode: SearchMode.keywordSearch) + indexSettings: IndexSettings(highlightPostTag: "") ) // >LOG // SEPARATOR< @@ -4402,16 +7427,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributes same priority - func snippetForSetSettings23() async throws { - // >SEPARATOR setSettings searchableAttributes same priority + /// set_default_snippet_ellipsis_text + func snippetForSetSettings82() async throws { + // >SEPARATOR setSettings set_default_snippet_ellipsis_text // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["title,comments", "ingredients"]) + indexSettings: IndexSettings(snippetEllipsisText: "…") ) // >LOG // SEPARATOR< @@ -4419,16 +7444,172 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributes higher priority - func snippetForSetSettings24() async throws { - // >SEPARATOR setSettings searchableAttributes higher priority + /// enable_restrict_highlight_and_snippet_arrays_by_default + func snippetForSetSettings83() async throws { + // >SEPARATOR setSettings enable_restrict_highlight_and_snippet_arrays_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["title", "ingredients"]) + indexSettings: IndexSettings(restrictHighlightAndSnippetArrays: true) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_default_hits_per_page + func snippetForSetSettings84() async throws { + // >SEPARATOR setSettings set_default_hits_per_page + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(hitsPerPage: 20) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_pagination_limit + func snippetForSetSettings85() async throws { + // >SEPARATOR setSettings set_pagination_limit + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(paginationLimitedTo: 1000) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_default_min_word_size_for_one_typo + func snippetForSetSettings86() async throws { + // >SEPARATOR setSettings set_default_min_word_size_for_one_typo + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(minWordSizefor1Typo: 4) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_default_min_word_size_for_two_typos + func snippetForSetSettings87() async throws { + // >SEPARATOR setSettings set_default_min_word_size_for_two_typos + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(minWordSizefor2Typos: 4) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_default_typo_tolerance_mode + func snippetForSetSettings88() async throws { + // >SEPARATOR setSettings set_default_typo_tolerance_mode + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// disable_typos_on_numeric_tokens_by_default + func snippetForSetSettings89() async throws { + // >SEPARATOR setSettings disable_typos_on_numeric_tokens_by_default + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(allowTyposOnNumericTokens: false) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// disable_typo_tolerance_for_words + func snippetForSetSettings90() async throws { + // >SEPARATOR setSettings disable_typo_tolerance_for_words + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(disableTypoToleranceOnWords: ["wheel", "1X2BCD"]) + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_separators_to_index + func snippetForSetSettings91() async throws { + // >SEPARATOR setSettings set_separators_to_index + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings(separatorsToIndex: "+#") + ) + // >LOG + // SEPARATOR< + } + + /// Snippet for the setSettings method. + /// + /// set_languages_using_querylanguages + func snippetForSetSettings92() async throws { + // >SEPARATOR setSettings set_languages_using_querylanguages + // Initialize the client + let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") + + // Call the API + let response = try await client.setSettings( + indexName: "", + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) // >LOG // SEPARATOR< @@ -4436,16 +7617,19 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking retweets - func snippetForSetSettings25() async throws { - // >SEPARATOR setSettings customRanking retweets + /// set_attributes_to_transliterate + func snippetForSetSettings93() async throws { + // >SEPARATOR setSettings set_attributes_to_transliterate // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(retweets)", "desc(likes)"]) + indexSettings: IndexSettings( + attributesToTransliterate: ["name", "description"], + indexLanguages: [SearchSupportedLanguage.ja] + ) ) // >LOG // SEPARATOR< @@ -4453,16 +7637,19 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking boosted - func snippetForSetSettings26() async throws { - // >SEPARATOR setSettings customRanking boosted + /// set_languages_using_querylanguages + func snippetForSetSettings94() async throws { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(boosted)"]) + indexSettings: IndexSettings( + removeStopWords: SearchRemoveStopWords.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) // >LOG // SEPARATOR< @@ -4470,16 +7657,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking pageviews - func snippetForSetSettings27() async throws { - // >SEPARATOR setSettings customRanking pageviews + /// set_camel_case_attributes + func snippetForSetSettings95() async throws { + // >SEPARATOR setSettings set_camel_case_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(pageviews)", "desc(comments)"]) + indexSettings: IndexSettings(camelCaseAttributes: ["description"]) ) // >LOG // SEPARATOR< @@ -4487,19 +7674,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking applying search parameters for a specific query - func snippetForSetSettings28() async throws { - // >SEPARATOR setSettings customRanking applying search parameters for a specific query + /// set_decompounded_attributes + func snippetForSetSettings96() async throws { + // >SEPARATOR setSettings set_decompounded_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: ["city, country"], - customRanking: ["desc(nb_airline_liaisons)"] - ) + indexSettings: IndexSettings(decompoundedAttributes: ["de": ["name"]]) ) // >LOG // SEPARATOR< @@ -4507,16 +7691,19 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking rounded pageviews - func snippetForSetSettings29() async throws { - // >SEPARATOR setSettings customRanking rounded pageviews + /// set_decompounded_multiple_attributes + func snippetForSetSettings97() async throws { + // >SEPARATOR setSettings set_decompounded_multiple_attributes // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(rounded_pageviews)", "desc(comments)"]) + indexSettings: IndexSettings(decompoundedAttributes: [ + "de": ["name_de", "description_de"], + "fi": ["name_fi", "description_fi"], + ]) ) // >LOG // SEPARATOR< @@ -4524,16 +7711,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking price - func snippetForSetSettings30() async throws { - // >SEPARATOR setSettings customRanking price + /// set_keep_diacritics_on_characters + func snippetForSetSettings98() async throws { + // >SEPARATOR setSettings set_keep_diacritics_on_characters // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(price)"]) + indexSettings: IndexSettings(keepDiacriticsOnCharacters: "øé") ) // >LOG // SEPARATOR< @@ -4541,26 +7728,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// ranking exhaustive - func snippetForSetSettings31() async throws { - // >SEPARATOR setSettings ranking exhaustive + /// set_custom_normalization + func snippetForSetSettings99() async throws { + // >SEPARATOR setSettings set_custom_normalization // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(ranking: [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ]) + indexSettings: IndexSettings(customNormalization: ["default": ["ä": "ae"]]) ) // >LOG // SEPARATOR< @@ -4568,16 +7745,20 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// ranking standard replica - func snippetForSetSettings32() async throws { - // >SEPARATOR setSettings ranking standard replica + /// set_languages_using_querylanguages + func snippetForSetSettings100() async throws { + // >SEPARATOR setSettings set_languages_using_querylanguages // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(ranking: ["desc(post_date_timestamp)"]) + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + removeStopWords: SearchRemoveStopWords.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) // >LOG // SEPARATOR< @@ -4585,16 +7766,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// ranking virtual replica - func snippetForSetSettings33() async throws { - // >SEPARATOR setSettings ranking virtual replica + /// set_indexlanguages + func snippetForSetSettings101() async throws { + // >SEPARATOR setSettings set_indexlanguages // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["desc(post_date_timestamp)"]) + indexSettings: IndexSettings(indexLanguages: [SearchSupportedLanguage.ja]) ) // >LOG // SEPARATOR< @@ -4602,19 +7783,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// customRanking and ranking sort alphabetically - func snippetForSetSettings34() async throws { - // >SEPARATOR setSettings customRanking and ranking sort alphabetically + /// enable_decompound_query_by_default + func snippetForSetSettings102() async throws { + // >SEPARATOR setSettings enable_decompound_query_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - customRanking: ["asc(textual_attribute)"], - ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] - ) + indexSettings: IndexSettings(decompoundQuery: true) ) // >LOG // SEPARATOR< @@ -4622,16 +7800,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// relevancyStrictness - func snippetForSetSettings35() async throws { - // >SEPARATOR setSettings relevancyStrictness + /// enable_rules_syntax_by_default + func snippetForSetSettings103() async throws { + // >SEPARATOR setSettings enable_rules_syntax_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(customRanking: ["asc(textual_attribute)"], relevancyStrictness: 0) + indexSettings: IndexSettings(enableRules: true) ) // >LOG // SEPARATOR< @@ -4639,16 +7817,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// create replica index - func snippetForSetSettings36() async throws { - // >SEPARATOR setSettings create replica index + /// enable_personalization_settings + func snippetForSetSettings104() async throws { + // >SEPARATOR setSettings enable_personalization_settings // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(replicas: ["products_price_desc"]) + indexSettings: IndexSettings(enablePersonalization: true) ) // >LOG // SEPARATOR< @@ -4656,16 +7834,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// create virtual replica index - func snippetForSetSettings37() async throws { - // >SEPARATOR setSettings create virtual replica index + /// set_default_query_type + func snippetForSetSettings105() async throws { + // >SEPARATOR setSettings set_default_query_type // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(replicas: ["virtual(products_price_desc)"]) + indexSettings: IndexSettings(queryType: SearchQueryType.prefixLast) ) // >LOG // SEPARATOR< @@ -4673,16 +7851,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// unlink replica index - func snippetForSetSettings38() async throws { - // >SEPARATOR setSettings unlink replica index + /// set_default_remove_words_if_no_result + func snippetForSetSettings106() async throws { + // >SEPARATOR setSettings set_default_remove_words_if_no_result // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(replicas: [""]) + indexSettings: IndexSettings(removeWordsIfNoResults: SearchRemoveWordsIfNoResults.`none`) ) // >LOG // SEPARATOR< @@ -4690,17 +7868,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// forwardToReplicas - func snippetForSetSettings39() async throws { - // >SEPARATOR setSettings forwardToReplicas + /// enable_advanced_syntax_by_default + func snippetForSetSettings107() async throws { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["name", "description"]), - forwardToReplicas: true + indexSettings: IndexSettings(advancedSyntax: true) ) // >LOG // SEPARATOR< @@ -4708,16 +7885,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// maxValuesPerFacet - func snippetForSetSettings40() async throws { - // >SEPARATOR setSettings maxValuesPerFacet + /// set_default_optional_words + func snippetForSetSettings108() async throws { + // >SEPARATOR setSettings set_default_optional_words // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(maxValuesPerFacet: 1000) + indexSettings: IndexSettings(optionalWords: SearchOptionalWords.arrayOfString(["blue", "iphone case"])) ) // >LOG // SEPARATOR< @@ -4725,16 +7902,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// maxFacetHits - func snippetForSetSettings41() async throws { - // >SEPARATOR setSettings maxFacetHits + /// disabling_prefix_search_for_some_attributes_by_default + func snippetForSetSettings109() async throws { + // >SEPARATOR setSettings disabling_prefix_search_for_some_attributes_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(maxFacetHits: 1000) + indexSettings: IndexSettings(disablePrefixOnAttributes: ["sku"]) ) // >LOG // SEPARATOR< @@ -4742,20 +7919,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// attributesForFaceting complex - func snippetForSetSettings42() async throws { - // >SEPARATOR setSettings attributesForFaceting complex + /// disabling_exact_for_some_attributes_by_default + func snippetForSetSettings110() async throws { + // >SEPARATOR setSettings disabling_exact_for_some_attributes_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(attributesForFaceting: [ - "actor", - "filterOnly(category)", - "searchable(publisher)", - ]) + indexSettings: IndexSettings(disableExactOnAttributes: ["description"]) ) // >LOG // SEPARATOR< @@ -4763,26 +7936,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// ranking closest dates - func snippetForSetSettings43() async throws { - // >SEPARATOR setSettings ranking closest dates + /// set_default_exact_single_word_query + func snippetForSetSettings111() async throws { + // >SEPARATOR setSettings set_default_exact_single_word_query // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(ranking: [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ]) + indexSettings: IndexSettings(exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute) ) // >LOG // SEPARATOR< @@ -4790,16 +7953,19 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributes item variation - func snippetForSetSettings44() async throws { - // >SEPARATOR setSettings searchableAttributes item variation + /// set_default_aternative_as_exact + func snippetForSetSettings112() async throws { + // >SEPARATOR setSettings set_default_aternative_as_exact // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["design", "type", "color"]) + indexSettings: IndexSettings(alternativesAsExact: [ + SearchAlternativesAsExact.ignorePlurals, + SearchAlternativesAsExact.singleWordSynonym, + ]) ) // >LOG // SEPARATOR< @@ -4807,19 +7973,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributes around location - func snippetForSetSettings45() async throws { - // >SEPARATOR setSettings searchableAttributes around location + /// enable_advanced_syntax_by_default + func snippetForSetSettings113() async throws { + // >SEPARATOR setSettings enable_advanced_syntax_by_default // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - searchableAttributes: ["name", "country", "code", "iata_code"], - customRanking: ["desc(links_count)"] - ) + indexSettings: IndexSettings(advancedSyntax: true) ) // >LOG // SEPARATOR< @@ -4827,19 +7990,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributes around location - func snippetForSetSettings46() async throws { - // >SEPARATOR setSettings searchableAttributes around location + /// set_numeric_attributes_for_filtering + func snippetForSetSettings114() async throws { + // >SEPARATOR setSettings set_numeric_attributes_for_filtering // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - searchableAttributes: ["name", "country", "code", "iata_code"], - customRanking: ["desc(links_count)"] - ) + indexSettings: IndexSettings(numericAttributesForFiltering: ["quantity", "popularity"]) ) // >LOG // SEPARATOR< @@ -4847,16 +8007,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// disableTypoToleranceOnAttributes - func snippetForSetSettings47() async throws { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + /// enable_compression_of_integer_array + func snippetForSetSettings115() async throws { + // >SEPARATOR setSettings enable_compression_of_integer_array // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(allowCompressionOfIntegerArray: true) ) // >LOG // SEPARATOR< @@ -4864,81 +8024,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// everything - func snippetForSetSettings48() async throws { - // >SEPARATOR setSettings everything + /// set_attributes_for_distinct + func snippetForSetSettings116() async throws { + // >SEPARATOR setSettings set_attributes_for_distinct // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: ["algolia"], - replicas: [""], - paginationLimitedTo: 0, - unretrievableAttributes: ["foo"], - disableTypoToleranceOnWords: ["algolia"], - attributesToTransliterate: ["algolia"], - camelCaseAttributes: ["algolia"], - decompoundedAttributes: ["algolia": "aloglia"], - indexLanguages: [SearchSupportedLanguage.fr], - disablePrefixOnAttributes: ["algolia"], - allowCompressionOfIntegerArray: true, - numericAttributesForFiltering: ["algolia"], - separatorsToIndex: "bar", - searchableAttributes: ["foo"], - userData: ["user": "data"], - customNormalization: ["algolia": ["aloglia": "aglolia"]], - attributeForDistinct: "test", - maxFacetHits: 20, - keepDiacriticsOnCharacters: "abc", - customRanking: ["algolia"], - attributesToRetrieve: ["algolia"], - ranking: ["geo"], - relevancyStrictness: 10, - attributesToHighlight: ["algolia"], - attributesToSnippet: ["algolia"], - highlightPreTag: "", - highlightPostTag: "", - snippetEllipsisText: "---", - restrictHighlightAndSnippetArrays: true, - hitsPerPage: 10, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - typoTolerance: SearchTypoTolerance.bool(false), - allowTyposOnNumericTokens: true, - disableTypoToleranceOnAttributes: ["algolia"], - ignorePlurals: SearchIgnorePlurals.bool(false), - removeStopWords: SearchRemoveStopWords.bool(false), - queryLanguages: [SearchSupportedLanguage.fr], - decompoundQuery: false, - enableRules: true, - enablePersonalization: true, - queryType: SearchQueryType.prefixLast, - removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords, - mode: SearchMode.neuralSearch, - semanticSearch: SearchSemanticSearch(eventSources: ["foo"]), - advancedSyntax: true, - optionalWords: SearchOptionalWords.arrayOfString(["myspace"]), - disableExactOnAttributes: ["algolia"], - exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute, - alternativesAsExact: [SearchAlternativesAsExact.singleWordSynonym], - advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase], - distinct: SearchDistinct.int(3), - replaceSynonymsInHighlight: true, - minProximity: 6, - responseFields: ["algolia"], - maxValuesPerFacet: 30, - sortFacetValuesBy: "date", - attributeCriteriaComputedByMinProximity: true, - renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( - facets: SearchFacets(order: ["a", "b"]), - values: ["a": SearchValue(order: ["b"], sortRemainingBy: SearchSortRemainingBy.count)] - )), - enableReRanking: false, - reRankingApplyFilter: SearchReRankingApplyFilter.string("mySearch:filters") - ) + indexSettings: IndexSettings(attributeForDistinct: "url") ) // >LOG // SEPARATOR< @@ -4946,20 +8041,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributesWithCustomRankingsAndAttributesForFaceting - func snippetForSetSettings49() async throws { - // >SEPARATOR setSettings searchableAttributesWithCustomRankingsAndAttributesForFaceting + /// set_distinct + func snippetForSetSettings117() async throws { + // >SEPARATOR setSettings set_distinct // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - attributesForFaceting: ["searchable(brand)", "type", "categories", "price"], - searchableAttributes: ["brand", "name", "categories", "unordered(description)"], - customRanking: ["desc(popularity)"] - ) + indexSettings: IndexSettings(attributeForDistinct: "url", distinct: SearchDistinct.int(1)) ) // >LOG // SEPARATOR< @@ -4967,20 +8058,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributesProductReferenceSuffixes - func snippetForSetSettings50() async throws { - // >SEPARATOR setSettings searchableAttributesProductReferenceSuffixes + /// set_replace_synonyms_in_highlights + func snippetForSetSettings118() async throws { + // >SEPARATOR setSettings set_replace_synonyms_in_highlights // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: [ - "name", - "product_reference", - "product_reference_suffixes", - ]) + indexSettings: IndexSettings(replaceSynonymsInHighlight: false) ) // >LOG // SEPARATOR< @@ -4988,19 +8075,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// queryLanguageAndIgnorePlurals - func snippetForSetSettings51() async throws { - // >SEPARATOR setSettings queryLanguageAndIgnorePlurals + /// set_min_proximity + func snippetForSetSettings119() async throws { + // >SEPARATOR setSettings set_min_proximity // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings( - ignorePlurals: SearchIgnorePlurals.bool(true), - queryLanguages: [SearchSupportedLanguage.en] - ) + indexSettings: IndexSettings(minProximity: 1) ) // >LOG // SEPARATOR< @@ -5008,16 +8092,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributesInMovies - func snippetForSetSettings52() async throws { - // >SEPARATOR setSettings searchableAttributesInMovies + /// set_default_field + func snippetForSetSettings120() async throws { + // >SEPARATOR setSettings set_default_field // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["title_eng", "title_fr", "title_es"]) + indexSettings: IndexSettings(responseFields: ["hits", "hitsPerPage", "nbPages", "page"]) ) // >LOG // SEPARATOR< @@ -5025,16 +8109,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// disablePrefixOnAttributes - func snippetForSetSettings53() async throws { - // >SEPARATOR setSettings disablePrefixOnAttributes + /// set_max_facet_hits + func snippetForSetSettings121() async throws { + // >SEPARATOR setSettings set_max_facet_hits // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(disablePrefixOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(maxFacetHits: 10) ) // >LOG // SEPARATOR< @@ -5042,16 +8126,16 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// disableTypoToleranceOnAttributes - func snippetForSetSettings54() async throws { - // >SEPARATOR setSettings disableTypoToleranceOnAttributes + /// set_attribute_criteria_computed_by_min_proximity + func snippetForSetSettings122() async throws { + // >SEPARATOR setSettings set_attribute_criteria_computed_by_min_proximity // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(attributeCriteriaComputedByMinProximity: true) ) // >LOG // SEPARATOR< @@ -5059,16 +8143,18 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributesSimpleExample - func snippetForSetSettings55() async throws { - // >SEPARATOR setSettings searchableAttributesSimpleExample + /// set_user_data + func snippetForSetSettings123() async throws { + // >SEPARATOR setSettings set_user_data // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["serial_number"]) + indexSettings: IndexSettings( + userData: ["extraData": "This is the custom data that you want to store in your index"] + ) ) // >LOG // SEPARATOR< @@ -5076,16 +8162,23 @@ final class SearchClientSnippet { /// Snippet for the setSettings method. /// - /// searchableAttributesSimpleExampleAlt - func snippetForSetSettings56() async throws { - // >SEPARATOR setSettings searchableAttributesSimpleExampleAlt + /// set_rendering_content + func snippetForSetSettings124() async throws { + // >SEPARATOR setSettings set_rendering_content // Initialize the client let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY") // Call the API let response = try await client.setSettings( indexName: "", - indexSettings: IndexSettings(searchableAttributes: ["serial_number", "serial_number_suffixes"]) + indexSettings: IndexSettings(renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( + facets: SearchFacets(order: ["size", "brand"]), + values: [ + "brand": SearchValue(order: ["uniqlo"], sortRemainingBy: SearchSortRemainingBy.count, + hide: ["muji"]), + "size": SearchValue(order: ["S", "M", "L"], sortRemainingBy: SearchSortRemainingBy.hidden), + ] + ))) ) // >LOG // SEPARATOR< diff --git a/tests/output/csharp/src/generated/e2e/Search.test.cs b/tests/output/csharp/src/generated/e2e/Search.test.cs index 6d5c66dc04..93e7d9287d 100644 --- a/tests/output/csharp/src/generated/e2e/Search.test.cs +++ b/tests/output/csharp/src/generated/e2e/Search.test.cs @@ -9,6 +9,7 @@ using Quibble.Xunit; using Xunit; using Action = Algolia.Search.Models.Search.Action; +using Range = Algolia.Search.Models.Search.Range; namespace Algolia.Search.e2e; diff --git a/tests/output/csharp/src/generated/requests/Search.test.cs b/tests/output/csharp/src/generated/requests/Search.test.cs index 761f0d94a1..8a8dc19389 100644 --- a/tests/output/csharp/src/generated/requests/Search.test.cs +++ b/tests/output/csharp/src/generated/requests/Search.test.cs @@ -9,6 +9,7 @@ using Quibble.Xunit; using Xunit; using Action = Algolia.Search.Models.Search.Action; +using Range = Algolia.Search.Models.Search.Range; namespace Algolia.Search.requests; @@ -4020,8 +4021,135 @@ await client.SearchSingleIndexAsync( ); } - [Fact(DisplayName = "facetFiltersNeg")] + [Fact(DisplayName = "facetFiltersBook")] public async Task SearchSingleIndexTest14() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List { new FacetFilters("category:Book") } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facetFilters\":[\"category:Book\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "facetFiltersAND")] + public async Task SearchSingleIndexTest15() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("author:John Doe"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facetFilters\":[\"category:Book\",\"author:John Doe\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "facetFiltersOR")] + public async Task SearchSingleIndexTest16() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("author:John Doe"), + } + ), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facetFilters\":[[\"category:Book\",\"author:John Doe\"]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "facetFiltersCombined")] + public async Task SearchSingleIndexTest17() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + FacetFilters = new FacetFilters( + new List + { + new FacetFilters("author:John Doe"), + new FacetFilters( + new List + { + new FacetFilters("category:Book"), + new FacetFilters("category:Movie"), + } + ), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facetFilters\":[\"author:John Doe\",[\"category:Book\",\"category:Movie\"]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "facetFiltersNeg")] + public async Task SearchSingleIndexTest18() { await client.SearchSingleIndexAsync( "indexName", @@ -4041,7 +4169,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "filtersAndFacetFilters")] - public async Task SearchSingleIndexTest15() + public async Task SearchSingleIndexTest19() { await client.SearchSingleIndexAsync( "indexName", @@ -4067,7 +4195,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "facet author genre")] - public async Task SearchSingleIndexTest16() + public async Task SearchSingleIndexTest20() { await client.SearchSingleIndexAsync( "indexName", @@ -4090,7 +4218,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "facet wildcard")] - public async Task SearchSingleIndexTest17() + public async Task SearchSingleIndexTest21() { await client.SearchSingleIndexAsync( "indexName", @@ -4104,7 +4232,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "maxValuesPerFacet")] - public async Task SearchSingleIndexTest18() + public async Task SearchSingleIndexTest22() { await client.SearchSingleIndexAsync( "indexName", @@ -4122,7 +4250,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "aroundLatLng")] - public async Task SearchSingleIndexTest19() + public async Task SearchSingleIndexTest23() { await client.SearchSingleIndexAsync( "indexName", @@ -4140,7 +4268,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "aroundLatLngViaIP")] - public async Task SearchSingleIndexTest20() + public async Task SearchSingleIndexTest24() { await client.SearchSingleIndexAsync( "indexName", @@ -4158,7 +4286,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "aroundRadius")] - public async Task SearchSingleIndexTest21() + public async Task SearchSingleIndexTest25() { await client.SearchSingleIndexAsync( "indexName", @@ -4182,7 +4310,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "insideBoundingBox")] - public async Task SearchSingleIndexTest22() + public async Task SearchSingleIndexTest26() { await client.SearchSingleIndexAsync( "indexName", @@ -4210,7 +4338,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "insidePolygon")] - public async Task SearchSingleIndexTest23() + public async Task SearchSingleIndexTest27() { await client.SearchSingleIndexAsync( "indexName", @@ -4250,7 +4378,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "insidePolygon")] - public async Task SearchSingleIndexTest24() + public async Task SearchSingleIndexTest28() { await client.SearchSingleIndexAsync( "indexName", @@ -4290,7 +4418,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "optionalFilters")] - public async Task SearchSingleIndexTest25() + public async Task SearchSingleIndexTest29() { await client.SearchSingleIndexAsync( "indexName", @@ -4315,7 +4443,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "optionalFiltersMany")] - public async Task SearchSingleIndexTest26() + public async Task SearchSingleIndexTest30() { await client.SearchSingleIndexAsync( "indexName", @@ -4345,7 +4473,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "optionalFiltersSimple")] - public async Task SearchSingleIndexTest27() + public async Task SearchSingleIndexTest31() { await client.SearchSingleIndexAsync( "indexName", @@ -4374,7 +4502,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "restrictSearchableAttributes")] - public async Task SearchSingleIndexTest28() + public async Task SearchSingleIndexTest32() { await client.SearchSingleIndexAsync( "indexName", @@ -4394,7 +4522,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "getRankingInfo")] - public async Task SearchSingleIndexTest29() + public async Task SearchSingleIndexTest33() { await client.SearchSingleIndexAsync( "indexName", @@ -4412,7 +4540,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "clickAnalytics")] - public async Task SearchSingleIndexTest30() + public async Task SearchSingleIndexTest34() { await client.SearchSingleIndexAsync( "indexName", @@ -4430,7 +4558,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "clickAnalyticsUserToken")] - public async Task SearchSingleIndexTest31() + public async Task SearchSingleIndexTest35() { await client.SearchSingleIndexAsync( "indexName", @@ -4448,7 +4576,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "enablePersonalization")] - public async Task SearchSingleIndexTest32() + public async Task SearchSingleIndexTest36() { await client.SearchSingleIndexAsync( "indexName", @@ -4468,7 +4596,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "userToken")] - public async Task SearchSingleIndexTest33() + public async Task SearchSingleIndexTest37() { await client.SearchSingleIndexAsync( "indexName", @@ -4485,8 +4613,26 @@ await client.SearchSingleIndexAsync( ); } + [Fact(DisplayName = "userToken1234")] + public async Task SearchSingleIndexTest38() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", UserToken = "user-1234" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"userToken\":\"user-1234\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + [Fact(DisplayName = "analyticsTag")] - public async Task SearchSingleIndexTest34() + public async Task SearchSingleIndexTest39() { await client.SearchSingleIndexAsync( "indexName", @@ -4506,7 +4652,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "facetFiltersUsers")] - public async Task SearchSingleIndexTest35() + public async Task SearchSingleIndexTest40() { await client.SearchSingleIndexAsync( "indexName", @@ -4535,7 +4681,7 @@ await client.SearchSingleIndexAsync( } [Fact(DisplayName = "buildTheQuery")] - public async Task SearchSingleIndexTest36() + public async Task SearchSingleIndexTest41() { await client.SearchSingleIndexAsync( "indexName", @@ -4559,716 +4705,4058 @@ await client.SearchSingleIndexAsync( ); } - [Fact(DisplayName = "searchSynonyms with minimal parameters")] - public async Task SearchSynonymsTest() + [Fact(DisplayName = "attributesToHighlightOverride")] + public async Task SearchSingleIndexTest42() { - await client.SearchSynonymsAsync("indexName"); + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToHighlight = new List { "title", "content" }, + } + ) + ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/indexName/synonyms/search", req.Path); + Assert.Equal("/1/indexes/indexName/query", req.Path); Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{}", req.Body, new JsonDiffConfig(false)); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"attributesToHighlight\":[\"title\",\"content\"]}", + req.Body, + new JsonDiffConfig(false) + ); } - [Fact(DisplayName = "searchSynonyms with all parameters")] - public async Task SearchSynonymsTest1() + [Fact(DisplayName = "disableTypoToleranceOnAttributes")] + public async Task SearchSingleIndexTest43() { - await client.SearchSynonymsAsync( + await client.SearchSingleIndexAsync( "indexName", - new SearchSynonymsParams - { - Query = "myQuery", - Type = Enum.Parse("Altcorrection1"), - Page = 10, - HitsPerPage = 10, - } + new SearchParams( + new SearchParamsObject + { + Query = "query", + DisableTypoToleranceOnAttributes = new List { "serial_number" }, + } + ) ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/indexName/synonyms/search", req.Path); + Assert.Equal("/1/indexes/indexName/query", req.Path); Assert.Equal("POST", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}", + "{\"query\":\"query\",\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchUserIds")] - public async Task SearchUserIdsTest() + [Fact(DisplayName = "search_a_query")] + public async Task SearchSingleIndexTest44() { - await client.SearchUserIdsAsync( - new SearchUserIdsParams - { - Query = "test", - ClusterName = "theClusterName", - Page = 5, - HitsPerPage = 10, - } + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "shirt" }) ); var req = _echo.LastResponse; - Assert.Equal("/1/clusters/mapping/search", req.Path); + Assert.Equal("/1/indexes/indexName/query", req.Path); Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault( - "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}", - req.Body, - new JsonDiffConfig(false) + JsonAssert.EqualOverrideDefault("{\"query\":\"shirt\"}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "search_everything")] + public async Task SearchSingleIndexTest45() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "" }) ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"query\":\"\"}", req.Body, new JsonDiffConfig(false)); } - [Fact(DisplayName = "get setDictionarySettings results with minimal parameters")] - public async Task SetDictionarySettingsTest() + [Fact(DisplayName = "api_filtering_range_example")] + public async Task SearchSingleIndexTest46() { - await client.SetDictionarySettingsAsync( - new DictionarySettingsParams - { - DisableStandardEntries = new StandardEntries - { - Plurals = new Dictionary - { - { "fr", false }, - { "en", false }, - { "ru", true }, - }, - }, - } + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "books", Filters = "price:10 TO 20" }) ); var req = _echo.LastResponse; - Assert.Equal("/1/dictionaries/*/settings", req.Path); - Assert.Equal("PUT", req.Method.ToString()); + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}", + "{\"query\":\"books\",\"filters\":\"price:10 TO 20\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "get setDictionarySettings results with all parameters")] - public async Task SetDictionarySettingsTest1() + [Fact(DisplayName = "search_a_query")] + public async Task SearchSingleIndexTest47() { - await client.SetDictionarySettingsAsync( - new DictionarySettingsParams - { - DisableStandardEntries = new StandardEntries + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "", + SimilarQuery = "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + Filters = "year:1991 TO 2001", + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"\",\"similarQuery\":\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\"filters\":\"year:1991 TO 2001\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_retrievable_attributes")] + public async Task SearchSingleIndexTest48() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToRetrieve = new List { "title", "content" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"attributesToRetrieve\":[\"title\",\"content\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "restrict_searchable_attributes")] + public async Task SearchSingleIndexTest49() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RestrictSearchableAttributes = new List { "title", "author" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"restrictSearchableAttributes\":[\"title\",\"author\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_relevancy")] + public async Task SearchSingleIndexTest50() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", RelevancyStrictness = 70 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"relevancyStrictness\":70}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_filters")] + public async Task SearchSingleIndexTest51() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Filters = "(category:Book OR category:Ebook) AND _tags:published", + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"filters\":\"(category:Book OR category:Ebook) AND _tags:published\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_all_filters")] + public async Task SearchSingleIndexTest52() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + 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\"", + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"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\\\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "escape_spaces")] + public async Task SearchSingleIndexTest53() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "category:\"Books and Comics\"" } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"filters\":\"category:\\\"Books and Comics\\\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "escape_keywords")] + public async Task SearchSingleIndexTest54() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Filters = "keyword:\"OR\"" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"filters\":\"keyword:\\\"OR\\\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "escape_single_quotes")] + public async Task SearchSingleIndexTest55() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "content:\"It's a wonderful day\"" } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"filters\":\"content:\\\"It's a wonderful day\\\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "escape_double_quotes")] + public async Task SearchSingleIndexTest56() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", Filters = "content:\"She said \"Hello World\"" } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"filters\":\"content:\\\"She said \\\"Hello World\\\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_filters")] + public async Task SearchSingleIndexTest57() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalFilters = new OptionalFilters( + new List + { + new OptionalFilters("category:Book"), + new OptionalFilters("author:John Doe"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:John Doe\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_negative_filters")] + public async Task SearchSingleIndexTest58() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalFilters = new OptionalFilters( + new List + { + new OptionalFilters("category:Book"), + new OptionalFilters("author:-John Doe"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:-John Doe\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_numeric_filters")] + public async Task SearchSingleIndexTest59() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + NumericFilters = new NumericFilters( + new List + { + new NumericFilters("price < 1000"), + new NumericFilters( + new List + { + new NumericFilters("inStock = 1"), + new NumericFilters("deliveryDate < 1441755506"), + } + ), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"numericFilters\":[\"price < 1000\",[\"inStock = 1\",\"deliveryDate < 1441755506\"]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_tag_filters")] + public async Task SearchSingleIndexTest60() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + TagFilters = new TagFilters( + new List + { + new TagFilters("SciFi"), + new TagFilters( + new List { new TagFilters("Book"), new TagFilters("Movie") } + ), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"tagFilters\":[\"SciFi\",[\"Book\",\"Movie\"]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "apply_filters")] + public async Task SearchSingleIndexTest61() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", SumOrFiltersScores = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"sumOrFiltersScores\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "facets_all")] + public async Task SearchSingleIndexTest62() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Facets = new List { "*" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facets\":[\"*\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "retrieve_only_some_facets")] + public async Task SearchSingleIndexTest63() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + Facets = new List { "category", "author" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facets\":[\"category\",\"author\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_max_values_per_facet")] + public async Task SearchSingleIndexTest64() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", MaxValuesPerFacet = 20 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"maxValuesPerFacet\":20}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_faceting_after_distinct")] + public async Task SearchSingleIndexTest65() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", FacetingAfterDistinct = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"facetingAfterDistinct\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "sort_facet_values_alphabetically")] + public async Task SearchSingleIndexTest66() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", SortFacetValuesBy = "count" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"sortFacetValuesBy\":\"count\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_attributes_to_snippet")] + public async Task SearchSingleIndexTest67() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AttributesToSnippet = new List { "title", "content:80" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"attributesToSnippet\":[\"title\",\"content:80\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_highlight_pre_tag")] + public async Task SearchSingleIndexTest68() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", HighlightPreTag = "" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"highlightPreTag\":\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_highlight_post_tag")] + public async Task SearchSingleIndexTest69() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", HighlightPostTag = "" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"highlightPostTag\":\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_snippet_ellipsis_text")] + public async Task SearchSingleIndexTest70() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", SnippetEllipsisText = "" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"snippetEllipsisText\":\"\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_restrict_highlight_and_snippet_arrays")] + public async Task SearchSingleIndexTest71() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", RestrictHighlightAndSnippetArrays = false } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"restrictHighlightAndSnippetArrays\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "access_page")] + public async Task SearchSingleIndexTest72() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Page = 0 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"page\":0}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_hits_per_page")] + public async Task SearchSingleIndexTest73() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", HitsPerPage = 10 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"hitsPerPage\":10}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "get_nth_hit")] + public async Task SearchSingleIndexTest74() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Offset = 4 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"offset\":4}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "get_n_results")] + public async Task SearchSingleIndexTest75() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Length = 4 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"length\":4}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_min_word_size_for_one_typo")] + public async Task SearchSingleIndexTest76() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", MinWordSizefor1Typo = 2 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"minWordSizefor1Typo\":2}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_min_word_size_for_two_typos")] + public async Task SearchSingleIndexTest77() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", MinWordSizefor2Typos = 2 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"minWordSizefor2Typos\":2}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_typo_tolerance_mode")] + public async Task SearchSingleIndexTest78() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", TypoTolerance = new TypoTolerance(false) } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"typoTolerance\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disable_typos_on_numeric_tokens_at_search_time")] + public async Task SearchSingleIndexTest79() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", AllowTyposOnNumericTokens = false } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"allowTyposOnNumericTokens\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_around_a_position")] + public async Task SearchSingleIndexTest80() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", AroundLatLng = "40.71, -74.01" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundLatLng\":\"40.71, -74.01\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_around_server_ip")] + public async Task SearchSingleIndexTest81() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", AroundLatLngViaIP = true }), + new RequestOptionBuilder() + .AddExtraHeader( + "x-forwarded-for", + "94.228.178.246 // should be replaced with the actual IP you would like to search around" + ) + .Build() + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundLatLngViaIP\":true}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedHeaders = JsonSerializer.Deserialize>( + "{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you would like to search around\"}" + ); + var actualHeaders = req.Headers; + foreach (var expectedHeader in expectedHeaders) + { + string actualHeaderValue; + actualHeaders.TryGetValue(expectedHeader.Key, out actualHeaderValue); + Assert.Equal(expectedHeader.Value, actualHeaderValue); + } + } + + [Fact(DisplayName = "set_around_radius")] + public async Task SearchSingleIndexTest82() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", AroundRadius = new AroundRadius(1000) } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundRadius\":1000}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disable_automatic_radius")] + public async Task SearchSingleIndexTest83() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AroundRadius = new AroundRadius(Enum.Parse("All")), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundRadius\":\"all\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_geo_search_precision")] + public async Task SearchSingleIndexTest84() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", AroundPrecision = new AroundPrecision(100) } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundPrecision\":100}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_geo_search_precision_non_linear")] + public async Task SearchSingleIndexTest85() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AroundPrecision = new AroundPrecision( + new List + { + new Range { From = 0, Value = 25 }, + new Range { From = 2000, Value = 1000 }, + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"aroundPrecision\":[{\"from\":0,\"value\":25},{\"from\":2000,\"value\":1000}]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_minimum_geo_search_radius")] + public async Task SearchSingleIndexTest86() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", MinimumAroundRadius = 1000 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"minimumAroundRadius\":1000}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_inside_rectangular_area")] + public async Task SearchSingleIndexTest87() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsideBoundingBox = new InsideBoundingBox( + new List> + { + new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 }, + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_inside_multiple_rectangular_areas")] + public async Task SearchSingleIndexTest88() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsideBoundingBox = new InsideBoundingBox( + new List> + { + new List { 46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625 }, + new List { 49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875 }, + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_inside_polygon_area")] + public async Task SearchSingleIndexTest89() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsidePolygon = new List> + { + new List + { + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + }, + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"insidePolygon\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "search_inside_multiple_polygon_areas")] + public async Task SearchSingleIndexTest90() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + InsidePolygon = new List> + { + new List + { + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + }, + new List + { + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625, + }, + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"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]]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_querylanguages_override")] + public async Task SearchSingleIndexTest91() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + IgnorePlurals = new IgnorePlurals( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"ignorePlurals\":[\"ca\",\"es\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_querylanguages_override")] + public async Task SearchSingleIndexTest92() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveStopWords = new RemoveStopWords( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_querylanguages_override")] + public async Task SearchSingleIndexTest93() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveStopWords = new RemoveStopWords( + new List + { + Enum.Parse("Ca"), + Enum.Parse("Es"), + } + ), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_querylanguages_with_japanese_query")] + public async Task SearchSingleIndexTest94() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + QueryLanguages = new List + { + Enum.Parse("Ja"), + Enum.Parse("En"), + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"queryLanguages\":[\"ja\",\"en\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_natural_languages")] + public async Task SearchSingleIndexTest95() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "", + NaturalLanguages = new List { Enum.Parse("Fr") }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"\",\"naturalLanguages\":[\"fr\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_natural_languages_with_query")] + public async Task SearchSingleIndexTest96() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "", + NaturalLanguages = new List { Enum.Parse("Fr") }, + RemoveWordsIfNoResults = Enum.Parse("FirstWords"), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"\",\"naturalLanguages\":[\"fr\"],\"removeWordsIfNoResults\":\"firstWords\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_decompound_query_search_time")] + public async Task SearchSingleIndexTest97() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", DecompoundQuery = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"decompoundQuery\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_rules_search_time")] + public async Task SearchSingleIndexTest98() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", EnableRules = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enableRules\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_rule_contexts")] + public async Task SearchSingleIndexTest99() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RuleContexts = new List { "front_end", "website2" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"ruleContexts\":[\"front_end\",\"website2\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_personalization")] + public async Task SearchSingleIndexTest100() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", EnablePersonalization = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enablePersonalization\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_personalization_with_user_token")] + public async Task SearchSingleIndexTest101() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + EnablePersonalization = true, + UserToken = "123456", + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "personalization_impact")] + public async Task SearchSingleIndexTest102() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", PersonalizationImpact = 20 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"personalizationImpact\":20}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_user_token")] + public async Task SearchSingleIndexTest103() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", UserToken = "123456" }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"userToken\":\"123456\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_user_token_with_personalization")] + public async Task SearchSingleIndexTest104() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + EnablePersonalization = true, + UserToken = "123456", + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_query_type")] + public async Task SearchSingleIndexTest105() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", QueryType = Enum.Parse("PrefixAll") } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"queryType\":\"prefixAll\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_remove_words_if_no_results")] + public async Task SearchSingleIndexTest106() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + RemoveWordsIfNoResults = Enum.Parse("LastWords"), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"removeWordsIfNoResults\":\"lastWords\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_advanced_syntax_search_time")] + public async Task SearchSingleIndexTest107() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", AdvancedSyntax = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"advancedSyntax\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "overide_default_optional_words")] + public async Task SearchSingleIndexTest108() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + OptionalWords = new OptionalWords(new List { "toyota", "2020 2021" }), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"optionalWords\":[\"toyota\",\"2020 2021\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disabling_exact_for_some_attributes_search_time")] + public async Task SearchSingleIndexTest109() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + DisableExactOnAttributes = new List { "description" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"disableExactOnAttributes\":[\"description\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_exact_single_word_query")] + public async Task SearchSingleIndexTest110() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + ExactOnSingleWordQuery = Enum.Parse("None"), + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"exactOnSingleWordQuery\":\"none\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_aternative_as_exact")] + public async Task SearchSingleIndexTest111() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AlternativesAsExact = new List + { + Enum.Parse("MultiWordsSynonym"), + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"alternativesAsExact\":[\"multiWordsSynonym\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_advanced_syntax_exact_phrase")] + public async Task SearchSingleIndexTest112() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExactPhrase"), + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_advanced_syntax_exclude_words")] + public async Task SearchSingleIndexTest113() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExcludeWords"), + }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"excludeWords\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_distinct")] + public async Task SearchSingleIndexTest114() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Distinct = new Distinct(0) }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"distinct\":0}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "get_ranking_info")] + public async Task SearchSingleIndexTest115() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", GetRankingInfo = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"getRankingInfo\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disable_click_analytics")] + public async Task SearchSingleIndexTest116() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", ClickAnalytics = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"clickAnalytics\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "enable_click_analytics")] + public async Task SearchSingleIndexTest117() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", ClickAnalytics = true }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"clickAnalytics\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disable_analytics")] + public async Task SearchSingleIndexTest118() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Analytics = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"analytics\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "add_analytics_tags")] + public async Task SearchSingleIndexTest119() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + AnalyticsTags = new List { "front_end", "website2" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"analyticsTags\":[\"front_end\",\"website2\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disable_synonyms")] + public async Task SearchSingleIndexTest120() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", Synonyms = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"synonyms\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_replace_synonyms_in_highlights")] + public async Task SearchSingleIndexTest121() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject { Query = "query", ReplaceSynonymsInHighlight = true } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"replaceSynonymsInHighlight\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_min_proximity")] + public async Task SearchSingleIndexTest122() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", MinProximity = 2 }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"minProximity\":2}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_default_field")] + public async Task SearchSingleIndexTest123() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams( + new SearchParamsObject + { + Query = "query", + ResponseFields = new List { "hits", "facets" }, + } + ) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"responseFields\":[\"hits\",\"facets\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "override_percentile_computation")] + public async Task SearchSingleIndexTest124() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", PercentileComputation = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"percentileComputation\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_ab_test")] + public async Task SearchSingleIndexTest125() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", EnableABTest = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enableABTest\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_enable_re_ranking")] + public async Task SearchSingleIndexTest126() + { + await client.SearchSingleIndexAsync( + "indexName", + new SearchParams(new SearchParamsObject { Query = "query", EnableReRanking = false }) + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/query", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"query\",\"enableReRanking\":false}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchSynonyms with minimal parameters")] + public async Task SearchSynonymsTest() + { + await client.SearchSynonymsAsync("indexName"); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/synonyms/search", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "searchSynonyms with all parameters")] + public async Task SearchSynonymsTest1() + { + await client.SearchSynonymsAsync( + "indexName", + new SearchSynonymsParams + { + Query = "myQuery", + Type = Enum.Parse("Altcorrection1"), + Page = 10, + HitsPerPage = 10, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/indexName/synonyms/search", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchUserIds")] + public async Task SearchUserIdsTest() + { + await client.SearchUserIdsAsync( + new SearchUserIdsParams + { + Query = "test", + ClusterName = "theClusterName", + Page = 5, + HitsPerPage = 10, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/clusters/mapping/search", req.Path); + Assert.Equal("POST", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "get setDictionarySettings results with minimal parameters")] + public async Task SetDictionarySettingsTest() + { + await client.SetDictionarySettingsAsync( + new DictionarySettingsParams + { + DisableStandardEntries = new StandardEntries + { + Plurals = new Dictionary + { + { "fr", false }, + { "en", false }, + { "ru", true }, + }, + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/dictionaries/*/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "get setDictionarySettings results with all parameters")] + public async Task SetDictionarySettingsTest1() + { + await client.SetDictionarySettingsAsync( + new DictionarySettingsParams + { + DisableStandardEntries = new StandardEntries + { + Plurals = new Dictionary + { + { "fr", false }, + { "en", false }, + { "ru", true }, + }, + Stopwords = new Dictionary { { "fr", false } }, + Compounds = new Dictionary { { "ru", true } }, + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/dictionaries/*/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "minimal parameters")] + public async Task SetSettingsTest() + { + await client.SetSettingsAsync( + "cts_e2e_settings", + new IndexSettings { PaginationLimitedTo = 10 }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/cts_e2e_settings/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"paginationLimitedTo\":10}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "boolean typoTolerance")] + public async Task SetSettingsTest1() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { TypoTolerance = new TypoTolerance(true) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"typoTolerance\":true}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "enum typoTolerance")] + public async Task SetSettingsTest2() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { TypoTolerance = new TypoTolerance(Enum.Parse("Min")) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"typoTolerance\":\"min\"}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "ignorePlurals")] + public async Task SetSettingsTest3() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { IgnorePlurals = new IgnorePlurals(true) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"ignorePlurals\":true}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "list of string ignorePlurals")] + public async Task SetSettingsTest4() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + IgnorePlurals = new IgnorePlurals( + new List { Enum.Parse("Fr") } + ), + }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"ignorePlurals\":[\"fr\"]}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "removeStopWords boolean")] + public async Task SetSettingsTest5() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { RemoveStopWords = new RemoveStopWords(true) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"removeStopWords\":true}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "removeStopWords list of string")] + public async Task SetSettingsTest6() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + RemoveStopWords = new RemoveStopWords( + new List { Enum.Parse("Fr") } + ), + }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"removeStopWords\":[\"fr\"]}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "boolean distinct")] + public async Task SetSettingsTest7() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Distinct = new Distinct(true) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"distinct\":true}", req.Body, new JsonDiffConfig(false)); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "integer distinct")] + public async Task SetSettingsTest8() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Distinct = new Distinct(1) }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"distinct\":1}", req.Body, new JsonDiffConfig(false)); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "distinct company")] + public async Task SetSettingsTest9() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { AttributeForDistinct = "company", Distinct = new Distinct(true) } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributeForDistinct\":\"company\",\"distinct\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "distinct design")] + public async Task SetSettingsTest10() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { AttributeForDistinct = "design", Distinct = new Distinct(true) } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributeForDistinct\":\"design\",\"distinct\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "distinct true")] + public async Task SetSettingsTest11() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Distinct = new Distinct(true) } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"distinct\":true}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "distinct section")] + public async Task SetSettingsTest12() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { AttributeForDistinct = "section", Distinct = new Distinct(true) } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributeForDistinct\":\"section\",\"distinct\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting allergens")] + public async Task SetSettingsTest13() + { + await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "allergens" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"allergens\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "api_attributes_for_faceting")] + public async Task SetSettingsTest14() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "genre", "author" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"genre\",\"author\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "api_attributes_for_faceting_searchable")] + public async Task SetSettingsTest15() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "genre", "searchable(author)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"genre\",\"searchable(author)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "api_attributes_for_filter_only")] + public async Task SetSettingsTest16() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "filterOnly(genre)", "author" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"filterOnly(genre)\",\"author\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting categoryPageId")] + public async Task SetSettingsTest17() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "searchable(categoryPageId)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "unretrievableAttributes")] + public async Task SetSettingsTest18() + { + await client.SetSettingsAsync( + "", + new IndexSettings { UnretrievableAttributes = new List { "visible_by" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"unretrievableAttributes\":[\"visible_by\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting user restricted data")] + public async Task SetSettingsTest19() + { + await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "filterOnly(visible_by)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting optional filters")] + public async Task SetSettingsTest20() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List { "can_deliver_quickly", "restaurant" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting redirect index")] + public async Task SetSettingsTest21() + { + await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "query_terms" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"query_terms\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting multiple consequences")] + public async Task SetSettingsTest22() + { + await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "director" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"director\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesForFaceting in-depth optional filters")] + public async Task SetSettingsTest23() + { + await client.SetSettingsAsync( + "", + new IndexSettings { AttributesForFaceting = new List { "filterOnly(brand)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"filterOnly(brand)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "mode neuralSearch")] + public async Task SetSettingsTest24() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Mode = Enum.Parse("NeuralSearch") } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"mode\":\"neuralSearch\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "mode keywordSearch")] + public async Task SetSettingsTest25() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Mode = Enum.Parse("KeywordSearch") } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"mode\":\"keywordSearch\"}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchableAttributes same priority")] + public async Task SetSettingsTest26() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "title,comments", "ingredients" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchableAttributes higher priority")] + public async Task SetSettingsTest27() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "title", "ingredients" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"title\",\"ingredients\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking retweets")] + public async Task SetSettingsTest28() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "desc(retweets)", "desc(likes)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking boosted")] + public async Task SetSettingsTest29() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { CustomRanking = new List { "desc(boosted)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(boosted)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking pageviews")] + public async Task SetSettingsTest30() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "desc(pageviews)", "desc(comments)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking applying search parameters for a specific query")] + public async Task SetSettingsTest31() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "desc(nb_airline_liaisons)" }, + AttributesForFaceting = new List { "city, country" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking rounded pageviews")] + public async Task SetSettingsTest32() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "desc(rounded_pageviews)", "desc(comments)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking price")] + public async Task SetSettingsTest33() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { CustomRanking = new List { "desc(price)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(price)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "ranking exhaustive")] + public async Task SetSettingsTest34() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + Ranking = new List + { + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "ranking standard replica")] + public async Task SetSettingsTest35() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Ranking = new List { "desc(post_date_timestamp)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"ranking\":[\"desc(post_date_timestamp)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "ranking virtual replica")] + public async Task SetSettingsTest36() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { CustomRanking = new List { "desc(post_date_timestamp)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"desc(post_date_timestamp)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "customRanking and ranking sort alphabetically")] + public async Task SetSettingsTest37() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "asc(textual_attribute)" }, + Ranking = new List + { + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "relevancyStrictness")] + public async Task SetSettingsTest38() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + CustomRanking = new List { "asc(textual_attribute)" }, + RelevancyStrictness = 0, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "create replica index")] + public async Task SetSettingsTest39() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Replicas = new List { "products_price_desc" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"replicas\":[\"products_price_desc\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "create replica index articles")] + public async Task SetSettingsTest40() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Replicas = new List { "articles_date_desc" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"replicas\":[\"articles_date_desc\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "create virtual replica index")] + public async Task SetSettingsTest41() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Replicas = new List { "virtual(products_price_desc)" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"replicas\":[\"virtual(products_price_desc)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "unlink replica index")] + public async Task SetSettingsTest42() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { Replicas = new List { "" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"replicas\":[\"\"]}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "forwardToReplicas")] + public async Task SetSettingsTest43() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "name", "description" }, + }, + true + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"name\",\"description\"]}", + req.Body, + new JsonDiffConfig(false) + ); + var expectedQuery = JsonSerializer.Deserialize>( + "{\"forwardToReplicas\":\"true\"}" + ); + Assert.NotNull(expectedQuery); + + var actualQuery = req.QueryParameters; + Assert.Equal(expectedQuery.Count, actualQuery.Count); + + foreach (var actual in actualQuery) + { + expectedQuery.TryGetValue(actual.Key, out var expected); + Assert.Equal(expected, actual.Value); + } + } + + [Fact(DisplayName = "maxValuesPerFacet")] + public async Task SetSettingsTest44() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxValuesPerFacet = 1000 }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"maxValuesPerFacet\":1000}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "maxFacetHits")] + public async Task SetSettingsTest45() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxFacetHits = 1000 }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"maxFacetHits\":1000}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "attributesForFaceting complex")] + public async Task SetSettingsTest46() + { + await client.SetSettingsAsync( + "", + new IndexSettings + { + AttributesForFaceting = new List + { + "actor", + "filterOnly(category)", + "searchable(publisher)", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "ranking closest dates")] + public async Task SetSettingsTest47() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + Ranking = new List + { + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchableAttributes item variation")] + public async Task SetSettingsTest48() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "design", "type", "color" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchableAttributes around location")] + public async Task SetSettingsTest49() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "name", "country", "code", "iata_code" }, + CustomRanking = new List { "desc(links_count)" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesToHighlight")] + public async Task SetSettingsTest50() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + AttributesToHighlight = new List { "author", "title", "content" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesToHighlight\":[\"author\",\"title\",\"content\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "attributesToHighlightStar")] + public async Task SetSettingsTest51() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { AttributesToHighlight = new List { "*" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesToHighlight\":[\"*\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "everything")] + public async Task SetSettingsTest52() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + AdvancedSyntax = true, + AdvancedSyntaxFeatures = new List + { + Enum.Parse("ExactPhrase"), + }, + AllowCompressionOfIntegerArray = true, + AllowTyposOnNumericTokens = true, + AlternativesAsExact = new List + { + Enum.Parse("SingleWordSynonym"), + }, + AttributeCriteriaComputedByMinProximity = true, + AttributeForDistinct = "test", + AttributesForFaceting = new List { "algolia" }, + AttributesToHighlight = new List { "algolia" }, + AttributesToRetrieve = new List { "algolia" }, + AttributesToSnippet = new List { "algolia" }, + AttributesToTransliterate = new List { "algolia" }, + CamelCaseAttributes = new List { "algolia" }, + CustomNormalization = new Dictionary> + { + { + "algolia", + new Dictionary { { "aloglia", "aglolia" } } + }, + }, + CustomRanking = new List { "algolia" }, + DecompoundQuery = false, + DecompoundedAttributes = new Dictionary { { "algolia", "aloglia" } }, + DisableExactOnAttributes = new List { "algolia" }, + DisablePrefixOnAttributes = new List { "algolia" }, + DisableTypoToleranceOnAttributes = new List { "algolia" }, + DisableTypoToleranceOnWords = new List { "algolia" }, + Distinct = new Distinct(3), + EnablePersonalization = true, + EnableReRanking = false, + EnableRules = true, + ExactOnSingleWordQuery = Enum.Parse("Attribute"), + HighlightPreTag = "", + HighlightPostTag = "", + HitsPerPage = 10, + IgnorePlurals = new IgnorePlurals(false), + IndexLanguages = new List { Enum.Parse("Fr") }, + KeepDiacriticsOnCharacters = "abc", + MaxFacetHits = 20, + MaxValuesPerFacet = 30, + MinProximity = 6, + MinWordSizefor1Typo = 5, + MinWordSizefor2Typos = 11, + Mode = Enum.Parse("NeuralSearch"), + NumericAttributesForFiltering = new List { "algolia" }, + OptionalWords = new OptionalWords(new List { "myspace" }), + PaginationLimitedTo = 0, + QueryLanguages = new List { Enum.Parse("Fr") }, + QueryType = Enum.Parse("PrefixLast"), + Ranking = new List { "geo" }, + ReRankingApplyFilter = new ReRankingApplyFilter("mySearch:filters"), + RelevancyStrictness = 10, + RemoveStopWords = new RemoveStopWords(false), + RemoveWordsIfNoResults = Enum.Parse("LastWords"), + RenderingContent = new RenderingContent + { + FacetOrdering = new FacetOrdering + { + Facets = new Facets + { + Order = new List { "a", "b" }, + }, + Values = new Dictionary + { + { + "a", + new Value + { + Order = new List { "b" }, + SortRemainingBy = Enum.Parse("Count"), + } + }, + }, + }, + }, + ReplaceSynonymsInHighlight = true, + Replicas = new List { "" }, + ResponseFields = new List { "algolia" }, + RestrictHighlightAndSnippetArrays = true, + SearchableAttributes = new List { "foo" }, + SemanticSearch = new SemanticSearch { EventSources = new List { "foo" } }, + SeparatorsToIndex = "bar", + SnippetEllipsisText = "---", + SortFacetValuesBy = "date", + TypoTolerance = new TypoTolerance(false), + UnretrievableAttributes = new List { "foo" }, + UserData = new Dictionary { { "user", "data" } }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "searchableAttributesWithCustomRankingsAndAttributesForFaceting")] + public async Task SetSettingsTest53() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { - Plurals = new Dictionary - { - { "fr", false }, - { "en", false }, - { "ru", true }, - }, - Stopwords = new Dictionary { { "fr", false } }, - Compounds = new Dictionary { { "ru", true } }, + "brand", + "name", + "categories", + "unordered(description)", + }, + CustomRanking = new List { "desc(popularity)" }, + AttributesForFaceting = new List + { + "searchable(brand)", + "type", + "categories", + "price", }, } ); var req = _echo.LastResponse; - Assert.Equal("/1/dictionaries/*/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}", + "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "minimal parameters")] - public async Task SetSettingsTest() + [Fact(DisplayName = "searchableAttributesOrdering")] + public async Task SetSettingsTest54() { await client.SetSettingsAsync( - "cts_e2e_settings", - new IndexSettings { PaginationLimitedTo = 10 }, - true + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List { "unordered(title)", "cast" }, + } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/cts_e2e_settings/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"paginationLimitedTo\":10}", + "{\"searchableAttributes\":[\"unordered(title)\",\"cast\"]}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" + } + + [Fact(DisplayName = "searchableAttributesProductReferenceSuffixes")] + public async Task SetSettingsTest55() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List + { + "name", + "product_reference", + "product_reference_suffixes", + }, + } ); - Assert.NotNull(expectedQuery); - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } + [Fact(DisplayName = "queryLanguageAndIgnorePlurals")] + public async Task SetSettingsTest56() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + QueryLanguages = new List { Enum.Parse("En") }, + IgnorePlurals = new IgnorePlurals(true), + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}", + req.Body, + new JsonDiffConfig(false) + ); } - [Fact(DisplayName = "boolean typoTolerance")] - public async Task SetSettingsTest1() + [Fact(DisplayName = "searchableAttributesInMovies")] + public async Task SetSettingsTest57() + { + await client.SetSettingsAsync( + "movies", + new IndexSettings + { + SearchableAttributes = new List { "title_eng", "title_fr", "title_es" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/movies/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "disablePrefixOnAttributes")] + public async Task SetSettingsTest58() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { TypoTolerance = new TypoTolerance(true) }, - true + new IndexSettings { DisablePrefixOnAttributes = new List { "serial_number" } } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"typoTolerance\":true}", + "{\"disablePrefixOnAttributes\":[\"serial_number\"]}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" + } + + [Fact(DisplayName = "disableTypoToleranceOnAttributes")] + public async Task SetSettingsTest59() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } ); - Assert.NotNull(expectedQuery); - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } + [Fact(DisplayName = "searchableAttributesSimpleExample")] + public async Task SetSettingsTest60() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { SearchableAttributes = new List { "serial_number" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"serial_number\"]}", + req.Body, + new JsonDiffConfig(false) + ); } - [Fact(DisplayName = "enum typoTolerance")] - public async Task SetSettingsTest2() + [Fact(DisplayName = "searchableAttributesSimpleExampleAlt")] + public async Task SetSettingsTest61() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { TypoTolerance = new TypoTolerance(Enum.Parse("Min")) }, - true + new IndexSettings + { + SearchableAttributes = new List { "serial_number", "serial_number_suffixes" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_searchable_attributes")] + public async Task SetSettingsTest62() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + SearchableAttributes = new List + { + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"searchableAttributes\":[\"title,alternative_title\",\"author\",\"unordered(text)\",\"emails.personal\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_searchable_attributes")] + public async Task SetSettingsTest63() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + AttributesForFaceting = new List + { + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesForFaceting\":[\"author\",\"filterOnly(isbn)\",\"searchable(edition)\",\"afterDistinct(category)\",\"afterDistinct(searchable(publisher))\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "unretrievable_attributes")] + public async Task SetSettingsTest64() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { UnretrievableAttributes = new List { "total_number_of_sales" } } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"unretrievableAttributes\":[\"total_number_of_sales\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_retrievable_attributes")] + public async Task SetSettingsTest65() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + AttributesToRetrieve = new List { "author", "title", "content" }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"attributesToRetrieve\":[\"author\",\"title\",\"content\"]}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_all_attributes_as_retrievable")] + public async Task SetSettingsTest66() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { AttributesToRetrieve = new List { "*" } } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"typoTolerance\":\"min\"}", + "{\"attributesToRetrieve\":[\"*\"]}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "ignorePlurals")] - public async Task SetSettingsTest3() + [Fact(DisplayName = "specify_attributes_not_to_retrieve")] + public async Task SetSettingsTest67() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { IgnorePlurals = new IgnorePlurals(true) }, - true + new IndexSettings + { + AttributesToRetrieve = new List { "*", "-SKU", "-internal_desc" }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"ignorePlurals\":true}", + "{\"attributesToRetrieve\":[\"*\",\"-SKU\",\"-internal_desc\"]}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "list of string ignorePlurals")] - public async Task SetSettingsTest4() + [Fact(DisplayName = "neural_search")] + public async Task SetSettingsTest68() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - IgnorePlurals = new IgnorePlurals( - new List { Enum.Parse("Fr") } - ), - }, - true + new IndexSettings { Mode = Enum.Parse("NeuralSearch") } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"ignorePlurals\":[\"fr\"]}", + "{\"mode\":\"neuralSearch\"}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "removeStopWords boolean")] - public async Task SetSettingsTest5() + [Fact(DisplayName = "keyword_search")] + public async Task SetSettingsTest69() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { RemoveStopWords = new RemoveStopWords(true) }, - true + new IndexSettings { Mode = Enum.Parse("KeywordSearch") } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"removeStopWords\":true}", + "{\"mode\":\"keywordSearch\"}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "removeStopWords list of string")] - public async Task SetSettingsTest6() + [Fact(DisplayName = "set_default_ranking")] + public async Task SetSettingsTest70() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - RemoveStopWords = new RemoveStopWords( - new List { Enum.Parse("Fr") } - ), - }, - true + Ranking = new List + { + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"removeStopWords\":[\"fr\"]}", + "{\"ranking\":[\"typo\",\"geo\",\"words\",\"filters\",\"attribute\",\"proximity\",\"exact\",\"custom\"]}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "boolean distinct")] - public async Task SetSettingsTest7() + [Fact(DisplayName = "set_ranking_by_attribute_asc")] + public async Task SetSettingsTest71() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { Distinct = new Distinct(true) }, - true + new IndexSettings + { + Ranking = new List + { + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"distinct\":true}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" + JsonAssert.EqualOverrideDefault( + "{\"ranking\":[\"asc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.Body, + new JsonDiffConfig(false) ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "integer distinct")] - public async Task SetSettingsTest8() + [Fact(DisplayName = "set_ranking_by_attribute_desc")] + public async Task SetSettingsTest72() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { Distinct = new Distinct(1) }, - true + new IndexSettings + { + Ranking = new List + { + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"distinct\":1}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" + JsonAssert.EqualOverrideDefault( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.Body, + new JsonDiffConfig(false) ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "distinct company")] - public async Task SetSettingsTest9() + [Fact(DisplayName = "restrict_searchable_attributes")] + public async Task SetSettingsTest73() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { AttributeForDistinct = "company", Distinct = new Distinct(true) } + new IndexSettings + { + CustomRanking = new List { "desc(popularity)", "asc(price)" }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributeForDistinct\":\"company\",\"distinct\":true}", + "{\"customRanking\":[\"desc(popularity)\",\"asc(price)\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "distinct design")] - public async Task SetSettingsTest10() + [Fact(DisplayName = "set_default_relevancy")] + public async Task SetSettingsTest74() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { AttributeForDistinct = "design", Distinct = new Distinct(true) } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { RelevancyStrictness = 90 }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributeForDistinct\":\"design\",\"distinct\":true}", + "{\"relevancyStrictness\":90}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "distinct true")] - public async Task SetSettingsTest11() + [Fact(DisplayName = "set_replicas")] + public async Task SetSettingsTest75() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { Distinct = new Distinct(true) } + new IndexSettings + { + Replicas = new List { "name_of_replica_index1", "name_of_replica_index2" }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"distinct\":true}", req.Body, new JsonDiffConfig(false)); + JsonAssert.EqualOverrideDefault( + "{\"replicas\":[\"name_of_replica_index1\",\"name_of_replica_index2\"]}", + req.Body, + new JsonDiffConfig(false) + ); } - [Fact(DisplayName = "distinct section")] - public async Task SetSettingsTest12() + [Fact(DisplayName = "set_default_max_values_per_facet")] + public async Task SetSettingsTest76() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { AttributeForDistinct = "section", Distinct = new Distinct(true) } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxValuesPerFacet = 100 }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributeForDistinct\":\"section\",\"distinct\":true}", + "{\"maxValuesPerFacet\":100}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting allergens")] - public async Task SetSettingsTest13() + [Fact(DisplayName = "set_default_sort_facet_values_by")] + public async Task SetSettingsTest77() { await client.SetSettingsAsync( - "", - new IndexSettings { AttributesForFaceting = new List { "allergens" } } + "theIndexName", + new IndexSettings { SortFacetValuesBy = "alpha" } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"allergens\"]}", + "{\"sortFacetValuesBy\":\"alpha\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting categoryPageId")] - public async Task SetSettingsTest14() + [Fact(DisplayName = "set_attributes_to_snippet")] + public async Task SetSettingsTest78() { await client.SetSettingsAsync( - "", + "theIndexName", new IndexSettings { - AttributesForFaceting = new List { "searchable(categoryPageId)" }, + AttributesToSnippet = new List { "content:80", "description" }, } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}", + "{\"attributesToSnippet\":[\"content:80\",\"description\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "unretrievableAttributes")] - public async Task SetSettingsTest15() + [Fact(DisplayName = "set_all_attributes_to_snippet")] + public async Task SetSettingsTest79() { await client.SetSettingsAsync( - "", - new IndexSettings { UnretrievableAttributes = new List { "visible_by" } } + "theIndexName", + new IndexSettings { AttributesToSnippet = new List { "*:80" } } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"unretrievableAttributes\":[\"visible_by\"]}", + "{\"attributesToSnippet\":[\"*:80\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting user restricted data")] - public async Task SetSettingsTest16() + [Fact(DisplayName = "set_default_highlight_pre_tag")] + public async Task SetSettingsTest80() { - await client.SetSettingsAsync( - "", - new IndexSettings { AttributesForFaceting = new List { "filterOnly(visible_by)" } } + await client.SetSettingsAsync("theIndexName", new IndexSettings { HighlightPreTag = "" }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"highlightPreTag\":\"\"}", + req.Body, + new JsonDiffConfig(false) ); + } + + [Fact(DisplayName = "set_default_highlight_post_tag")] + public async Task SetSettingsTest81() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { HighlightPostTag = "" }); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}", + "{\"highlightPostTag\":\"\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting optional filters")] - public async Task SetSettingsTest17() + [Fact(DisplayName = "set_default_snippet_ellipsis_text")] + public async Task SetSettingsTest82() { - await client.SetSettingsAsync( - "", - new IndexSettings - { - AttributesForFaceting = new List { "can_deliver_quickly", "restaurant" }, - } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { SnippetEllipsisText = "…" }); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}", + "{\"snippetEllipsisText\":\"…\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting redirect index")] - public async Task SetSettingsTest18() + [Fact(DisplayName = "enable_restrict_highlight_and_snippet_arrays_by_default")] + public async Task SetSettingsTest83() { await client.SetSettingsAsync( - "", - new IndexSettings { AttributesForFaceting = new List { "query_terms" } } + "theIndexName", + new IndexSettings { RestrictHighlightAndSnippetArrays = true } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"query_terms\"]}", + "{\"restrictHighlightAndSnippetArrays\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "attributesForFaceting multiple consequences")] - public async Task SetSettingsTest19() + [Fact(DisplayName = "set_default_hits_per_page")] + public async Task SetSettingsTest84() { - await client.SetSettingsAsync( - "", - new IndexSettings { AttributesForFaceting = new List { "director" } } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { HitsPerPage = 20 }); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"director\"]}", - req.Body, - new JsonDiffConfig(false) - ); + JsonAssert.EqualOverrideDefault("{\"hitsPerPage\":20}", req.Body, new JsonDiffConfig(false)); } - [Fact(DisplayName = "attributesForFaceting in-depth optional filters")] - public async Task SetSettingsTest20() + [Fact(DisplayName = "set_pagination_limit")] + public async Task SetSettingsTest85() { - await client.SetSettingsAsync( - "", - new IndexSettings { AttributesForFaceting = new List { "filterOnly(brand)" } } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { PaginationLimitedTo = 1000 }); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"filterOnly(brand)\"]}", + "{\"paginationLimitedTo\":1000}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "mode neuralSearch")] - public async Task SetSettingsTest21() + [Fact(DisplayName = "set_default_min_word_size_for_one_typo")] + public async Task SetSettingsTest86() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { Mode = Enum.Parse("NeuralSearch") } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { MinWordSizefor1Typo = 4 }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"mode\":\"neuralSearch\"}", + "{\"minWordSizefor1Typo\":4}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "mode keywordSearch")] - public async Task SetSettingsTest22() + [Fact(DisplayName = "set_default_min_word_size_for_two_typos")] + public async Task SetSettingsTest87() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { Mode = Enum.Parse("KeywordSearch") } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { MinWordSizefor2Typos = 4 }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"mode\":\"keywordSearch\"}", + "{\"minWordSizefor2Typos\":4}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributes same priority")] - public async Task SetSettingsTest23() + [Fact(DisplayName = "set_default_typo_tolerance_mode")] + public async Task SetSettingsTest88() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List { "title,comments", "ingredients" }, - } + new IndexSettings { TypoTolerance = new TypoTolerance(true) } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}", + "{\"typoTolerance\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributes higher priority")] - public async Task SetSettingsTest24() + [Fact(DisplayName = "disable_typos_on_numeric_tokens_by_default")] + public async Task SetSettingsTest89() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List { "title", "ingredients" }, - } + new IndexSettings { AllowTyposOnNumericTokens = false } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"title\",\"ingredients\"]}", + "{\"allowTyposOnNumericTokens\":false}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking retweets")] - public async Task SetSettingsTest25() + [Fact(DisplayName = "disable_typo_tolerance_for_words")] + public async Task SetSettingsTest90() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "desc(retweets)", "desc(likes)" }, + DisableTypoToleranceOnWords = new List { "wheel", "1X2BCD" }, } ); @@ -5276,38 +8764,36 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}", + "{\"disableTypoToleranceOnWords\":[\"wheel\",\"1X2BCD\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking boosted")] - public async Task SetSettingsTest26() + [Fact(DisplayName = "set_separators_to_index")] + public async Task SetSettingsTest91() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { CustomRanking = new List { "desc(boosted)" } } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { SeparatorsToIndex = "+#" }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(boosted)\"]}", + "{\"separatorsToIndex\":\"+#\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking pageviews")] - public async Task SetSettingsTest27() + [Fact(DisplayName = "set_languages_using_querylanguages")] + public async Task SetSettingsTest92() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "desc(pageviews)", "desc(comments)" }, + QueryLanguages = new List { Enum.Parse("Es") }, + IgnorePlurals = new IgnorePlurals(true), } ); @@ -5315,21 +8801,21 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}", + "{\"queryLanguages\":[\"es\"],\"ignorePlurals\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking applying search parameters for a specific query")] - public async Task SetSettingsTest28() + [Fact(DisplayName = "set_attributes_to_transliterate")] + public async Task SetSettingsTest93() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "desc(nb_airline_liaisons)" }, - AttributesForFaceting = new List { "city, country" }, + IndexLanguages = new List { Enum.Parse("Ja") }, + AttributesToTransliterate = new List { "name", "description" }, } ); @@ -5337,20 +8823,21 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}", + "{\"indexLanguages\":[\"ja\"],\"attributesToTransliterate\":[\"name\",\"description\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking rounded pageviews")] - public async Task SetSettingsTest29() + [Fact(DisplayName = "set_languages_using_querylanguages")] + public async Task SetSettingsTest94() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "desc(rounded_pageviews)", "desc(comments)" }, + QueryLanguages = new List { Enum.Parse("Es") }, + RemoveStopWords = new RemoveStopWords(true), } ); @@ -5358,48 +8845,43 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}", + "{\"queryLanguages\":[\"es\"],\"removeStopWords\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking price")] - public async Task SetSettingsTest30() + [Fact(DisplayName = "set_camel_case_attributes")] + public async Task SetSettingsTest95() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { CustomRanking = new List { "desc(price)" } } + new IndexSettings { CamelCaseAttributes = new List { "description" } } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(price)\"]}", + "{\"camelCaseAttributes\":[\"description\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "ranking exhaustive")] - public async Task SetSettingsTest31() + [Fact(DisplayName = "set_decompounded_attributes")] + public async Task SetSettingsTest96() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - Ranking = new List + DecompoundedAttributes = new Dictionary> { - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + { + "de", + new List { "name" } + }, }, } ); @@ -5408,66 +8890,74 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + "{\"decompoundedAttributes\":{\"de\":[\"name\"]}}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "ranking standard replica")] - public async Task SetSettingsTest32() + [Fact(DisplayName = "set_decompounded_multiple_attributes")] + public async Task SetSettingsTest97() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { Ranking = new List { "desc(post_date_timestamp)" } } + new IndexSettings + { + DecompoundedAttributes = new Dictionary> + { + { + "de", + new List { "name_de", "description_de" } + }, + { + "fi", + new List { "name_fi", "description_fi" } + }, + }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"ranking\":[\"desc(post_date_timestamp)\"]}", + "{\"decompoundedAttributes\":{\"de\":[\"name_de\",\"description_de\"],\"fi\":[\"name_fi\",\"description_fi\"]}}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "ranking virtual replica")] - public async Task SetSettingsTest33() + [Fact(DisplayName = "set_keep_diacritics_on_characters")] + public async Task SetSettingsTest98() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { CustomRanking = new List { "desc(post_date_timestamp)" } } + new IndexSettings { KeepDiacriticsOnCharacters = "øé" } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"desc(post_date_timestamp)\"]}", + "{\"keepDiacriticsOnCharacters\":\"øé\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "customRanking and ranking sort alphabetically")] - public async Task SetSettingsTest34() + [Fact(DisplayName = "set_custom_normalization")] + public async Task SetSettingsTest99() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "asc(textual_attribute)" }, - Ranking = new List + CustomNormalization = new Dictionary> { - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", + { + "default", + new Dictionary { { "ä", "ae" } } + }, }, } ); @@ -5476,21 +8966,22 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}", + "{\"customNormalization\":{\"default\":{\"ä\":\"ae\"}}}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "relevancyStrictness")] - public async Task SetSettingsTest35() + [Fact(DisplayName = "set_languages_using_querylanguages")] + public async Task SetSettingsTest100() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - CustomRanking = new List { "asc(textual_attribute)" }, - RelevancyStrictness = 0, + QueryLanguages = new List { Enum.Parse("Es") }, + RemoveStopWords = new RemoveStopWords(true), + IgnorePlurals = new IgnorePlurals(true), } ); @@ -5498,189 +8989,136 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}", + "{\"queryLanguages\":[\"es\"],\"removeStopWords\":true,\"ignorePlurals\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "create replica index")] - public async Task SetSettingsTest36() + [Fact(DisplayName = "set_indexlanguages")] + public async Task SetSettingsTest101() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { Replicas = new List { "products_price_desc" } } + new IndexSettings + { + IndexLanguages = new List { Enum.Parse("Ja") }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"replicas\":[\"products_price_desc\"]}", + "{\"indexLanguages\":[\"ja\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "create virtual replica index")] - public async Task SetSettingsTest37() + [Fact(DisplayName = "enable_decompound_query_by_default")] + public async Task SetSettingsTest102() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { Replicas = new List { "virtual(products_price_desc)" } } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { DecompoundQuery = true }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"replicas\":[\"virtual(products_price_desc)\"]}", + "{\"decompoundQuery\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "unlink replica index")] - public async Task SetSettingsTest38() + [Fact(DisplayName = "enable_rules_syntax_by_default")] + public async Task SetSettingsTest103() { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings { Replicas = new List { "" } } - ); + await client.SetSettingsAsync("theIndexName", new IndexSettings { EnableRules = true }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"replicas\":[\"\"]}", req.Body, new JsonDiffConfig(false)); + JsonAssert.EqualOverrideDefault("{\"enableRules\":true}", req.Body, new JsonDiffConfig(false)); } - [Fact(DisplayName = "forwardToReplicas")] - public async Task SetSettingsTest39() + [Fact(DisplayName = "enable_personalization_settings")] + public async Task SetSettingsTest104() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List { "name", "description" }, - }, - true + new IndexSettings { EnablePersonalization = true } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"name\",\"description\"]}", + "{\"enablePersonalization\":true}", req.Body, new JsonDiffConfig(false) ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"forwardToReplicas\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } } - [Fact(DisplayName = "maxValuesPerFacet")] - public async Task SetSettingsTest40() + [Fact(DisplayName = "set_default_query_type")] + public async Task SetSettingsTest105() { - await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxValuesPerFacet = 1000 }); + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings { QueryType = Enum.Parse("PrefixLast") } + ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"maxValuesPerFacet\":1000}", + "{\"queryType\":\"prefixLast\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "maxFacetHits")] - public async Task SetSettingsTest41() - { - await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxFacetHits = 1000 }); - - var req = _echo.LastResponse; - Assert.Equal("/1/indexes/theIndexName/settings", req.Path); - Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"maxFacetHits\":1000}", req.Body, new JsonDiffConfig(false)); - } - - [Fact(DisplayName = "attributesForFaceting complex")] - public async Task SetSettingsTest42() + [Fact(DisplayName = "set_default_remove_words_if_no_result")] + public async Task SetSettingsTest106() { await client.SetSettingsAsync( - "", - new IndexSettings - { - AttributesForFaceting = new List - { - "actor", - "filterOnly(category)", - "searchable(publisher)", - }, - } + "theIndexName", + new IndexSettings { RemoveWordsIfNoResults = Enum.Parse("None") } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}", + "{\"removeWordsIfNoResults\":\"none\"}", req.Body, - new JsonDiffConfig(false) - ); - } - - [Fact(DisplayName = "ranking closest dates")] - public async Task SetSettingsTest43() - { - await client.SetSettingsAsync( - "theIndexName", - new IndexSettings - { - Ranking = new List - { - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - }, - } + new JsonDiffConfig(false) ); + } + + [Fact(DisplayName = "enable_advanced_syntax_by_default")] + public async Task SetSettingsTest107() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { AdvancedSyntax = true }); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + "{\"advancedSyntax\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributes item variation")] - public async Task SetSettingsTest44() + [Fact(DisplayName = "set_default_optional_words")] + public async Task SetSettingsTest108() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - SearchableAttributes = new List { "design", "type", "color" }, + OptionalWords = new OptionalWords(new List { "blue", "iphone case" }), } ); @@ -5688,174 +9126,78 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}", + "{\"optionalWords\":[\"blue\",\"iphone case\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributes around location")] - public async Task SetSettingsTest45() + [Fact(DisplayName = "disabling_prefix_search_for_some_attributes_by_default")] + public async Task SetSettingsTest109() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List { "name", "country", "code", "iata_code" }, - CustomRanking = new List { "desc(links_count)" }, - } + new IndexSettings { DisablePrefixOnAttributes = new List { "sku" } } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", + "{\"disablePrefixOnAttributes\":[\"sku\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributes around location")] - public async Task SetSettingsTest46() + [Fact(DisplayName = "disabling_exact_for_some_attributes_by_default")] + public async Task SetSettingsTest110() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List { "name", "country", "code", "iata_code" }, - CustomRanking = new List { "desc(links_count)" }, - } + new IndexSettings { DisableExactOnAttributes = new List { "description" } } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", + "{\"disableExactOnAttributes\":[\"description\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "disableTypoToleranceOnAttributes")] - public async Task SetSettingsTest47() + [Fact(DisplayName = "set_default_exact_single_word_query")] + public async Task SetSettingsTest111() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } + new IndexSettings { ExactOnSingleWordQuery = Enum.Parse("Attribute") } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", + "{\"exactOnSingleWordQuery\":\"attribute\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "everything")] - public async Task SetSettingsTest48() + [Fact(DisplayName = "set_default_aternative_as_exact")] + public async Task SetSettingsTest112() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - AdvancedSyntax = true, - AdvancedSyntaxFeatures = new List - { - Enum.Parse("ExactPhrase"), - }, - AllowCompressionOfIntegerArray = true, - AllowTyposOnNumericTokens = true, AlternativesAsExact = new List { + Enum.Parse("IgnorePlurals"), Enum.Parse("SingleWordSynonym"), }, - AttributeCriteriaComputedByMinProximity = true, - AttributeForDistinct = "test", - AttributesForFaceting = new List { "algolia" }, - AttributesToHighlight = new List { "algolia" }, - AttributesToRetrieve = new List { "algolia" }, - AttributesToSnippet = new List { "algolia" }, - AttributesToTransliterate = new List { "algolia" }, - CamelCaseAttributes = new List { "algolia" }, - CustomNormalization = new Dictionary> - { - { - "algolia", - new Dictionary { { "aloglia", "aglolia" } } - }, - }, - CustomRanking = new List { "algolia" }, - DecompoundQuery = false, - DecompoundedAttributes = new Dictionary { { "algolia", "aloglia" } }, - DisableExactOnAttributes = new List { "algolia" }, - DisablePrefixOnAttributes = new List { "algolia" }, - DisableTypoToleranceOnAttributes = new List { "algolia" }, - DisableTypoToleranceOnWords = new List { "algolia" }, - Distinct = new Distinct(3), - EnablePersonalization = true, - EnableReRanking = false, - EnableRules = true, - ExactOnSingleWordQuery = Enum.Parse("Attribute"), - HighlightPreTag = "", - HighlightPostTag = "", - HitsPerPage = 10, - IgnorePlurals = new IgnorePlurals(false), - IndexLanguages = new List { Enum.Parse("Fr") }, - KeepDiacriticsOnCharacters = "abc", - MaxFacetHits = 20, - MaxValuesPerFacet = 30, - MinProximity = 6, - MinWordSizefor1Typo = 5, - MinWordSizefor2Typos = 11, - Mode = Enum.Parse("NeuralSearch"), - NumericAttributesForFiltering = new List { "algolia" }, - OptionalWords = new OptionalWords(new List { "myspace" }), - PaginationLimitedTo = 0, - QueryLanguages = new List { Enum.Parse("Fr") }, - QueryType = Enum.Parse("PrefixLast"), - Ranking = new List { "geo" }, - ReRankingApplyFilter = new ReRankingApplyFilter("mySearch:filters"), - RelevancyStrictness = 10, - RemoveStopWords = new RemoveStopWords(false), - RemoveWordsIfNoResults = Enum.Parse("LastWords"), - RenderingContent = new RenderingContent - { - FacetOrdering = new FacetOrdering - { - Facets = new Facets - { - Order = new List { "a", "b" }, - }, - Values = new Dictionary - { - { - "a", - new Value - { - Order = new List { "b" }, - SortRemainingBy = Enum.Parse("Count"), - } - }, - }, - }, - }, - ReplaceSynonymsInHighlight = true, - Replicas = new List { "" }, - ResponseFields = new List { "algolia" }, - RestrictHighlightAndSnippetArrays = true, - SearchableAttributes = new List { "foo" }, - SemanticSearch = new SemanticSearch { EventSources = new List { "foo" } }, - SeparatorsToIndex = "bar", - SnippetEllipsisText = "---", - SortFacetValuesBy = "date", - TypoTolerance = new TypoTolerance(false), - UnretrievableAttributes = new List { "foo" }, - UserData = new Dictionary { { "user", "data" } }, } ); @@ -5863,34 +9205,35 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}", + "{\"alternativesAsExact\":[\"ignorePlurals\",\"singleWordSynonym\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributesWithCustomRankingsAndAttributesForFaceting")] - public async Task SetSettingsTest49() + [Fact(DisplayName = "enable_advanced_syntax_by_default")] + public async Task SetSettingsTest113() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { AdvancedSyntax = true }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"advancedSyntax\":true}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_numeric_attributes_for_filtering")] + public async Task SetSettingsTest114() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - SearchableAttributes = new List - { - "brand", - "name", - "categories", - "unordered(description)", - }, - CustomRanking = new List { "desc(popularity)" }, - AttributesForFaceting = new List - { - "searchable(brand)", - "type", - "categories", - "price", - }, + NumericAttributesForFiltering = new List { "quantity", "popularity" }, } ); @@ -5898,143 +9241,156 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}", + "{\"numericAttributesForFiltering\":[\"quantity\",\"popularity\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributesProductReferenceSuffixes")] - public async Task SetSettingsTest50() + [Fact(DisplayName = "enable_compression_of_integer_array")] + public async Task SetSettingsTest115() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - SearchableAttributes = new List - { - "name", - "product_reference", - "product_reference_suffixes", - }, - } + new IndexSettings { AllowCompressionOfIntegerArray = true } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}", + "{\"allowCompressionOfIntegerArray\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "queryLanguageAndIgnorePlurals")] - public async Task SetSettingsTest51() + [Fact(DisplayName = "set_attributes_for_distinct")] + public async Task SetSettingsTest116() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings - { - QueryLanguages = new List { Enum.Parse("En") }, - IgnorePlurals = new IgnorePlurals(true), - } + new IndexSettings { AttributeForDistinct = "url" } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}", + "{\"attributeForDistinct\":\"url\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributesInMovies")] - public async Task SetSettingsTest52() + [Fact(DisplayName = "set_distinct")] + public async Task SetSettingsTest117() { await client.SetSettingsAsync( - "movies", - new IndexSettings - { - SearchableAttributes = new List { "title_eng", "title_fr", "title_es" }, - } + "theIndexName", + new IndexSettings { Distinct = new Distinct(1), AttributeForDistinct = "url" } ); var req = _echo.LastResponse; - Assert.Equal("/1/indexes/movies/settings", req.Path); + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}", + "{\"distinct\":1,\"attributeForDistinct\":\"url\"}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "disablePrefixOnAttributes")] - public async Task SetSettingsTest53() + [Fact(DisplayName = "set_replace_synonyms_in_highlights")] + public async Task SetSettingsTest118() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { DisablePrefixOnAttributes = new List { "serial_number" } } + new IndexSettings { ReplaceSynonymsInHighlight = false } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"disablePrefixOnAttributes\":[\"serial_number\"]}", + "{\"replaceSynonymsInHighlight\":false}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "disableTypoToleranceOnAttributes")] - public async Task SetSettingsTest54() + [Fact(DisplayName = "set_min_proximity")] + public async Task SetSettingsTest119() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { MinProximity = 1 }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"minProximity\":1}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "set_default_field")] + public async Task SetSettingsTest120() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { DisableTypoToleranceOnAttributes = new List { "serial_number" } } + new IndexSettings + { + ResponseFields = new List { "hits", "hitsPerPage", "nbPages", "page" }, + } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", + "{\"responseFields\":[\"hits\",\"hitsPerPage\",\"nbPages\",\"page\"]}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributesSimpleExample")] - public async Task SetSettingsTest55() + [Fact(DisplayName = "set_max_facet_hits")] + public async Task SetSettingsTest121() + { + await client.SetSettingsAsync("theIndexName", new IndexSettings { MaxFacetHits = 10 }); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault("{\"maxFacetHits\":10}", req.Body, new JsonDiffConfig(false)); + } + + [Fact(DisplayName = "set_attribute_criteria_computed_by_min_proximity")] + public async Task SetSettingsTest122() { await client.SetSettingsAsync( "theIndexName", - new IndexSettings { SearchableAttributes = new List { "serial_number" } } + new IndexSettings { AttributeCriteriaComputedByMinProximity = true } ); var req = _echo.LastResponse; Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"serial_number\"]}", + "{\"attributeCriteriaComputedByMinProximity\":true}", req.Body, new JsonDiffConfig(false) ); } - [Fact(DisplayName = "searchableAttributesSimpleExampleAlt")] - public async Task SetSettingsTest56() + [Fact(DisplayName = "set_user_data")] + public async Task SetSettingsTest123() { await client.SetSettingsAsync( "theIndexName", new IndexSettings { - SearchableAttributes = new List { "serial_number", "serial_number_suffixes" }, + UserData = new Dictionary + { + { "extraData", "This is the custom data that you want to store in your index" }, + }, } ); @@ -6042,7 +9398,57 @@ await client.SetSettingsAsync( Assert.Equal("/1/indexes/theIndexName/settings", req.Path); Assert.Equal("PUT", req.Method.ToString()); JsonAssert.EqualOverrideDefault( - "{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}", + "{\"userData\":{\"extraData\":\"This is the custom data that you want to store in your index\"}}", + req.Body, + new JsonDiffConfig(false) + ); + } + + [Fact(DisplayName = "set_rendering_content")] + public async Task SetSettingsTest124() + { + await client.SetSettingsAsync( + "theIndexName", + new IndexSettings + { + RenderingContent = new RenderingContent + { + FacetOrdering = new FacetOrdering + { + Facets = new Facets + { + Order = new List { "size", "brand" }, + }, + Values = new Dictionary + { + { + "brand", + new Value + { + Order = new List { "uniqlo" }, + Hide = new List { "muji" }, + SortRemainingBy = Enum.Parse("Count"), + } + }, + { + "size", + new Value + { + Order = new List { "S", "M", "L" }, + SortRemainingBy = Enum.Parse("Hidden"), + } + }, + }, + }, + }, + } + ); + + var req = _echo.LastResponse; + Assert.Equal("/1/indexes/theIndexName/settings", req.Path); + Assert.Equal("PUT", req.Method.ToString()); + JsonAssert.EqualOverrideDefault( + "{\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"size\",\"brand\"]},\"values\":{\"brand\":{\"order\":[\"uniqlo\"],\"hide\":[\"muji\"],\"sortRemainingBy\":\"count\"},\"size\":{\"order\":[\"S\",\"M\",\"L\"],\"sortRemainingBy\":\"hidden\"}}}}}", req.Body, new JsonDiffConfig(false) ); diff --git a/tests/output/dart/test/requests/search_test.dart b/tests/output/dart/test/requests/search_test.dart index 9df7ae79c3..39a8dd458b 100644 --- a/tests/output/dart/test/requests/search_test.dart +++ b/tests/output/dart/test/requests/search_test.dart @@ -4606,6 +4606,122 @@ void main() { ), ); + // searchSingleIndex + test( + 'facetFiltersBook', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "category:Book", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","facetFilters":["category:Book"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'facetFiltersAND', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "category:Book", + "author:John Doe", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","facetFilters":["category:Book","author:John Doe"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'facetFiltersOR', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + [ + "category:Book", + "author:John Doe", + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'facetFiltersCombined', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facetFilters: [ + "author:John Doe", + [ + "category:Book", + "category:Movie", + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}"""); + }, + ), + ); + // searchSingleIndex test( 'facetFiltersNeg', @@ -5136,6 +5252,31 @@ void main() { ), ); + // searchSingleIndex + test( + 'userToken1234', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + userToken: "user-1234", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","userToken":"user-1234"}"""); + }, + ), + ); + // searchSingleIndex test( 'analyticsTag', @@ -5217,198 +5358,4273 @@ void main() { ), ); - // searchSynonyms + // searchSingleIndex test( - 'searchSynonyms with minimal parameters', + 'attributesToHighlightOverride', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.searchSynonyms( + call: (client) => client.searchSingleIndex( indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + attributesToHighlight: [ + "title", + "content", + ], + ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/indexName/synonyms/search'); + expectPath(request.path, '/1/indexes/indexName/query'); expect(request.method, 'post'); - expectBody(request.body, """{}"""); + expectBody(request.body, + """{"query":"query","attributesToHighlight":["title","content"]}"""); }, ), ); - // searchSynonyms + // searchSingleIndex test( - 'searchSynonyms with all parameters', + 'disableTypoToleranceOnAttributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.searchSynonyms( + call: (client) => client.searchSingleIndex( indexName: "indexName", - searchSynonymsParams: SearchSynonymsParams( - query: "myQuery", - type: SynonymType.fromJson("altcorrection1"), - page: 10, - hitsPerPage: 10, + searchParams: SearchParamsObject( + query: "query", + disableTypoToleranceOnAttributes: [ + "serial_number", + ], ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/indexName/synonyms/search'); + expectPath(request.path, '/1/indexes/indexName/query'); expect(request.method, 'post'); expectBody(request.body, - """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}"""); + """{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}"""); }, ), ); - // searchUserIds + // searchSingleIndex test( - 'searchUserIds', + 'search_a_query', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.searchUserIds( - searchUserIdsParams: SearchUserIdsParams( - query: "test", - clusterName: "theClusterName", - page: 5, - hitsPerPage: 10, + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "shirt", ), ), intercept: (request) { - expectPath(request.path, '/1/clusters/mapping/search'); + expectPath(request.path, '/1/indexes/indexName/query'); expect(request.method, 'post'); - expectBody(request.body, - """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}"""); + expectBody(request.body, """{"query":"shirt"}"""); }, ), ); - // setDictionarySettings + // searchSingleIndex test( - 'get setDictionarySettings results with minimal parameters', + 'search_everything', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams( - disableStandardEntries: StandardEntries( - plurals: { - 'fr': false, - 'en': false, - 'ru': true, - }, - ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "", ), ), intercept: (request) { - expectPath(request.path, '/1/dictionaries/*/settings'); - expect(request.method, 'put'); - expectBody(request.body, - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}"""); + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":""}"""); }, ), ); - // setDictionarySettings + // searchSingleIndex test( - 'get setDictionarySettings results with all parameters', + 'api_filtering_range_example', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.setDictionarySettings( - dictionarySettingsParams: DictionarySettingsParams( - disableStandardEntries: StandardEntries( - plurals: { - 'fr': false, - 'en': false, - 'ru': true, - }, - stopwords: { - 'fr': false, - }, - compounds: { - 'ru': true, - }, - ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "books", + filters: "price:10 TO 20", ), ), intercept: (request) { - expectPath(request.path, '/1/dictionaries/*/settings'); - expect(request.method, 'put'); - expectBody(request.body, - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}"""); + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"books","filters":"price:10 TO 20"}"""); }, ), ); - // setSettings + // searchSingleIndex test( - 'minimal parameters', + 'search_a_query', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.setSettings( - indexName: "cts_e2e_settings", - indexSettings: IndexSettings( - paginationLimitedTo: 10, + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "", + similarQuery: + "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001", ), - forwardToReplicas: true, ), intercept: (request) { - expectPath(request.path, '/1/indexes/cts_e2e_settings/settings'); - expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"paginationLimitedTo":10}"""); + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}"""); }, ), ); - // setSettings + // searchSingleIndex test( - 'boolean typoTolerance', + 'override_retrievable_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', apiKey: 'apiKey', options: ClientOptions(requester: requester), ), - call: (client) => client.setSettings( - indexName: "theIndexName", - indexSettings: IndexSettings( - typoTolerance: true, + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + attributesToRetrieve: [ + "title", + "content", + ], ), - forwardToReplicas: true, ), intercept: (request) { - expectPath(request.path, '/1/indexes/theIndexName/settings'); - expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"typoTolerance":true}"""); + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","attributesToRetrieve":["title","content"]}"""); }, ), ); - // setSettings + // searchSingleIndex + test( + 'restrict_searchable_attributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + restrictSearchableAttributes: [ + "title", + "author", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","restrictSearchableAttributes":["title","author"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_relevancy', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + relevancyStrictness: 70, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","relevancyStrictness":70}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_all_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + 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\"", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.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\\""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'escape_spaces', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + filters: "category:\"Books and Comics\"", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","filters":"category:\\"Books and Comics\\""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'escape_keywords', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + filters: "keyword:\"OR\"", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","filters":"keyword:\\"OR\\""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'escape_single_quotes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + filters: "content:\"It's a wonderful day\"", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","filters":"content:\\"It's a wonderful day\\""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'escape_double_quotes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + filters: "content:\"She said \"Hello World\"", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","filters":"content:\\"She said \\"Hello World\\""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + optionalFilters: [ + "category:Book", + "author:John Doe", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","optionalFilters":["category:Book","author:John Doe"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_negative_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + optionalFilters: [ + "category:Book", + "author:-John Doe", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_numeric_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + numericFilters: [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506", + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_tag_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + tagFilters: [ + "SciFi", + [ + "Book", + "Movie", + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'apply_filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + sumOrFiltersScores: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","sumOrFiltersScores":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'facets_all', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facets: [ + "*", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","facets":["*"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'retrieve_only_some_facets', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facets: [ + "category", + "author", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","facets":["category","author"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_max_values_per_facet', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + maxValuesPerFacet: 20, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","maxValuesPerFacet":20}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_faceting_after_distinct', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + facetingAfterDistinct: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","facetingAfterDistinct":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'sort_facet_values_alphabetically', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + sortFacetValuesBy: "count", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","sortFacetValuesBy":"count"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_attributes_to_snippet', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + attributesToSnippet: [ + "title", + "content:80", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","attributesToSnippet":["title","content:80"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_highlight_pre_tag', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + highlightPreTag: "", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","highlightPreTag":""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_highlight_post_tag', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + highlightPostTag: "", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","highlightPostTag":""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_snippet_ellipsis_text', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + snippetEllipsisText: "", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","snippetEllipsisText":""}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_restrict_highlight_and_snippet_arrays', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + restrictHighlightAndSnippetArrays: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","restrictHighlightAndSnippetArrays":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'access_page', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + page: 0, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","page":0}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_hits_per_page', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + hitsPerPage: 10, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","hitsPerPage":10}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'get_nth_hit', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + offset: 4, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","offset":4}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'get_n_results', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + length: 4, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","length":4}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_min_word_size_for_one_typo', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + minWordSizefor1Typo: 2, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","minWordSizefor1Typo":2}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_min_word_size_for_two_typos', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + minWordSizefor2Typos: 2, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","minWordSizefor2Typos":2}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_typo_tolerance_mode', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + typoTolerance: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","typoTolerance":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disable_typos_on_numeric_tokens_at_search_time', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + allowTyposOnNumericTokens: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","allowTyposOnNumericTokens":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_around_a_position', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundLatLng: "40.71, -74.01", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","aroundLatLng":"40.71, -74.01"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_around_server_ip', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundLatLngViaIP: true, + ), + requestOptions: RequestOptions( + headers: { + 'x-forwarded-for': + '94.228.178.246 // should be replaced with the actual IP you would like to search around', + }, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectHeaders(request.headers, + """{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}"""); + expectBody( + request.body, """{"query":"query","aroundLatLngViaIP":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_around_radius', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundRadius: 1000, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","aroundRadius":1000}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disable_automatic_radius', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundRadius: AroundRadiusAll.fromJson("all"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","aroundRadius":"all"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_geo_search_precision', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundPrecision: 100, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","aroundPrecision":100}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_geo_search_precision_non_linear', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + aroundPrecision: [ + Range( + from: 0, + value: 25, + ), + Range( + from: 2000, + value: 1000, + ), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_minimum_geo_search_radius', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + minimumAroundRadius: 1000, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","minimumAroundRadius":1000}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_inside_rectangular_area', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + insideBoundingBox: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_inside_multiple_rectangular_areas', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + insideBoundingBox: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_inside_polygon_area', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + insidePolygon: [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'search_inside_multiple_polygon_areas', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + 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, + ], + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.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]]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_querylanguages_override', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + ignorePlurals: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","ignorePlurals":["ca","es"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_querylanguages_override', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + removeStopWords: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","removeStopWords":["ca","es"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_querylanguages_override', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + removeStopWords: [ + SupportedLanguage.fromJson("ca"), + SupportedLanguage.fromJson("es"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","removeStopWords":["ca","es"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_querylanguages_with_japanese_query', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + queryLanguages: [ + SupportedLanguage.fromJson("ja"), + SupportedLanguage.fromJson("en"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","queryLanguages":["ja","en"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_natural_languages', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "", + naturalLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"","naturalLanguages":["fr"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_natural_languages_with_query', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "", + naturalLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("firstWords"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_decompound_query_search_time', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + decompoundQuery: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","decompoundQuery":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_rules_search_time', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enableRules: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","enableRules":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_rule_contexts', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + ruleContexts: [ + "front_end", + "website2", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","ruleContexts":["front_end","website2"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_personalization', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","enablePersonalization":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_personalization_with_user_token', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + userToken: "123456", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","enablePersonalization":true,"userToken":"123456"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'personalization_impact', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + personalizationImpact: 20, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","personalizationImpact":20}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_user_token', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + userToken: "123456", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","userToken":"123456"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_user_token_with_personalization', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enablePersonalization: true, + userToken: "123456", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","enablePersonalization":true,"userToken":"123456"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_query_type', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + queryType: QueryType.fromJson("prefixAll"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","queryType":"prefixAll"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_remove_words_if_no_results', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","removeWordsIfNoResults":"lastWords"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_advanced_syntax_search_time', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","advancedSyntax":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'overide_default_optional_words', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + optionalWords: [ + "toyota", + "2020 2021", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","optionalWords":["toyota","2020 2021"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disabling_exact_for_some_attributes_search_time', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + disableExactOnAttributes: [ + "description", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","disableExactOnAttributes":["description"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_exact_single_word_query', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("none"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","exactOnSingleWordQuery":"none"}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_aternative_as_exact', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + alternativesAsExact: [ + AlternativesAsExact.fromJson("multiWordsSynonym"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","alternativesAsExact":["multiWordsSynonym"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_advanced_syntax_exact_phrase', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("exactPhrase"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_advanced_syntax_exclude_words', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("excludeWords"), + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_distinct', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + distinct: 0, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","distinct":0}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'get_ranking_info', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + getRankingInfo: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","getRankingInfo":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disable_click_analytics', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + clickAnalytics: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","clickAnalytics":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'enable_click_analytics', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + clickAnalytics: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","clickAnalytics":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disable_analytics', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + analytics: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","analytics":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'add_analytics_tags', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + analyticsTags: [ + "front_end", + "website2", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","analyticsTags":["front_end","website2"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'disable_synonyms', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + synonyms: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","synonyms":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_replace_synonyms_in_highlights', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + replaceSynonymsInHighlight: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","replaceSynonymsInHighlight":true}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_min_proximity', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + minProximity: 2, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","minProximity":2}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_default_field', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + responseFields: [ + "hits", + "facets", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","responseFields":["hits","facets"]}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'override_percentile_computation', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + percentileComputation: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"query","percentileComputation":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_ab_test', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enableABTest: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody(request.body, """{"query":"query","enableABTest":false}"""); + }, + ), + ); + + // searchSingleIndex + test( + 'set_enable_re_ranking', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSingleIndex( + indexName: "indexName", + searchParams: SearchParamsObject( + query: "query", + enableReRanking: false, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/query'); + expect(request.method, 'post'); + expectBody( + request.body, """{"query":"query","enableReRanking":false}"""); + }, + ), + ); + + // searchSynonyms + test( + 'searchSynonyms with minimal parameters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSynonyms( + indexName: "indexName", + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/synonyms/search'); + expect(request.method, 'post'); + expectBody(request.body, """{}"""); + }, + ), + ); + + // searchSynonyms + test( + 'searchSynonyms with all parameters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchSynonyms( + indexName: "indexName", + searchSynonymsParams: SearchSynonymsParams( + query: "myQuery", + type: SynonymType.fromJson("altcorrection1"), + page: 10, + hitsPerPage: 10, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/indexName/synonyms/search'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}"""); + }, + ), + ); + + // searchUserIds + test( + 'searchUserIds', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.searchUserIds( + searchUserIdsParams: SearchUserIdsParams( + query: "test", + clusterName: "theClusterName", + page: 5, + hitsPerPage: 10, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/clusters/mapping/search'); + expect(request.method, 'post'); + expectBody(request.body, + """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}"""); + }, + ), + ); + + // setDictionarySettings + test( + 'get setDictionarySettings results with minimal parameters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams( + disableStandardEntries: StandardEntries( + plurals: { + 'fr': false, + 'en': false, + 'ru': true, + }, + ), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/dictionaries/*/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}"""); + }, + ), + ); + + // setDictionarySettings + test( + 'get setDictionarySettings results with all parameters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setDictionarySettings( + dictionarySettingsParams: DictionarySettingsParams( + disableStandardEntries: StandardEntries( + plurals: { + 'fr': false, + 'en': false, + 'ru': true, + }, + stopwords: { + 'fr': false, + }, + compounds: { + 'ru': true, + }, + ), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/dictionaries/*/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}"""); + }, + ), + ); + + // setSettings + test( + 'minimal parameters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "cts_e2e_settings", + indexSettings: IndexSettings( + paginationLimitedTo: 10, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/cts_e2e_settings/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"paginationLimitedTo":10}"""); + }, + ), + ); + + // setSettings + test( + 'boolean typoTolerance', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + typoTolerance: true, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"typoTolerance":true}"""); + }, + ), + ); + + // setSettings + test( + 'enum typoTolerance', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + typoTolerance: TypoToleranceEnum.fromJson("min"), + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"typoTolerance":"min"}"""); + }, + ), + ); + + // setSettings + test( + 'ignorePlurals', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + ignorePlurals: true, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"ignorePlurals":true}"""); + }, + ), + ); + + // setSettings + test( + 'list of string ignorePlurals', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + ignorePlurals: [ + SupportedLanguage.fromJson("fr"), + ], + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"ignorePlurals":["fr"]}"""); + }, + ), + ); + + // setSettings + test( + 'removeStopWords boolean', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + removeStopWords: true, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"removeStopWords":true}"""); + }, + ), + ); + + // setSettings + test( + 'removeStopWords list of string', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + removeStopWords: [ + SupportedLanguage.fromJson("fr"), + ], + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"removeStopWords":["fr"]}"""); + }, + ), + ); + + // setSettings + test( + 'boolean distinct', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + distinct: true, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"distinct":true}"""); + }, + ), + ); + + // setSettings + test( + 'integer distinct', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + distinct: 1, + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, """{"distinct":1}"""); + }, + ), + ); + + // setSettings + test( + 'distinct company', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributeForDistinct: "company", + distinct: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributeForDistinct":"company","distinct":true}"""); + }, + ), + ); + + // setSettings + test( + 'distinct design', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributeForDistinct: "design", + distinct: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributeForDistinct":"design","distinct":true}"""); + }, + ), + ); + + // setSettings + test( + 'distinct true', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + distinct: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"distinct":true}"""); + }, + ), + ); + + // setSettings + test( + 'distinct section', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributeForDistinct: "section", + distinct: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributeForDistinct":"section","distinct":true}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting allergens', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "allergens", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"attributesForFaceting":["allergens"]}"""); + }, + ), + ); + + // setSettings + test( + 'api_attributes_for_faceting', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "genre", + "author", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"attributesForFaceting":["genre","author"]}"""); + }, + ), + ); + + // setSettings + test( + 'api_attributes_for_faceting_searchable', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "genre", + "searchable(author)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["genre","searchable(author)"]}"""); + }, + ), + ); + + // setSettings + test( + 'api_attributes_for_filter_only', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(genre)", + "author", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["filterOnly(genre)","author"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting categoryPageId', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "searchable(categoryPageId)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["searchable(categoryPageId)"]}"""); + }, + ), + ); + + // setSettings + test( + 'unretrievableAttributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + unretrievableAttributes: [ + "visible_by", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"unretrievableAttributes":["visible_by"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting user restricted data', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(visible_by)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["filterOnly(visible_by)"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting optional filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "can_deliver_quickly", + "restaurant", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting redirect index', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "query_terms", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"attributesForFaceting":["query_terms"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting multiple consequences', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "director", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"attributesForFaceting":["director"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting in-depth optional filters', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "filterOnly(brand)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["filterOnly(brand)"]}"""); + }, + ), + ); + + // setSettings + test( + 'mode neuralSearch', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + mode: Mode.fromJson("neuralSearch"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"mode":"neuralSearch"}"""); + }, + ), + ); + + // setSettings + test( + 'mode keywordSearch', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + mode: Mode.fromJson("keywordSearch"), + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"mode":"keywordSearch"}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributes same priority', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "title,comments", + "ingredients", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["title,comments","ingredients"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributes higher priority', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "title", + "ingredients", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["title","ingredients"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking retweets', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(retweets)", + "desc(likes)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["desc(retweets)","desc(likes)"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking boosted', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(boosted)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"customRanking":["desc(boosted)"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking pageviews', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(pageviews)", + "desc(comments)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["desc(pageviews)","desc(comments)"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking applying search parameters for a specific query', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(nb_airline_liaisons)", + ], + attributesForFaceting: [ + "city, country", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking rounded pageviews', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(rounded_pageviews)", + "desc(comments)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking price', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(price)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"customRanking":["desc(price)"]}"""); + }, + ), + ); + + // setSettings + test( + 'ranking exhaustive', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); + }, + ), + ); + + // setSettings + test( + 'ranking standard replica', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + ranking: [ + "desc(post_date_timestamp)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"ranking":["desc(post_date_timestamp)"]}"""); + }, + ), + ); + + // setSettings + test( + 'ranking virtual replica', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "desc(post_date_timestamp)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["desc(post_date_timestamp)"]}"""); + }, + ), + ); + + // setSettings + test( + 'customRanking and ranking sort alphabetically', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "asc(textual_attribute)", + ], + ranking: [ + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}"""); + }, + ), + ); + + // setSettings + test( + 'relevancyStrictness', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: [ + "asc(textual_attribute)", + ], + relevancyStrictness: 0, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}"""); + }, + ), + ); + + // setSettings + test( + 'create replica index', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + replicas: [ + "products_price_desc", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"replicas":["products_price_desc"]}"""); + }, + ), + ); + + // setSettings + test( + 'create replica index articles', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + replicas: [ + "articles_date_desc", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"replicas":["articles_date_desc"]}"""); + }, + ), + ); + + // setSettings + test( + 'create virtual replica index', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + replicas: [ + "virtual(products_price_desc)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"replicas":["virtual(products_price_desc)"]}"""); + }, + ), + ); + + // setSettings + test( + 'unlink replica index', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + replicas: [ + "", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"replicas":[""]}"""); + }, + ), + ); + + // setSettings + test( + 'forwardToReplicas', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "description", + ], + ), + forwardToReplicas: true, + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectParams( + request.queryParameters, """{"forwardToReplicas":"true"}"""); + expectBody(request.body, + """{"searchableAttributes":["name","description"]}"""); + }, + ), + ); + + // setSettings + test( + 'maxValuesPerFacet', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + maxValuesPerFacet: 1000, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"maxValuesPerFacet":1000}"""); + }, + ), + ); + + // setSettings + test( + 'maxFacetHits', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + maxFacetHits: 1000, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"maxFacetHits":1000}"""); + }, + ), + ); + + // setSettings + test( + 'attributesForFaceting complex', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "", + indexSettings: IndexSettings( + attributesForFaceting: [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}"""); + }, + ), + ); + + // setSettings + test( + 'ranking closest dates', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + ranking: [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributes item variation', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "design", + "type", + "color", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["design","type","color"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributes around location', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "country", + "code", + "iata_code", + ], + customRanking: [ + "desc(links_count)", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesToHighlight', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesToHighlight: [ + "author", + "title", + "content", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesToHighlight":["author","title","content"]}"""); + }, + ), + ); + + // setSettings + test( + 'attributesToHighlightStar', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesToHighlight: [ + "*", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"attributesToHighlight":["*"]}"""); + }, + ), + ); + + // setSettings + test( + 'everything', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + advancedSyntax: true, + advancedSyntaxFeatures: [ + AdvancedSyntaxFeatures.fromJson("exactPhrase"), + ], + allowCompressionOfIntegerArray: true, + allowTyposOnNumericTokens: true, + alternativesAsExact: [ + AlternativesAsExact.fromJson("singleWordSynonym"), + ], + attributeCriteriaComputedByMinProximity: true, + attributeForDistinct: "test", + attributesForFaceting: [ + "algolia", + ], + attributesToHighlight: [ + "algolia", + ], + attributesToRetrieve: [ + "algolia", + ], + attributesToSnippet: [ + "algolia", + ], + attributesToTransliterate: [ + "algolia", + ], + camelCaseAttributes: [ + "algolia", + ], + customNormalization: { + 'algolia': { + 'aloglia': "aglolia", + }, + }, + customRanking: [ + "algolia", + ], + decompoundQuery: false, + decompoundedAttributes: { + 'algolia': "aloglia", + }, + disableExactOnAttributes: [ + "algolia", + ], + disablePrefixOnAttributes: [ + "algolia", + ], + disableTypoToleranceOnAttributes: [ + "algolia", + ], + disableTypoToleranceOnWords: [ + "algolia", + ], + distinct: 3, + enablePersonalization: true, + enableReRanking: false, + enableRules: true, + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), + highlightPreTag: "", + highlightPostTag: "", + hitsPerPage: 10, + ignorePlurals: false, + indexLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + keepDiacriticsOnCharacters: "abc", + maxFacetHits: 20, + maxValuesPerFacet: 30, + minProximity: 6, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + mode: Mode.fromJson("neuralSearch"), + numericAttributesForFiltering: [ + "algolia", + ], + optionalWords: [ + "myspace", + ], + paginationLimitedTo: 0, + queryLanguages: [ + SupportedLanguage.fromJson("fr"), + ], + queryType: QueryType.fromJson("prefixLast"), + ranking: [ + "geo", + ], + reRankingApplyFilter: "mySearch:filters", + relevancyStrictness: 10, + removeStopWords: false, + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), + renderingContent: RenderingContent( + facetOrdering: FacetOrdering( + facets: Facets( + order: [ + "a", + "b", + ], + ), + values: { + 'a': Value( + order: [ + "b", + ], + sortRemainingBy: SortRemainingBy.fromJson("count"), + ), + }, + ), + ), + replaceSynonymsInHighlight: true, + replicas: [ + "", + ], + responseFields: [ + "algolia", + ], + restrictHighlightAndSnippetArrays: true, + searchableAttributes: [ + "foo", + ], + semanticSearch: SemanticSearch( + eventSources: [ + "foo", + ], + ), + separatorsToIndex: "bar", + snippetEllipsisText: "---", + sortFacetValuesBy: "date", + typoTolerance: false, + unretrievableAttributes: [ + "foo", + ], + userData: { + 'user': "data", + }, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesWithCustomRankingsAndAttributesForFaceting', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "brand", + "name", + "categories", + "unordered(description)", + ], + customRanking: [ + "desc(popularity)", + ], + attributesForFaceting: [ + "searchable(brand)", + "type", + "categories", + "price", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesOrdering', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "unordered(title)", + "cast", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["unordered(title)","cast"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesProductReferenceSuffixes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "name", + "product_reference", + "product_reference_suffixes", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}"""); + }, + ), + ); + + // setSettings + test( + 'queryLanguageAndIgnorePlurals', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + queryLanguages: [ + SupportedLanguage.fromJson("en"), + ], + ignorePlurals: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"queryLanguages":["en"],"ignorePlurals":true}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesInMovies', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "movies", + indexSettings: IndexSettings( + searchableAttributes: [ + "title_eng", + "title_fr", + "title_es", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/movies/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["title_eng","title_fr","title_es"]}"""); + }, + ), + ); + + // setSettings + test( + 'disablePrefixOnAttributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + disablePrefixOnAttributes: [ + "serial_number", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"disablePrefixOnAttributes":["serial_number"]}"""); + }, + ), + ); + + // setSettings + test( + 'disableTypoToleranceOnAttributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + disableTypoToleranceOnAttributes: [ + "serial_number", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"disableTypoToleranceOnAttributes":["serial_number"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesSimpleExample', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "serial_number", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"searchableAttributes":["serial_number"]}"""); + }, + ), + ); + + // setSettings + test( + 'searchableAttributesSimpleExampleAlt', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "serial_number", + "serial_number_suffixes", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["serial_number","serial_number_suffixes"]}"""); + }, + ), + ); + + // setSettings + test( + 'set_searchable_attributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}"""); + }, + ), + ); + + // setSettings + test( + 'set_searchable_attributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesForFaceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}"""); + }, + ), + ); + + // setSettings + test( + 'unretrievable_attributes', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + unretrievableAttributes: [ + "total_number_of_sales", + ], + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, + """{"unretrievableAttributes":["total_number_of_sales"]}"""); + }, + ), + ); + + // setSettings test( - 'enum typoTolerance', + 'set_retrievable_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5418,23 +9634,25 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - typoTolerance: TypoToleranceEnum.fromJson("min"), + attributesToRetrieve: [ + "author", + "title", + "content", + ], ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"typoTolerance":"min"}"""); + expectBody(request.body, + """{"attributesToRetrieve":["author","title","content"]}"""); }, ), ); // setSettings test( - 'ignorePlurals', + 'set_all_attributes_as_retrievable', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5444,23 +9662,22 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - ignorePlurals: true, + attributesToRetrieve: [ + "*", + ], ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"ignorePlurals":true}"""); + expectBody(request.body, """{"attributesToRetrieve":["*"]}"""); }, ), ); // setSettings test( - 'list of string ignorePlurals', + 'specify_attributes_not_to_retrieve', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5470,25 +9687,25 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - ignorePlurals: [ - SupportedLanguage.fromJson("fr"), + attributesToRetrieve: [ + "*", + "-SKU", + "-internal_desc", ], ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"ignorePlurals":["fr"]}"""); + expectBody(request.body, + """{"attributesToRetrieve":["*","-SKU","-internal_desc"]}"""); }, ), ); // setSettings test( - 'removeStopWords boolean', + 'neural_search', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5498,23 +9715,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - removeStopWords: true, + mode: Mode.fromJson("neuralSearch"), ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"removeStopWords":true}"""); + expectBody(request.body, """{"mode":"neuralSearch"}"""); }, ), ); // setSettings test( - 'removeStopWords list of string', + 'keyword_search', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5524,25 +9738,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - removeStopWords: [ - SupportedLanguage.fromJson("fr"), - ], + mode: Mode.fromJson("keywordSearch"), ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"removeStopWords":["fr"]}"""); + expectBody(request.body, """{"mode":"keywordSearch"}"""); }, ), ); // setSettings test( - 'boolean distinct', + 'set_default_ranking', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5552,23 +9761,30 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - distinct: true, + ranking: [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ], ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"distinct":true}"""); + expectBody(request.body, + """{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}"""); }, ), ); // setSettings test( - 'integer distinct', + 'set_ranking_by_attribute_asc', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5578,23 +9794,31 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - distinct: 1, + ranking: [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, """{"distinct":1}"""); + expectBody(request.body, + """{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); }, ), ); // setSettings test( - 'distinct company', + 'set_ranking_by_attribute_desc', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5604,22 +9828,31 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - attributeForDistinct: "company", - distinct: true, + ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"attributeForDistinct":"company","distinct":true}"""); + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); }, ), ); // setSettings test( - 'distinct design', + 'restrict_searchable_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5629,22 +9862,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - attributeForDistinct: "design", - distinct: true, + customRanking: [ + "desc(popularity)", + "asc(price)", + ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"attributeForDistinct":"design","distinct":true}"""); + """{"customRanking":["desc(popularity)","asc(price)"]}"""); }, ), ); // setSettings test( - 'distinct true', + 'set_default_relevancy', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5654,20 +9889,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - distinct: true, + relevancyStrictness: 90, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"distinct":true}"""); + expectBody(request.body, """{"relevancyStrictness":90}"""); }, ), ); // setSettings test( - 'distinct section', + 'set_replicas', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5677,22 +9912,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - attributeForDistinct: "section", - distinct: true, + replicas: [ + "name_of_replica_index1", + "name_of_replica_index2", + ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"attributeForDistinct":"section","distinct":true}"""); + """{"replicas":["name_of_replica_index1","name_of_replica_index2"]}"""); }, ), ); // setSettings test( - 'attributesForFaceting allergens', + 'set_default_max_values_per_facet', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5700,24 +9937,22 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "allergens", - ], + maxValuesPerFacet: 100, ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"attributesForFaceting":["allergens"]}"""); + expectBody(request.body, """{"maxValuesPerFacet":100}"""); }, ), ); // setSettings test( - 'attributesForFaceting categoryPageId', + 'set_default_sort_facet_values_by', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5725,25 +9960,49 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "searchable(categoryPageId)", + sortFacetValuesBy: "alpha", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"sortFacetValuesBy":"alpha"}"""); + }, + ), + ); + + // setSettings + test( + 'set_attributes_to_snippet', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesToSnippet: [ + "content:80", + "description", ], ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"attributesForFaceting":["searchable(categoryPageId)"]}"""); + """{"attributesToSnippet":["content:80","description"]}"""); }, ), ); // setSettings test( - 'unretrievableAttributes', + 'set_all_attributes_to_snippet', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5751,25 +10010,24 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - unretrievableAttributes: [ - "visible_by", + attributesToSnippet: [ + "*:80", ], ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody( - request.body, """{"unretrievableAttributes":["visible_by"]}"""); + expectBody(request.body, """{"attributesToSnippet":["*:80"]}"""); }, ), ); // setSettings test( - 'attributesForFaceting user restricted data', + 'set_default_highlight_pre_tag', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5777,25 +10035,22 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "filterOnly(visible_by)", - ], + highlightPreTag: "", ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"attributesForFaceting":["filterOnly(visible_by)"]}"""); + expectBody(request.body, """{"highlightPreTag":""}"""); }, ), ); // setSettings test( - 'attributesForFaceting optional filters', + 'set_default_highlight_post_tag', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5803,26 +10058,22 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "can_deliver_quickly", - "restaurant", - ], + highlightPostTag: "", ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}"""); + expectBody(request.body, """{"highlightPostTag":""}"""); }, ), ); // setSettings test( - 'attributesForFaceting redirect index', + 'set_default_snippet_ellipsis_text', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5830,25 +10081,92 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "query_terms", - ], + snippetEllipsisText: "…", + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"snippetEllipsisText":"…"}"""); + }, + ), + ); + + // setSettings + test( + 'enable_restrict_highlight_and_snippet_arrays_by_default', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + restrictHighlightAndSnippetArrays: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody( + request.body, """{"restrictHighlightAndSnippetArrays":true}"""); + }, + ), + ); + + // setSettings + test( + 'set_default_hits_per_page', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + hitsPerPage: 20, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"hitsPerPage":20}"""); + }, + ), + ); + + // setSettings + test( + 'set_pagination_limit', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + paginationLimitedTo: 1000, ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody( - request.body, """{"attributesForFaceting":["query_terms"]}"""); + expectBody(request.body, """{"paginationLimitedTo":1000}"""); }, ), ); // setSettings test( - 'attributesForFaceting multiple consequences', + 'set_default_min_word_size_for_one_typo', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5856,24 +10174,22 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "director", - ], + minWordSizefor1Typo: 4, ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"attributesForFaceting":["director"]}"""); + expectBody(request.body, """{"minWordSizefor1Typo":4}"""); }, ), ); // setSettings test( - 'attributesForFaceting in-depth optional filters', + 'set_default_min_word_size_for_two_typos', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5881,25 +10197,22 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "filterOnly(brand)", - ], + minWordSizefor2Typos: 4, ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"attributesForFaceting":["filterOnly(brand)"]}"""); + expectBody(request.body, """{"minWordSizefor2Typos":4}"""); }, ), ); // setSettings test( - 'mode neuralSearch', + 'set_default_typo_tolerance_mode', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5909,20 +10222,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - mode: Mode.fromJson("neuralSearch"), + typoTolerance: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"mode":"neuralSearch"}"""); + expectBody(request.body, """{"typoTolerance":true}"""); }, ), ); // setSettings test( - 'mode keywordSearch', + 'disable_typos_on_numeric_tokens_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5932,20 +10245,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - mode: Mode.fromJson("keywordSearch"), + allowTyposOnNumericTokens: false, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"mode":"keywordSearch"}"""); + expectBody(request.body, """{"allowTyposOnNumericTokens":false}"""); }, ), ); // setSettings test( - 'searchableAttributes same priority', + 'disable_typo_tolerance_for_words', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5955,9 +10268,9 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "title,comments", - "ingredients", + disableTypoToleranceOnWords: [ + "wheel", + "1X2BCD", ], ), ), @@ -5965,14 +10278,14 @@ void main() { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"searchableAttributes":["title,comments","ingredients"]}"""); + """{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}"""); }, ), ); // setSettings test( - 'searchableAttributes higher priority', + 'set_separators_to_index', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -5982,24 +10295,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "title", - "ingredients", - ], + separatorsToIndex: "+#", ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"searchableAttributes":["title","ingredients"]}"""); + expectBody(request.body, """{"separatorsToIndex":"+#"}"""); }, ), ); // setSettings test( - 'customRanking retweets', + 'set_languages_using_querylanguages', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6009,24 +10318,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(retweets)", - "desc(likes)", + queryLanguages: [ + SupportedLanguage.fromJson("es"), ], + ignorePlurals: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"customRanking":["desc(retweets)","desc(likes)"]}"""); + expectBody( + request.body, """{"queryLanguages":["es"],"ignorePlurals":true}"""); }, ), ); // setSettings test( - 'customRanking boosted', + 'set_attributes_to_transliterate', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6036,22 +10345,27 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(boosted)", + indexLanguages: [ + SupportedLanguage.fromJson("ja"), + ], + attributesToTransliterate: [ + "name", + "description", ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"customRanking":["desc(boosted)"]}"""); + expectBody(request.body, + """{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}"""); }, ), ); // setSettings test( - 'customRanking pageviews', + 'set_languages_using_querylanguages', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6061,24 +10375,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(pageviews)", - "desc(comments)", + queryLanguages: [ + SupportedLanguage.fromJson("es"), ], + removeStopWords: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"customRanking":["desc(pageviews)","desc(comments)"]}"""); + """{"queryLanguages":["es"],"removeStopWords":true}"""); }, ), ); // setSettings test( - 'customRanking applying search parameters for a specific query', + 'set_camel_case_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6088,26 +10402,22 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(nb_airline_liaisons)", - ], - attributesForFaceting: [ - "city, country", + camelCaseAttributes: [ + "description", ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}"""); + expectBody(request.body, """{"camelCaseAttributes":["description"]}"""); }, ), ); // setSettings test( - 'customRanking rounded pageviews', + 'set_decompounded_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6117,24 +10427,25 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(rounded_pageviews)", - "desc(comments)", - ], + decompoundedAttributes: { + 'de': [ + "name", + ], + }, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}"""); + expectBody( + request.body, """{"decompoundedAttributes":{"de":["name"]}}"""); }, ), ); // setSettings test( - 'customRanking price', + 'set_decompounded_multiple_attributes', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6144,22 +10455,30 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(price)", - ], + decompoundedAttributes: { + 'de': [ + "name_de", + "description_de", + ], + 'fi': [ + "name_fi", + "description_fi", + ], + }, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"customRanking":["desc(price)"]}"""); + expectBody(request.body, + """{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}"""); }, ), ); // setSettings test( - 'ranking exhaustive', + 'set_keep_diacritics_on_characters', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6169,31 +10488,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - ranking: [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + keepDiacriticsOnCharacters: "øé", ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); + expectBody(request.body, """{"keepDiacriticsOnCharacters":"øé"}"""); }, ), ); // setSettings test( - 'ranking standard replica', + 'set_custom_normalization', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6203,23 +10511,25 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - ranking: [ - "desc(post_date_timestamp)", - ], + customNormalization: { + 'default': { + 'ä': "ae", + }, + }, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody( - request.body, """{"ranking":["desc(post_date_timestamp)"]}"""); + request.body, """{"customNormalization":{"default":{"ä":"ae"}}}"""); }, ), ); // setSettings test( - 'ranking virtual replica', + 'set_languages_using_querylanguages', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6229,23 +10539,25 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "desc(post_date_timestamp)", + queryLanguages: [ + SupportedLanguage.fromJson("es"), ], + removeStopWords: true, + ignorePlurals: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"customRanking":["desc(post_date_timestamp)"]}"""); + """{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}"""); }, ), ); // setSettings test( - 'customRanking and ranking sort alphabetically', + 'set_indexlanguages', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6255,33 +10567,22 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "asc(textual_attribute)", - ], - ranking: [ - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", + indexLanguages: [ + SupportedLanguage.fromJson("ja"), ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}"""); + expectBody(request.body, """{"indexLanguages":["ja"]}"""); }, ), ); // setSettings test( - 'relevancyStrictness', + 'enable_decompound_query_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6291,24 +10592,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - customRanking: [ - "asc(textual_attribute)", - ], - relevancyStrictness: 0, + decompoundQuery: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}"""); + expectBody(request.body, """{"decompoundQuery":true}"""); }, ), ); // setSettings test( - 'create replica index', + 'enable_rules_syntax_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6318,22 +10615,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - replicas: [ - "products_price_desc", - ], + enableRules: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"replicas":["products_price_desc"]}"""); + expectBody(request.body, """{"enableRules":true}"""); }, ), ); // setSettings test( - 'create virtual replica index', + 'enable_personalization_settings', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6343,23 +10638,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - replicas: [ - "virtual(products_price_desc)", - ], + enablePersonalization: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody( - request.body, """{"replicas":["virtual(products_price_desc)"]}"""); + expectBody(request.body, """{"enablePersonalization":true}"""); }, ), ); // setSettings test( - 'unlink replica index', + 'set_default_query_type', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6369,22 +10661,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - replicas: [ - "", - ], + queryType: QueryType.fromJson("prefixLast"), ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"replicas":[""]}"""); + expectBody(request.body, """{"queryType":"prefixLast"}"""); }, ), ); // setSettings test( - 'forwardToReplicas', + 'set_default_remove_words_if_no_result', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6394,27 +10684,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "description", - ], + removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("none"), ), - forwardToReplicas: true, ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectParams( - request.queryParameters, """{"forwardToReplicas":"true"}"""); - expectBody(request.body, - """{"searchableAttributes":["name","description"]}"""); + expectBody(request.body, """{"removeWordsIfNoResults":"none"}"""); }, ), ); // setSettings test( - 'maxValuesPerFacet', + 'enable_advanced_syntax_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6424,20 +10707,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - maxValuesPerFacet: 1000, + advancedSyntax: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"maxValuesPerFacet":1000}"""); + expectBody(request.body, """{"advancedSyntax":true}"""); }, ), ); // setSettings test( - 'maxFacetHits', + 'set_default_optional_words', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6447,20 +10730,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - maxFacetHits: 1000, + optionalWords: [ + "blue", + "iphone case", + ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, """{"maxFacetHits":1000}"""); + expectBody( + request.body, """{"optionalWords":["blue","iphone case"]}"""); }, ), ); // setSettings test( - 'attributesForFaceting complex', + 'disabling_prefix_search_for_some_attributes_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6468,27 +10755,24 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "", + indexName: "theIndexName", indexSettings: IndexSettings( - attributesForFaceting: [ - "actor", - "filterOnly(category)", - "searchable(publisher)", + disablePrefixOnAttributes: [ + "sku", ], ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}"""); + expectBody(request.body, """{"disablePrefixOnAttributes":["sku"]}"""); }, ), ); // setSettings test( - 'ranking closest dates', + 'disabling_exact_for_some_attributes_by_default', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6498,31 +10782,23 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - ranking: [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + disableExactOnAttributes: [ + "description", ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}"""); + expectBody( + request.body, """{"disableExactOnAttributes":["description"]}"""); }, ), ); // setSettings test( - 'searchableAttributes item variation', + 'set_default_exact_single_word_query', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6532,25 +10808,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "design", - "type", - "color", - ], + exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"searchableAttributes":["design","type","color"]}"""); + expectBody(request.body, """{"exactOnSingleWordQuery":"attribute"}"""); }, ), ); // setSettings test( - 'searchableAttributes around location', + 'set_default_aternative_as_exact', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6560,29 +10831,47 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "country", - "code", - "iata_code", - ], - customRanking: [ - "desc(links_count)", + alternativesAsExact: [ + AlternativesAsExact.fromJson("ignorePlurals"), + AlternativesAsExact.fromJson("singleWordSynonym"), ], ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}"""); + expectBody(request.body, + """{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}"""); + }, + ), + ); + + // setSettings + test( + 'enable_advanced_syntax_by_default', + () => runTest( + builder: (requester) => SearchClient( + appId: 'appId', + apiKey: 'apiKey', + options: ClientOptions(requester: requester), + ), + call: (client) => client.setSettings( + indexName: "theIndexName", + indexSettings: IndexSettings( + advancedSyntax: true, + ), + ), + intercept: (request) { + expectPath(request.path, '/1/indexes/theIndexName/settings'); + expect(request.method, 'put'); + expectBody(request.body, """{"advancedSyntax":true}"""); }, ), ); // setSettings test( - 'searchableAttributes around location', + 'set_numeric_attributes_for_filtering', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6592,14 +10881,9 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "country", - "code", - "iata_code", - ], - customRanking: [ - "desc(links_count)", + numericAttributesForFiltering: [ + "quantity", + "popularity", ], ), ), @@ -6607,14 +10891,14 @@ void main() { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}"""); + """{"numericAttributesForFiltering":["quantity","popularity"]}"""); }, ), ); // setSettings test( - 'disableTypoToleranceOnAttributes', + 'enable_compression_of_integer_array', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6624,23 +10908,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - disableTypoToleranceOnAttributes: [ - "serial_number", - ], + allowCompressionOfIntegerArray: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"disableTypoToleranceOnAttributes":["serial_number"]}"""); + expectBody(request.body, """{"allowCompressionOfIntegerArray":true}"""); }, ), ); // setSettings test( - 'everything', + 'set_attributes_for_distinct', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6650,154 +10931,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - advancedSyntax: true, - advancedSyntaxFeatures: [ - AdvancedSyntaxFeatures.fromJson("exactPhrase"), - ], - allowCompressionOfIntegerArray: true, - allowTyposOnNumericTokens: true, - alternativesAsExact: [ - AlternativesAsExact.fromJson("singleWordSynonym"), - ], - attributeCriteriaComputedByMinProximity: true, - attributeForDistinct: "test", - attributesForFaceting: [ - "algolia", - ], - attributesToHighlight: [ - "algolia", - ], - attributesToRetrieve: [ - "algolia", - ], - attributesToSnippet: [ - "algolia", - ], - attributesToTransliterate: [ - "algolia", - ], - camelCaseAttributes: [ - "algolia", - ], - customNormalization: { - 'algolia': { - 'aloglia': "aglolia", - }, - }, - customRanking: [ - "algolia", - ], - decompoundQuery: false, - decompoundedAttributes: { - 'algolia': "aloglia", - }, - disableExactOnAttributes: [ - "algolia", - ], - disablePrefixOnAttributes: [ - "algolia", - ], - disableTypoToleranceOnAttributes: [ - "algolia", - ], - disableTypoToleranceOnWords: [ - "algolia", - ], - distinct: 3, - enablePersonalization: true, - enableReRanking: false, - enableRules: true, - exactOnSingleWordQuery: ExactOnSingleWordQuery.fromJson("attribute"), - highlightPreTag: "", - highlightPostTag: "", - hitsPerPage: 10, - ignorePlurals: false, - indexLanguages: [ - SupportedLanguage.fromJson("fr"), - ], - keepDiacriticsOnCharacters: "abc", - maxFacetHits: 20, - maxValuesPerFacet: 30, - minProximity: 6, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - mode: Mode.fromJson("neuralSearch"), - numericAttributesForFiltering: [ - "algolia", - ], - optionalWords: [ - "myspace", - ], - paginationLimitedTo: 0, - queryLanguages: [ - SupportedLanguage.fromJson("fr"), - ], - queryType: QueryType.fromJson("prefixLast"), - ranking: [ - "geo", - ], - reRankingApplyFilter: "mySearch:filters", - relevancyStrictness: 10, - removeStopWords: false, - removeWordsIfNoResults: RemoveWordsIfNoResults.fromJson("lastWords"), - renderingContent: RenderingContent( - facetOrdering: FacetOrdering( - facets: Facets( - order: [ - "a", - "b", - ], - ), - values: { - 'a': Value( - order: [ - "b", - ], - sortRemainingBy: SortRemainingBy.fromJson("count"), - ), - }, - ), - ), - replaceSynonymsInHighlight: true, - replicas: [ - "", - ], - responseFields: [ - "algolia", - ], - restrictHighlightAndSnippetArrays: true, - searchableAttributes: [ - "foo", - ], - semanticSearch: SemanticSearch( - eventSources: [ - "foo", - ], - ), - separatorsToIndex: "bar", - snippetEllipsisText: "---", - sortFacetValuesBy: "date", - typoTolerance: false, - unretrievableAttributes: [ - "foo", - ], - userData: { - 'user': "data", - }, + attributeForDistinct: "url", ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}"""); + expectBody(request.body, """{"attributeForDistinct":"url"}"""); }, ), ); // setSettings test( - 'searchableAttributesWithCustomRankingsAndAttributesForFaceting', + 'set_distinct', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6807,35 +10954,22 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "brand", - "name", - "categories", - "unordered(description)", - ], - customRanking: [ - "desc(popularity)", - ], - attributesForFaceting: [ - "searchable(brand)", - "type", - "categories", - "price", - ], + distinct: 1, + attributeForDistinct: "url", ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}"""); + expectBody( + request.body, """{"distinct":1,"attributeForDistinct":"url"}"""); }, ), ); // setSettings test( - 'searchableAttributesProductReferenceSuffixes', + 'set_replace_synonyms_in_highlights', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6845,25 +10979,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "name", - "product_reference", - "product_reference_suffixes", - ], + replaceSynonymsInHighlight: false, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}"""); + expectBody(request.body, """{"replaceSynonymsInHighlight":false}"""); }, ), ); // setSettings test( - 'queryLanguageAndIgnorePlurals', + 'set_min_proximity', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6873,24 +11002,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - queryLanguages: [ - SupportedLanguage.fromJson("en"), - ], - ignorePlurals: true, + minProximity: 1, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody( - request.body, """{"queryLanguages":["en"],"ignorePlurals":true}"""); + expectBody(request.body, """{"minProximity":1}"""); }, ), ); // setSettings test( - 'searchableAttributesInMovies', + 'set_default_field', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6898,27 +11023,28 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "movies", + indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "title_eng", - "title_fr", - "title_es", + responseFields: [ + "hits", + "hitsPerPage", + "nbPages", + "page", ], ), ), intercept: (request) { - expectPath(request.path, '/1/indexes/movies/settings'); + expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"searchableAttributes":["title_eng","title_fr","title_es"]}"""); + """{"responseFields":["hits","hitsPerPage","nbPages","page"]}"""); }, ), ); // setSettings test( - 'disablePrefixOnAttributes', + 'set_max_facet_hits', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6928,23 +11054,20 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - disablePrefixOnAttributes: [ - "serial_number", - ], + maxFacetHits: 10, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody(request.body, - """{"disablePrefixOnAttributes":["serial_number"]}"""); + expectBody(request.body, """{"maxFacetHits":10}"""); }, ), ); // setSettings test( - 'disableTypoToleranceOnAttributes', + 'set_attribute_criteria_computed_by_min_proximity', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6954,23 +11077,21 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - disableTypoToleranceOnAttributes: [ - "serial_number", - ], + attributeCriteriaComputedByMinProximity: true, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"disableTypoToleranceOnAttributes":["serial_number"]}"""); + """{"attributeCriteriaComputedByMinProximity":true}"""); }, ), ); // setSettings test( - 'searchableAttributesSimpleExample', + 'set_user_data', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -6980,23 +11101,24 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "serial_number", - ], + userData: { + 'extraData': + "This is the custom data that you want to store in your index", + }, ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); - expectBody( - request.body, """{"searchableAttributes":["serial_number"]}"""); + expectBody(request.body, + """{"userData":{"extraData":"This is the custom data that you want to store in your index"}}"""); }, ), ); // setSettings test( - 'searchableAttributesSimpleExampleAlt', + 'set_rendering_content', () => runTest( builder: (requester) => SearchClient( appId: 'appId', @@ -7006,17 +11128,42 @@ void main() { call: (client) => client.setSettings( indexName: "theIndexName", indexSettings: IndexSettings( - searchableAttributes: [ - "serial_number", - "serial_number_suffixes", - ], + renderingContent: RenderingContent( + facetOrdering: FacetOrdering( + facets: Facets( + order: [ + "size", + "brand", + ], + ), + values: { + 'brand': Value( + order: [ + "uniqlo", + ], + hide: [ + "muji", + ], + sortRemainingBy: SortRemainingBy.fromJson("count"), + ), + 'size': Value( + order: [ + "S", + "M", + "L", + ], + sortRemainingBy: SortRemainingBy.fromJson("hidden"), + ), + }, + ), + ), ), ), intercept: (request) { expectPath(request.path, '/1/indexes/theIndexName/settings'); expect(request.method, 'put'); expectBody(request.body, - """{"searchableAttributes":["serial_number","serial_number_suffixes"]}"""); + """{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}"""); }, ), ); diff --git a/tests/output/go/tests/requests/search_test.go b/tests/output/go/tests/requests/search_test.go index ea820936df..5665aa323d 100644 --- a/tests/output/go/tests/requests/search_test.go +++ b/tests/output/go/tests/requests/search_test.go @@ -2459,6 +2459,60 @@ func TestSearch_SearchSingleIndex(t *testing.T) { ja := jsonassert.New(t) ja.Assertf(*echo.Body, `{"facetFilters":["publisher:Penguin",["author:Stephen King","genre:Horror"]]}`) }) + t.Run("facetFiltersBook", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facetFilters":["category:Book"]}`) + }) + t.Run("facetFiltersAND", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("author:John Doe")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facetFilters":["category:Book","author:John Doe"]}`) + }) + t.Run("facetFiltersOR", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("author:John Doe")})}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}`) + }) + t.Run("facetFiltersCombined", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetFilters(search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("author:John Doe"), *search.ArrayOfFacetFiltersAsFacetFilters( + []search.FacetFilters{*search.StringAsFacetFilters("category:Book"), *search.StringAsFacetFilters("category:Movie")})}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}`) + }) t.Run("facetFiltersNeg", func(t *testing.T) { _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( @@ -2712,6 +2766,18 @@ func TestSearch_SearchSingleIndex(t *testing.T) { ja := jsonassert.New(t) ja.Assertf(*echo.Body, `{"userToken":"user-1"}`) }) + t.Run("userToken1234", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetUserToken("user-1234")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","userToken":"user-1234"}`) + }) t.Run("analyticsTag", func(t *testing.T) { _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( @@ -2751,910 +2817,2827 @@ func TestSearch_SearchSingleIndex(t *testing.T) { ja := jsonassert.New(t) ja.Assertf(*echo.Body, `{"filters":"categoryPageId: Men's Clothing","hitsPerPage":50,"analyticsTags":["mens-clothing"]}`) }) -} + t.Run("attributesToHighlightOverride", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToHighlight( + []string{"title", "content"})))) + require.NoError(t, err) -func TestSearch_SearchSynonyms(t *testing.T) { - client, echo := createSearchClient(t) - _ = echo + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) - t.Run("searchSynonyms with minimal parameters", func(t *testing.T) { - _, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( - "indexName")) + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","attributesToHighlight":["title","content"]}`) + }) + t.Run("disableTypoToleranceOnAttributes", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDisableTypoToleranceOnAttributes( + []string{"serial_number"})))) require.NoError(t, err) - require.Equal(t, "/1/indexes/indexName/synonyms/search", echo.Path) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{}`) + ja.Assertf(*echo.Body, `{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}`) }) - t.Run("searchSynonyms with all parameters", func(t *testing.T) { - _, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( - "indexName").WithSearchSynonymsParams( - search.NewEmptySearchSynonymsParams().SetQuery("myQuery").SetType(search.SynonymType("altcorrection1")).SetPage(10).SetHitsPerPage(10))) + t.Run("search_a_query", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("shirt")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/indexName/synonyms/search", echo.Path) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}`) + ja.Assertf(*echo.Body, `{"query":"shirt"}`) }) -} - -func TestSearch_SearchUserIds(t *testing.T) { - client, echo := createSearchClient(t) - _ = echo + t.Run("search_everything", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("")))) + require.NoError(t, err) - t.Run("searchUserIds", func(t *testing.T) { - _, err := client.SearchUserIds(client.NewApiSearchUserIdsRequest( + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) - search.NewEmptySearchUserIdsParams().SetQuery("test").SetClusterName("theClusterName").SetPage(5).SetHitsPerPage(10))) + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":""}`) + }) + t.Run("api_filtering_range_example", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("books").SetFilters("price:10 TO 20")))) require.NoError(t, err) - require.Equal(t, "/1/clusters/mapping/search", echo.Path) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}`) + ja.Assertf(*echo.Body, `{"query":"books","filters":"price:10 TO 20"}`) }) -} - -func TestSearch_SetDictionarySettings(t *testing.T) { - client, echo := createSearchClient(t) - _ = echo + t.Run("search_a_query", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetSimilarQuery("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen").SetFilters("year:1991 TO 2001")))) + require.NoError(t, err) - t.Run("get setDictionarySettings results with minimal parameters", func(t *testing.T) { - _, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) - search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( - search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true})))) + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}`) + }) + t.Run("override_retrievable_attributes", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToRetrieve( + []string{"title", "content"})))) require.NoError(t, err) - require.Equal(t, "/1/dictionaries/*/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}`) + ja.Assertf(*echo.Body, `{"query":"query","attributesToRetrieve":["title","content"]}`) }) - t.Run("get setDictionarySettings results with all parameters", func(t *testing.T) { - _, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( - - search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( - search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true}).SetStopwords(map[string]bool{"fr": false}).SetCompounds(map[string]bool{"ru": true})))) + t.Run("restrict_searchable_attributes", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRestrictSearchableAttributes( + []string{"title", "author"})))) require.NoError(t, err) - require.Equal(t, "/1/dictionaries/*/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}`) + ja.Assertf(*echo.Body, `{"query":"query","restrictSearchableAttributes":["title","author"]}`) }) -} + t.Run("override_default_relevancy", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRelevancyStrictness(70)))) + require.NoError(t, err) -func TestSearch_SetSettings(t *testing.T) { - client, echo := createSearchClient(t) - _ = echo + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) - t.Run("minimal parameters", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "cts_e2e_settings", - search.NewEmptyIndexSettings().SetPaginationLimitedTo(10)).WithForwardToReplicas(true)) + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","relevancyStrictness":70}`) + }) + t.Run("apply_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("(category:Book OR category:Ebook) AND _tags:published")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/cts_e2e_settings/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"paginationLimitedTo":10}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}`) }) - t.Run("boolean typoTolerance", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))).WithForwardToReplicas(true)) + t.Run("apply_all_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("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\"")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"typoTolerance":true}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.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\""}`) }) - t.Run("enum typoTolerance", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetTypoTolerance(search.TypoToleranceEnumAsTypoTolerance(search.TypoToleranceEnum("min")))).WithForwardToReplicas(true)) + t.Run("escape_spaces", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("category:\"Books and Comics\"")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"typoTolerance":"min"}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"query":"query","filters":"category:\"Books and Comics\""}`) }) - t.Run("ignorePlurals", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetIgnorePlurals(search.BoolAsIgnorePlurals(true))).WithForwardToReplicas(true)) + t.Run("escape_keywords", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("keyword:\"OR\"")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"ignorePlurals":true}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"query":"query","filters":"keyword:\"OR\""}`) }) - t.Run("list of string ignorePlurals", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( - []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + t.Run("escape_single_quotes", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("content:\"It's a wonderful day\"")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"ignorePlurals":["fr"]}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"query":"query","filters":"content:\"It's a wonderful day\""}`) }) - t.Run("removeStopWords boolean", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetRemoveStopWords(search.BoolAsRemoveStopWords(true))).WithForwardToReplicas(true)) + t.Run("escape_double_quotes", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFilters("content:\"She said \"Hello World\"")))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"removeStopWords":true}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"query":"query","filters":"content:\"She said \"Hello World\""}`) }) - t.Run("removeStopWords list of string", func(t *testing.T) { - _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "theIndexName", - search.NewEmptyIndexSettings().SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( - []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + t.Run("apply_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalFilters(search.ArrayOfOptionalFiltersAsOptionalFilters( + []search.OptionalFilters{*search.StringAsOptionalFilters("category:Book"), *search.StringAsOptionalFilters("author:John Doe")}))))) require.NoError(t, err) - require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) - require.Equal(t, "PUT", echo.Method) + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"removeStopWords":["fr"]}`) - queryParams := map[string]string{} + ja.Assertf(*echo.Body, `{"query":"query","optionalFilters":["category:Book","author:John Doe"]}`) + }) + t.Run("apply_negative_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalFilters(search.ArrayOfOptionalFiltersAsOptionalFilters( + []search.OptionalFilters{*search.StringAsOptionalFilters("category:Book"), *search.StringAsOptionalFilters("author:-John Doe")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}`) + }) + t.Run("apply_numeric_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetNumericFilters(search.ArrayOfNumericFiltersAsNumericFilters( + []search.NumericFilters{*search.StringAsNumericFilters("price < 1000"), *search.ArrayOfNumericFiltersAsNumericFilters( + []search.NumericFilters{*search.StringAsNumericFilters("inStock = 1"), *search.StringAsNumericFilters("deliveryDate < 1441755506")})}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}`) + }) + t.Run("apply_tag_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetTagFilters(search.ArrayOfTagFiltersAsTagFilters( + []search.TagFilters{*search.StringAsTagFilters("SciFi"), *search.ArrayOfTagFiltersAsTagFilters( + []search.TagFilters{*search.StringAsTagFilters("Book"), *search.StringAsTagFilters("Movie")})}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}`) + }) + t.Run("apply_filters", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSumOrFiltersScores(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","sumOrFiltersScores":true}`) + }) + t.Run("facets_all", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacets( + []string{"*"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facets":["*"]}`) + }) + t.Run("retrieve_only_some_facets", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacets( + []string{"category", "author"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facets":["category","author"]}`) + }) + t.Run("override_default_max_values_per_facet", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMaxValuesPerFacet(20)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","maxValuesPerFacet":20}`) + }) + t.Run("enable_faceting_after_distinct", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetFacetingAfterDistinct(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","facetingAfterDistinct":true}`) + }) + t.Run("sort_facet_values_alphabetically", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSortFacetValuesBy("count")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","sortFacetValuesBy":"count"}`) + }) + t.Run("override_attributes_to_snippet", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAttributesToSnippet( + []string{"title", "content:80"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","attributesToSnippet":["title","content:80"]}`) + }) + t.Run("override_default_highlight_pre_tag", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHighlightPreTag("")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","highlightPreTag":""}`) + }) + t.Run("override_default_highlight_post_tag", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHighlightPostTag("")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","highlightPostTag":""}`) + }) + t.Run("override_default_snippet_ellipsis_text", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSnippetEllipsisText("")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","snippetEllipsisText":""}`) + }) + t.Run("enable_restrict_highlight_and_snippet_arrays", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRestrictHighlightAndSnippetArrays(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","restrictHighlightAndSnippetArrays":false}`) + }) + t.Run("access_page", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPage(0)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","page":0}`) + }) + t.Run("override_default_hits_per_page", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetHitsPerPage(10)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","hitsPerPage":10}`) + }) + t.Run("get_nth_hit", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOffset(4)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","offset":4}`) + }) + t.Run("get_n_results", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetLength(4)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","length":4}`) + }) + t.Run("override_default_min_word_size_for_one_typo", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinWordSizefor1Typo(2)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","minWordSizefor1Typo":2}`) + }) + t.Run("override_default_min_word_size_for_two_typos", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinWordSizefor2Typos(2)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","minWordSizefor2Typos":2}`) + }) + t.Run("override_default_typo_tolerance_mode", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetTypoTolerance(search.BoolAsTypoTolerance(false))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","typoTolerance":false}`) + }) + t.Run("disable_typos_on_numeric_tokens_at_search_time", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAllowTyposOnNumericTokens(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","allowTyposOnNumericTokens":false}`) + }) + t.Run("search_around_a_position", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundLatLng("40.71, -74.01")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundLatLng":"40.71, -74.01"}`) + }) + t.Run("search_around_server_ip", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundLatLngViaIP(true))), search.WithHeaderParam("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to search around")) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundLatLngViaIP":true}`) + headers := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}`), &headers)) + for k, v := range headers { + require.Equal(t, v, echo.Header.Get(k)) + } + }) + t.Run("set_around_radius", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundRadius(search.Int32AsAroundRadius(1000))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundRadius":1000}`) + }) + t.Run("disable_automatic_radius", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundRadius(search.AroundRadiusAllAsAroundRadius(search.AroundRadiusAll("all")))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundRadius":"all"}`) + }) + t.Run("set_geo_search_precision", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundPrecision(search.Int32AsAroundPrecision(100))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundPrecision":100}`) + }) + t.Run("set_geo_search_precision_non_linear", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAroundPrecision(search.ArrayOfModelRangeAsAroundPrecision( + []search.ModelRange{*search.NewEmptyModelRange().SetFrom(0).SetValue(25), *search.NewEmptyModelRange().SetFrom(2000).SetValue(1000)}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}`) + }) + t.Run("set_minimum_geo_search_radius", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinimumAroundRadius(1000)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","minimumAroundRadius":1000}`) + }) + t.Run("search_inside_rectangular_area", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625}}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}`) + }) + t.Run("search_inside_multiple_rectangular_areas", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsideBoundingBox(search.ArrayOfArrayOfFloat64AsInsideBoundingBox( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625}, + []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875}}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}`) + }) + t.Run("search_inside_polygon_area", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsidePolygon( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625}})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}`) + }) + t.Run("search_inside_multiple_polygon_areas", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetInsidePolygon( + [][]float64{ + []float64{46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625}, + []float64{49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625}})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.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]]}`) + }) + t.Run("set_querylanguages_override", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","ignorePlurals":["ca","es"]}`) + }) + t.Run("set_querylanguages_override", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","removeStopWords":["ca","es"]}`) + }) + t.Run("set_querylanguages_override", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("ca"), search.SupportedLanguage("es")}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","removeStopWords":["ca","es"]}`) + }) + t.Run("set_querylanguages_with_japanese_query", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja"), search.SupportedLanguage("en")})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","queryLanguages":["ja","en"]}`) + }) + t.Run("set_natural_languages", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetNaturalLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"","naturalLanguages":["fr"]}`) + }) + t.Run("override_natural_languages_with_query", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("").SetNaturalLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("firstWords"))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}`) + }) + t.Run("enable_decompound_query_search_time", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDecompoundQuery(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","decompoundQuery":true}`) + }) + t.Run("enable_rules_search_time", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableRules(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enableRules":true}`) + }) + t.Run("set_rule_contexts", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRuleContexts( + []string{"front_end", "website2"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","ruleContexts":["front_end","website2"]}`) + }) + t.Run("enable_personalization", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enablePersonalization":true}`) + }) + t.Run("enable_personalization_with_user_token", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true).SetUserToken("123456")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enablePersonalization":true,"userToken":"123456"}`) + }) + t.Run("personalization_impact", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPersonalizationImpact(20)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","personalizationImpact":20}`) + }) + t.Run("set_user_token", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetUserToken("123456")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","userToken":"123456"}`) + }) + t.Run("set_user_token_with_personalization", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnablePersonalization(true).SetUserToken("123456")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enablePersonalization":true,"userToken":"123456"}`) + }) + t.Run("override_default_query_type", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetQueryType(search.QueryType("prefixAll"))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","queryType":"prefixAll"}`) + }) + t.Run("override_default_remove_words_if_no_results", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords"))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","removeWordsIfNoResults":"lastWords"}`) + }) + t.Run("enable_advanced_syntax_search_time", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","advancedSyntax":true}`) + }) + t.Run("overide_default_optional_words", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"toyota", "2020 2021"}))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","optionalWords":["toyota","2020 2021"]}`) + }) + t.Run("disabling_exact_for_some_attributes_search_time", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDisableExactOnAttributes( + []string{"description"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","disableExactOnAttributes":["description"]}`) + }) + t.Run("override_default_exact_single_word_query", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("none"))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","exactOnSingleWordQuery":"none"}`) + }) + t.Run("override_default_aternative_as_exact", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("multiWordsSynonym")})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","alternativesAsExact":["multiWordsSynonym"]}`) + }) + t.Run("enable_advanced_syntax_exact_phrase", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}`) + }) + t.Run("enable_advanced_syntax_exclude_words", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("excludeWords")})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}`) + }) + t.Run("override_distinct", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetDistinct(search.Int32AsDistinct(0))))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","distinct":0}`) + }) + t.Run("get_ranking_info", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetGetRankingInfo(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","getRankingInfo":true}`) + }) + t.Run("disable_click_analytics", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetClickAnalytics(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","clickAnalytics":false}`) + }) + t.Run("enable_click_analytics", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetClickAnalytics(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","clickAnalytics":true}`) + }) + t.Run("disable_analytics", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAnalytics(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","analytics":false}`) + }) + t.Run("add_analytics_tags", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetAnalyticsTags( + []string{"front_end", "website2"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","analyticsTags":["front_end","website2"]}`) + }) + t.Run("disable_synonyms", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetSynonyms(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","synonyms":false}`) + }) + t.Run("override_replace_synonyms_in_highlights", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetReplaceSynonymsInHighlight(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","replaceSynonymsInHighlight":true}`) + }) + t.Run("override_min_proximity", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetMinProximity(2)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","minProximity":2}`) + }) + t.Run("override_default_field", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetResponseFields( + []string{"hits", "facets"})))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","responseFields":["hits","facets"]}`) + }) + t.Run("override_percentile_computation", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetPercentileComputation(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","percentileComputation":false}`) + }) + t.Run("set_ab_test", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableABTest(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enableABTest":false}`) + }) + t.Run("set_enable_re_ranking", func(t *testing.T) { + _, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest( + "indexName").WithSearchParams(search.SearchParamsObjectAsSearchParams( + search.NewEmptySearchParamsObject().SetQuery("query").SetEnableReRanking(false)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/query", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"query","enableReRanking":false}`) + }) +} + +func TestSearch_SearchSynonyms(t *testing.T) { + client, echo := createSearchClient(t) + _ = echo + + t.Run("searchSynonyms with minimal parameters", func(t *testing.T) { + _, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( + "indexName")) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/synonyms/search", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{}`) + }) + t.Run("searchSynonyms with all parameters", func(t *testing.T) { + _, err := client.SearchSynonyms(client.NewApiSearchSynonymsRequest( + "indexName").WithSearchSynonymsParams( + search.NewEmptySearchSynonymsParams().SetQuery("myQuery").SetType(search.SynonymType("altcorrection1")).SetPage(10).SetHitsPerPage(10))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/indexName/synonyms/search", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}`) + }) +} + +func TestSearch_SearchUserIds(t *testing.T) { + client, echo := createSearchClient(t) + _ = echo + + t.Run("searchUserIds", func(t *testing.T) { + _, err := client.SearchUserIds(client.NewApiSearchUserIdsRequest( + + search.NewEmptySearchUserIdsParams().SetQuery("test").SetClusterName("theClusterName").SetPage(5).SetHitsPerPage(10))) + require.NoError(t, err) + + require.Equal(t, "/1/clusters/mapping/search", echo.Path) + require.Equal(t, "POST", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}`) + }) +} + +func TestSearch_SetDictionarySettings(t *testing.T) { + client, echo := createSearchClient(t) + _ = echo + + t.Run("get setDictionarySettings results with minimal parameters", func(t *testing.T) { + _, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( + + search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( + search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true})))) + require.NoError(t, err) + + require.Equal(t, "/1/dictionaries/*/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}`) + }) + t.Run("get setDictionarySettings results with all parameters", func(t *testing.T) { + _, err := client.SetDictionarySettings(client.NewApiSetDictionarySettingsRequest( + + search.NewEmptyDictionarySettingsParams().SetDisableStandardEntries( + search.NewEmptyStandardEntries().SetPlurals(map[string]bool{"fr": false, "en": false, "ru": true}).SetStopwords(map[string]bool{"fr": false}).SetCompounds(map[string]bool{"ru": true})))) + require.NoError(t, err) + + require.Equal(t, "/1/dictionaries/*/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}`) + }) +} + +func TestSearch_SetSettings(t *testing.T) { + client, echo := createSearchClient(t) + _ = echo + + t.Run("minimal parameters", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "cts_e2e_settings", + search.NewEmptyIndexSettings().SetPaginationLimitedTo(10)).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/cts_e2e_settings/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"paginationLimitedTo":10}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("boolean typoTolerance", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"typoTolerance":true}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("enum typoTolerance", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetTypoTolerance(search.TypoToleranceEnumAsTypoTolerance(search.TypoToleranceEnum("min")))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"typoTolerance":"min"}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("ignorePlurals", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetIgnorePlurals(search.BoolAsIgnorePlurals(true))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ignorePlurals":true}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("list of string ignorePlurals", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetIgnorePlurals(search.ArrayOfSupportedLanguageAsIgnorePlurals( + []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ignorePlurals":["fr"]}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("removeStopWords boolean", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRemoveStopWords(search.BoolAsRemoveStopWords(true))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"removeStopWords":true}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("removeStopWords list of string", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRemoveStopWords(search.ArrayOfSupportedLanguageAsRemoveStopWords( + []search.SupportedLanguage{search.SupportedLanguage("fr")}))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"removeStopWords":["fr"]}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("boolean distinct", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"distinct":true}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("integer distinct", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1))).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"distinct":1}`) + queryParams := map[string]string{} + require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) + require.Len(t, queryParams, len(echo.Query)) + for k, v := range queryParams { + require.Equal(t, v, echo.Query.Get(k)) + } + }) + t.Run("distinct company", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributeForDistinct("company").SetDistinct(search.BoolAsDistinct(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributeForDistinct":"company","distinct":true}`) + }) + t.Run("distinct design", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributeForDistinct("design").SetDistinct(search.BoolAsDistinct(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributeForDistinct":"design","distinct":true}`) + }) + t.Run("distinct true", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"distinct":true}`) + }) + t.Run("distinct section", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributeForDistinct("section").SetDistinct(search.BoolAsDistinct(true)))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributeForDistinct":"section","distinct":true}`) + }) + t.Run("attributesForFaceting allergens", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"allergens"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["allergens"]}`) + }) + t.Run("api_attributes_for_faceting", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"genre", "author"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["genre","author"]}`) + }) + t.Run("api_attributes_for_faceting_searchable", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"genre", "searchable(author)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["genre","searchable(author)"]}`) + }) + t.Run("api_attributes_for_filter_only", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(genre)", "author"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["filterOnly(genre)","author"]}`) + }) + t.Run("attributesForFaceting categoryPageId", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"searchable(categoryPageId)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["searchable(categoryPageId)"]}`) + }) + t.Run("unretrievableAttributes", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetUnretrievableAttributes( + []string{"visible_by"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"unretrievableAttributes":["visible_by"]}`) + }) + t.Run("attributesForFaceting user restricted data", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(visible_by)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["filterOnly(visible_by)"]}`) + }) + t.Run("attributesForFaceting optional filters", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"can_deliver_quickly", "restaurant"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["can_deliver_quickly","restaurant"]}`) + }) + t.Run("attributesForFaceting redirect index", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"query_terms"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["query_terms"]}`) + }) + t.Run("attributesForFaceting multiple consequences", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"director"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["director"]}`) + }) + t.Run("attributesForFaceting in-depth optional filters", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"filterOnly(brand)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["filterOnly(brand)"]}`) + }) + t.Run("mode neuralSearch", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"mode":"neuralSearch"}`) + }) + t.Run("mode keywordSearch", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"mode":"keywordSearch"}`) + }) + t.Run("searchableAttributes same priority", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title,comments", "ingredients"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["title,comments","ingredients"]}`) + }) + t.Run("searchableAttributes higher priority", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title", "ingredients"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["title","ingredients"]}`) + }) + t.Run("customRanking retweets", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(retweets)", "desc(likes)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(retweets)","desc(likes)"]}`) + }) + t.Run("customRanking boosted", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(boosted)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(boosted)"]}`) + }) + t.Run("customRanking pageviews", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(pageviews)", "desc(comments)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(pageviews)","desc(comments)"]}`) + }) + t.Run("customRanking applying search parameters for a specific query", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(nb_airline_liaisons)"}).SetAttributesForFaceting( + []string{"city, country"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}`) + }) + t.Run("customRanking rounded pageviews", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(rounded_pageviews)", "desc(comments)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}`) + }) + t.Run("customRanking price", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(price)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(price)"]}`) + }) + t.Run("ranking exhaustive", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + }) + t.Run("ranking standard replica", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(post_date_timestamp)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["desc(post_date_timestamp)"]}`) + }) + t.Run("ranking virtual replica", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(post_date_timestamp)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(post_date_timestamp)"]}`) + }) + t.Run("customRanking and ranking sort alphabetically", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"asc(textual_attribute)"}).SetRanking( + []string{"custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}`) + }) + t.Run("relevancyStrictness", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"asc(textual_attribute)"}).SetRelevancyStrictness(0))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}`) + }) + t.Run("create replica index", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetReplicas( + []string{"products_price_desc"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"replicas":["products_price_desc"]}`) + }) + t.Run("create replica index articles", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetReplicas( + []string{"articles_date_desc"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"replicas":["articles_date_desc"]}`) + }) + t.Run("create virtual replica index", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetReplicas( + []string{"virtual(products_price_desc)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"replicas":["virtual(products_price_desc)"]}`) + }) + t.Run("unlink replica index", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetReplicas( + []string{""}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"replicas":[""]}`) + }) + t.Run("forwardToReplicas", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "description"})).WithForwardToReplicas(true)) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["name","description"]}`) + queryParams := map[string]string{} require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) require.Len(t, queryParams, len(echo.Query)) for k, v := range queryParams { require.Equal(t, v, echo.Query.Get(k)) } }) - t.Run("boolean distinct", func(t *testing.T) { + t.Run("maxValuesPerFacet", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMaxValuesPerFacet(1000))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"maxValuesPerFacet":1000}`) + }) + t.Run("maxFacetHits", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMaxFacetHits(1000))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"maxFacetHits":1000}`) + }) + t.Run("attributesForFaceting complex", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "", + search.NewEmptyIndexSettings().SetAttributesForFaceting( + []string{"actor", "filterOnly(category)", "searchable(publisher)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}`) + }) + t.Run("ranking closest dates", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + }) + t.Run("searchableAttributes item variation", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"design", "type", "color"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["design","type","color"]}`) + }) + t.Run("searchableAttributes around location", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "country", "code", "iata_code"}).SetCustomRanking( + []string{"desc(links_count)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}`) + }) + t.Run("attributesToHighlight", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToHighlight( + []string{"author", "title", "content"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToHighlight":["author","title","content"]}`) + }) + t.Run("attributesToHighlightStar", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToHighlight( + []string{"*"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToHighlight":["*"]}`) + }) + t.Run("everything", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( + []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")}).SetAllowCompressionOfIntegerArray(true).SetAllowTyposOnNumericTokens(true).SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("singleWordSynonym")}).SetAttributeCriteriaComputedByMinProximity(true).SetAttributeForDistinct("test").SetAttributesForFaceting( + []string{"algolia"}).SetAttributesToHighlight( + []string{"algolia"}).SetAttributesToRetrieve( + []string{"algolia"}).SetAttributesToSnippet( + []string{"algolia"}).SetAttributesToTransliterate( + []string{"algolia"}).SetCamelCaseAttributes( + []string{"algolia"}).SetCustomNormalization(map[string]map[string]string{"algolia": map[string]string{"aloglia": "aglolia"}}).SetCustomRanking( + []string{"algolia"}).SetDecompoundQuery(false).SetDecompoundedAttributes(map[string]any{"algolia": "aloglia"}).SetDisableExactOnAttributes( + []string{"algolia"}).SetDisablePrefixOnAttributes( + []string{"algolia"}).SetDisableTypoToleranceOnAttributes( + []string{"algolia"}).SetDisableTypoToleranceOnWords( + []string{"algolia"}).SetDistinct(search.Int32AsDistinct(3)).SetEnablePersonalization(true).SetEnableReRanking(false).SetEnableRules(true).SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")).SetHighlightPreTag("").SetHighlightPostTag("").SetHitsPerPage(10).SetIgnorePlurals(search.BoolAsIgnorePlurals(false)).SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetKeepDiacriticsOnCharacters("abc").SetMaxFacetHits(20).SetMaxValuesPerFacet(30).SetMinProximity(6).SetMinWordSizefor1Typo(5).SetMinWordSizefor2Typos(11).SetMode(search.Mode("neuralSearch")).SetNumericAttributesForFiltering( + []string{"algolia"}).SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"myspace"})).SetPaginationLimitedTo(0).SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetQueryType(search.QueryType("prefixLast")).SetRanking( + []string{"geo"}).SetReRankingApplyFilter(search.StringAsReRankingApplyFilter("mySearch:filters")).SetRelevancyStrictness(10).SetRemoveStopWords(search.BoolAsRemoveStopWords(false)).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords")).SetRenderingContent( + search.NewEmptyRenderingContent().SetFacetOrdering( + search.NewEmptyFacetOrdering().SetFacets( + search.NewEmptyFacets().SetOrder( + []string{"a", "b"})).SetValues(map[string]search.Value{"a": *search.NewEmptyValue().SetOrder( + []string{"b"}).SetSortRemainingBy(search.SortRemainingBy("count"))}))).SetReplaceSynonymsInHighlight(true).SetReplicas( + []string{""}).SetResponseFields( + []string{"algolia"}).SetRestrictHighlightAndSnippetArrays(true).SetSearchableAttributes( + []string{"foo"}).SetSemanticSearch( + search.NewEmptySemanticSearch().SetEventSources( + []string{"foo"})).SetSeparatorsToIndex("bar").SetSnippetEllipsisText("---").SetSortFacetValuesBy("date").SetTypoTolerance(search.BoolAsTypoTolerance(false)).SetUnretrievableAttributes( + []string{"foo"}).SetUserData(map[string]any{"user": "data"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}`) + }) + t.Run("searchableAttributesWithCustomRankingsAndAttributesForFaceting", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"brand", "name", "categories", "unordered(description)"}).SetCustomRanking( + []string{"desc(popularity)"}).SetAttributesForFaceting( + []string{"searchable(brand)", "type", "categories", "price"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}`) + }) + t.Run("searchableAttributesOrdering", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"unordered(title)", "cast"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["unordered(title)","cast"]}`) + }) + t.Run("searchableAttributesProductReferenceSuffixes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"name", "product_reference", "product_reference_suffixes"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"distinct":true}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}`) }) - t.Run("integer distinct", func(t *testing.T) { + t.Run("queryLanguageAndIgnorePlurals", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1))).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("en")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"distinct":1}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"queryLanguages":["en"],"ignorePlurals":true}`) }) - t.Run("distinct company", func(t *testing.T) { + t.Run("searchableAttributesInMovies", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "movies", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title_eng", "title_fr", "title_es"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/movies/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["title_eng","title_fr","title_es"]}`) + }) + t.Run("disablePrefixOnAttributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetAttributeForDistinct("company").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( + []string{"serial_number"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributeForDistinct":"company","distinct":true}`) + ja.Assertf(*echo.Body, `{"disablePrefixOnAttributes":["serial_number"]}`) }) - t.Run("distinct design", func(t *testing.T) { + t.Run("disableTypoToleranceOnAttributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetAttributeForDistinct("design").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( + []string{"serial_number"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributeForDistinct":"design","distinct":true}`) + ja.Assertf(*echo.Body, `{"disableTypoToleranceOnAttributes":["serial_number"]}`) }) - t.Run("distinct true", func(t *testing.T) { + t.Run("searchableAttributesSimpleExample", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"serial_number"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"distinct":true}`) + ja.Assertf(*echo.Body, `{"searchableAttributes":["serial_number"]}`) }) - t.Run("distinct section", func(t *testing.T) { + t.Run("searchableAttributesSimpleExampleAlt", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetAttributeForDistinct("section").SetDistinct(search.BoolAsDistinct(true)))) + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"serial_number", "serial_number_suffixes"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributeForDistinct":"section","distinct":true}`) + ja.Assertf(*echo.Body, `{"searchableAttributes":["serial_number","serial_number_suffixes"]}`) }) - t.Run("attributesForFaceting allergens", func(t *testing.T) { + t.Run("set_searchable_attributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", + "theIndexName", + search.NewEmptyIndexSettings().SetSearchableAttributes( + []string{"title,alternative_title", "author", "unordered(text)", "emails.personal"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}`) + }) + t.Run("set_searchable_attributes", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"allergens"}))) + []string{"author", "filterOnly(isbn)", "searchable(edition)", "afterDistinct(category)", "afterDistinct(searchable(publisher))"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}`) + }) + t.Run("unretrievable_attributes", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetUnretrievableAttributes( + []string{"total_number_of_sales"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"unretrievableAttributes":["total_number_of_sales"]}`) + }) + t.Run("set_retrievable_attributes", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"author", "title", "content"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToRetrieve":["author","title","content"]}`) + }) + t.Run("set_all_attributes_as_retrievable", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"*"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToRetrieve":["*"]}`) + }) + t.Run("specify_attributes_not_to_retrieve", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToRetrieve( + []string{"*", "-SKU", "-internal_desc"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToRetrieve":["*","-SKU","-internal_desc"]}`) + }) + t.Run("neural_search", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"mode":"neuralSearch"}`) + }) + t.Run("keyword_search", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"mode":"keywordSearch"}`) + }) + t.Run("set_default_ranking", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}`) + }) + t.Run("set_ranking_by_attribute_asc", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + }) + t.Run("set_ranking_by_attribute_desc", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRanking( + []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + }) + t.Run("restrict_searchable_attributes", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetCustomRanking( + []string{"desc(popularity)", "asc(price)"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"customRanking":["desc(popularity)","asc(price)"]}`) + }) + t.Run("set_default_relevancy", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetRelevancyStrictness(90))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"relevancyStrictness":90}`) + }) + t.Run("set_replicas", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetReplicas( + []string{"name_of_replica_index1", "name_of_replica_index2"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"replicas":["name_of_replica_index1","name_of_replica_index2"]}`) + }) + t.Run("set_default_max_values_per_facet", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetMaxValuesPerFacet(100))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"maxValuesPerFacet":100}`) + }) + t.Run("set_default_sort_facet_values_by", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetSortFacetValuesBy("alpha"))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"sortFacetValuesBy":"alpha"}`) + }) + t.Run("set_attributes_to_snippet", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToSnippet( + []string{"content:80", "description"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToSnippet":["content:80","description"]}`) + }) + t.Run("set_all_attributes_to_snippet", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetAttributesToSnippet( + []string{"*:80"}))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"attributesToSnippet":["*:80"]}`) + }) + t.Run("set_default_highlight_pre_tag", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetHighlightPreTag(""))) + require.NoError(t, err) + + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) + require.Equal(t, "PUT", echo.Method) + + ja := jsonassert.New(t) + ja.Assertf(*echo.Body, `{"highlightPreTag":""}`) + }) + t.Run("set_default_highlight_post_tag", func(t *testing.T) { + _, err := client.SetSettings(client.NewApiSetSettingsRequest( + "theIndexName", + search.NewEmptyIndexSettings().SetHighlightPostTag(""))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["allergens"]}`) + ja.Assertf(*echo.Body, `{"highlightPostTag":""}`) }) - t.Run("attributesForFaceting categoryPageId", func(t *testing.T) { + t.Run("set_default_snippet_ellipsis_text", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"searchable(categoryPageId)"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetSnippetEllipsisText("…"))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["searchable(categoryPageId)"]}`) + ja.Assertf(*echo.Body, `{"snippetEllipsisText":"…"}`) }) - t.Run("unretrievableAttributes", func(t *testing.T) { + t.Run("enable_restrict_highlight_and_snippet_arrays_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetUnretrievableAttributes( - []string{"visible_by"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetRestrictHighlightAndSnippetArrays(true))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"unretrievableAttributes":["visible_by"]}`) + ja.Assertf(*echo.Body, `{"restrictHighlightAndSnippetArrays":true}`) }) - t.Run("attributesForFaceting user restricted data", func(t *testing.T) { + t.Run("set_default_hits_per_page", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"filterOnly(visible_by)"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetHitsPerPage(20))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["filterOnly(visible_by)"]}`) + ja.Assertf(*echo.Body, `{"hitsPerPage":20}`) }) - t.Run("attributesForFaceting optional filters", func(t *testing.T) { + t.Run("set_pagination_limit", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"can_deliver_quickly", "restaurant"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetPaginationLimitedTo(1000))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["can_deliver_quickly","restaurant"]}`) + ja.Assertf(*echo.Body, `{"paginationLimitedTo":1000}`) }) - t.Run("attributesForFaceting redirect index", func(t *testing.T) { + t.Run("set_default_min_word_size_for_one_typo", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"query_terms"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetMinWordSizefor1Typo(4))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["query_terms"]}`) + ja.Assertf(*echo.Body, `{"minWordSizefor1Typo":4}`) }) - t.Run("attributesForFaceting multiple consequences", func(t *testing.T) { + t.Run("set_default_min_word_size_for_two_typos", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"director"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetMinWordSizefor2Typos(4))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["director"]}`) + ja.Assertf(*echo.Body, `{"minWordSizefor2Typos":4}`) }) - t.Run("attributesForFaceting in-depth optional filters", func(t *testing.T) { + t.Run("set_default_typo_tolerance_mode", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"filterOnly(brand)"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true)))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["filterOnly(brand)"]}`) + ja.Assertf(*echo.Body, `{"typoTolerance":true}`) }) - t.Run("mode neuralSearch", func(t *testing.T) { + t.Run("disable_typos_on_numeric_tokens_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetMode(search.Mode("neuralSearch")))) + search.NewEmptyIndexSettings().SetAllowTyposOnNumericTokens(false))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"mode":"neuralSearch"}`) + ja.Assertf(*echo.Body, `{"allowTyposOnNumericTokens":false}`) }) - t.Run("mode keywordSearch", func(t *testing.T) { + t.Run("disable_typo_tolerance_for_words", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetMode(search.Mode("keywordSearch")))) + search.NewEmptyIndexSettings().SetDisableTypoToleranceOnWords( + []string{"wheel", "1X2BCD"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"mode":"keywordSearch"}`) + ja.Assertf(*echo.Body, `{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}`) }) - t.Run("searchableAttributes same priority", func(t *testing.T) { + t.Run("set_separators_to_index", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title,comments", "ingredients"}))) + search.NewEmptyIndexSettings().SetSeparatorsToIndex("+#"))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["title,comments","ingredients"]}`) + ja.Assertf(*echo.Body, `{"separatorsToIndex":"+#"}`) }) - t.Run("searchableAttributes higher priority", func(t *testing.T) { + t.Run("set_languages_using_querylanguages", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title", "ingredients"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["title","ingredients"]}`) + ja.Assertf(*echo.Body, `{"queryLanguages":["es"],"ignorePlurals":true}`) }) - t.Run("customRanking retweets", func(t *testing.T) { + t.Run("set_attributes_to_transliterate", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(retweets)", "desc(likes)"}))) + search.NewEmptyIndexSettings().SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja")}).SetAttributesToTransliterate( + []string{"name", "description"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(retweets)","desc(likes)"]}`) + ja.Assertf(*echo.Body, `{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}`) }) - t.Run("customRanking boosted", func(t *testing.T) { + t.Run("set_languages_using_querylanguages", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(boosted)"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetRemoveStopWords(search.BoolAsRemoveStopWords(true)))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(boosted)"]}`) + ja.Assertf(*echo.Body, `{"queryLanguages":["es"],"removeStopWords":true}`) }) - t.Run("customRanking pageviews", func(t *testing.T) { + t.Run("set_camel_case_attributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(pageviews)", "desc(comments)"}))) + search.NewEmptyIndexSettings().SetCamelCaseAttributes( + []string{"description"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(pageviews)","desc(comments)"]}`) + ja.Assertf(*echo.Body, `{"camelCaseAttributes":["description"]}`) }) - t.Run("customRanking applying search parameters for a specific query", func(t *testing.T) { + t.Run("set_decompounded_attributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(nb_airline_liaisons)"}).SetAttributesForFaceting( - []string{"city, country"}))) + search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{"de": []string{"name"}}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}`) + ja.Assertf(*echo.Body, `{"decompoundedAttributes":{"de":["name"]}}`) }) - t.Run("customRanking rounded pageviews", func(t *testing.T) { + t.Run("set_decompounded_multiple_attributes", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(rounded_pageviews)", "desc(comments)"}))) + search.NewEmptyIndexSettings().SetDecompoundedAttributes(map[string]any{"de": []string{"name_de", "description_de"}, "fi": []string{"name_fi", "description_fi"}}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}`) + ja.Assertf(*echo.Body, `{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}`) }) - t.Run("customRanking price", func(t *testing.T) { + t.Run("set_keep_diacritics_on_characters", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(price)"}))) + search.NewEmptyIndexSettings().SetKeepDiacriticsOnCharacters("øé"))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(price)"]}`) + ja.Assertf(*echo.Body, `{"keepDiacriticsOnCharacters":"øé"}`) }) - t.Run("ranking exhaustive", func(t *testing.T) { + t.Run("set_custom_normalization", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetRanking( - []string{"desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + search.NewEmptyIndexSettings().SetCustomNormalization(map[string]map[string]string{"default": map[string]string{"ä": "ae"}}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + ja.Assertf(*echo.Body, `{"customNormalization":{"default":{"ä":"ae"}}}`) }) - t.Run("ranking standard replica", func(t *testing.T) { + t.Run("set_languages_using_querylanguages", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetRanking( - []string{"desc(post_date_timestamp)"}))) + search.NewEmptyIndexSettings().SetQueryLanguages( + []search.SupportedLanguage{search.SupportedLanguage("es")}).SetRemoveStopWords(search.BoolAsRemoveStopWords(true)).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"ranking":["desc(post_date_timestamp)"]}`) + ja.Assertf(*echo.Body, `{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}`) }) - t.Run("ranking virtual replica", func(t *testing.T) { + t.Run("set_indexlanguages", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"desc(post_date_timestamp)"}))) + search.NewEmptyIndexSettings().SetIndexLanguages( + []search.SupportedLanguage{search.SupportedLanguage("ja")}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["desc(post_date_timestamp)"]}`) + ja.Assertf(*echo.Body, `{"indexLanguages":["ja"]}`) }) - t.Run("customRanking and ranking sort alphabetically", func(t *testing.T) { + t.Run("enable_decompound_query_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"asc(textual_attribute)"}).SetRanking( - []string{"custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"}))) + search.NewEmptyIndexSettings().SetDecompoundQuery(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}`) + ja.Assertf(*echo.Body, `{"decompoundQuery":true}`) }) - t.Run("relevancyStrictness", func(t *testing.T) { + t.Run("enable_rules_syntax_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetCustomRanking( - []string{"asc(textual_attribute)"}).SetRelevancyStrictness(0))) + search.NewEmptyIndexSettings().SetEnableRules(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}`) + ja.Assertf(*echo.Body, `{"enableRules":true}`) }) - t.Run("create replica index", func(t *testing.T) { + t.Run("enable_personalization_settings", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetReplicas( - []string{"products_price_desc"}))) + search.NewEmptyIndexSettings().SetEnablePersonalization(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"replicas":["products_price_desc"]}`) + ja.Assertf(*echo.Body, `{"enablePersonalization":true}`) }) - t.Run("create virtual replica index", func(t *testing.T) { + t.Run("set_default_query_type", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetReplicas( - []string{"virtual(products_price_desc)"}))) + search.NewEmptyIndexSettings().SetQueryType(search.QueryType("prefixLast")))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"replicas":["virtual(products_price_desc)"]}`) + ja.Assertf(*echo.Body, `{"queryType":"prefixLast"}`) }) - t.Run("unlink replica index", func(t *testing.T) { + t.Run("set_default_remove_words_if_no_result", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetReplicas( - []string{""}))) + search.NewEmptyIndexSettings().SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("none")))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"replicas":[""]}`) + ja.Assertf(*echo.Body, `{"removeWordsIfNoResults":"none"}`) }) - t.Run("forwardToReplicas", func(t *testing.T) { + t.Run("enable_advanced_syntax_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "description"})).WithForwardToReplicas(true)) + search.NewEmptyIndexSettings().SetAdvancedSyntax(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["name","description"]}`) - queryParams := map[string]string{} - require.NoError(t, json.Unmarshal([]byte(`{"forwardToReplicas":"true"}`), &queryParams)) - require.Len(t, queryParams, len(echo.Query)) - for k, v := range queryParams { - require.Equal(t, v, echo.Query.Get(k)) - } + ja.Assertf(*echo.Body, `{"advancedSyntax":true}`) }) - t.Run("maxValuesPerFacet", func(t *testing.T) { + t.Run("set_default_optional_words", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetMaxValuesPerFacet(1000))) + search.NewEmptyIndexSettings().SetOptionalWords(search.ArrayOfStringAsOptionalWords( + []string{"blue", "iphone case"})))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"maxValuesPerFacet":1000}`) + ja.Assertf(*echo.Body, `{"optionalWords":["blue","iphone case"]}`) }) - t.Run("maxFacetHits", func(t *testing.T) { + t.Run("disabling_prefix_search_for_some_attributes_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetMaxFacetHits(1000))) + search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( + []string{"sku"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"maxFacetHits":1000}`) + ja.Assertf(*echo.Body, `{"disablePrefixOnAttributes":["sku"]}`) }) - t.Run("attributesForFaceting complex", func(t *testing.T) { + t.Run("disabling_exact_for_some_attributes_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "", - search.NewEmptyIndexSettings().SetAttributesForFaceting( - []string{"actor", "filterOnly(category)", "searchable(publisher)"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetDisableExactOnAttributes( + []string{"description"}))) require.NoError(t, err) - require.Equal(t, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}`) + ja.Assertf(*echo.Body, `{"disableExactOnAttributes":["description"]}`) }) - t.Run("ranking closest dates", func(t *testing.T) { + t.Run("set_default_exact_single_word_query", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetRanking( - []string{"asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"}))) + search.NewEmptyIndexSettings().SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}`) + ja.Assertf(*echo.Body, `{"exactOnSingleWordQuery":"attribute"}`) }) - t.Run("searchableAttributes item variation", func(t *testing.T) { + t.Run("set_default_aternative_as_exact", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"design", "type", "color"}))) + search.NewEmptyIndexSettings().SetAlternativesAsExact( + []search.AlternativesAsExact{search.AlternativesAsExact("ignorePlurals"), search.AlternativesAsExact("singleWordSynonym")}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["design","type","color"]}`) + ja.Assertf(*echo.Body, `{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}`) }) - t.Run("searchableAttributes around location", func(t *testing.T) { + t.Run("enable_advanced_syntax_by_default", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "country", "code", "iata_code"}).SetCustomRanking( - []string{"desc(links_count)"}))) + search.NewEmptyIndexSettings().SetAdvancedSyntax(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}`) + ja.Assertf(*echo.Body, `{"advancedSyntax":true}`) }) - t.Run("searchableAttributes around location", func(t *testing.T) { + t.Run("set_numeric_attributes_for_filtering", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "country", "code", "iata_code"}).SetCustomRanking( - []string{"desc(links_count)"}))) + search.NewEmptyIndexSettings().SetNumericAttributesForFiltering( + []string{"quantity", "popularity"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}`) + ja.Assertf(*echo.Body, `{"numericAttributesForFiltering":["quantity","popularity"]}`) }) - t.Run("disableTypoToleranceOnAttributes", func(t *testing.T) { + t.Run("enable_compression_of_integer_array", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetAllowCompressionOfIntegerArray(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"disableTypoToleranceOnAttributes":["serial_number"]}`) + ja.Assertf(*echo.Body, `{"allowCompressionOfIntegerArray":true}`) }) - t.Run("everything", func(t *testing.T) { + t.Run("set_attributes_for_distinct", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetAdvancedSyntax(true).SetAdvancedSyntaxFeatures( - []search.AdvancedSyntaxFeatures{search.AdvancedSyntaxFeatures("exactPhrase")}).SetAllowCompressionOfIntegerArray(true).SetAllowTyposOnNumericTokens(true).SetAlternativesAsExact( - []search.AlternativesAsExact{search.AlternativesAsExact("singleWordSynonym")}).SetAttributeCriteriaComputedByMinProximity(true).SetAttributeForDistinct("test").SetAttributesForFaceting( - []string{"algolia"}).SetAttributesToHighlight( - []string{"algolia"}).SetAttributesToRetrieve( - []string{"algolia"}).SetAttributesToSnippet( - []string{"algolia"}).SetAttributesToTransliterate( - []string{"algolia"}).SetCamelCaseAttributes( - []string{"algolia"}).SetCustomNormalization(map[string]map[string]string{"algolia": map[string]string{"aloglia": "aglolia"}}).SetCustomRanking( - []string{"algolia"}).SetDecompoundQuery(false).SetDecompoundedAttributes(map[string]any{"algolia": "aloglia"}).SetDisableExactOnAttributes( - []string{"algolia"}).SetDisablePrefixOnAttributes( - []string{"algolia"}).SetDisableTypoToleranceOnAttributes( - []string{"algolia"}).SetDisableTypoToleranceOnWords( - []string{"algolia"}).SetDistinct(search.Int32AsDistinct(3)).SetEnablePersonalization(true).SetEnableReRanking(false).SetEnableRules(true).SetExactOnSingleWordQuery(search.ExactOnSingleWordQuery("attribute")).SetHighlightPreTag("").SetHighlightPostTag("").SetHitsPerPage(10).SetIgnorePlurals(search.BoolAsIgnorePlurals(false)).SetIndexLanguages( - []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetKeepDiacriticsOnCharacters("abc").SetMaxFacetHits(20).SetMaxValuesPerFacet(30).SetMinProximity(6).SetMinWordSizefor1Typo(5).SetMinWordSizefor2Typos(11).SetMode(search.Mode("neuralSearch")).SetNumericAttributesForFiltering( - []string{"algolia"}).SetOptionalWords(search.ArrayOfStringAsOptionalWords( - []string{"myspace"})).SetPaginationLimitedTo(0).SetQueryLanguages( - []search.SupportedLanguage{search.SupportedLanguage("fr")}).SetQueryType(search.QueryType("prefixLast")).SetRanking( - []string{"geo"}).SetReRankingApplyFilter(search.StringAsReRankingApplyFilter("mySearch:filters")).SetRelevancyStrictness(10).SetRemoveStopWords(search.BoolAsRemoveStopWords(false)).SetRemoveWordsIfNoResults(search.RemoveWordsIfNoResults("lastWords")).SetRenderingContent( - search.NewEmptyRenderingContent().SetFacetOrdering( - search.NewEmptyFacetOrdering().SetFacets( - search.NewEmptyFacets().SetOrder( - []string{"a", "b"})).SetValues(map[string]search.Value{"a": *search.NewEmptyValue().SetOrder( - []string{"b"}).SetSortRemainingBy(search.SortRemainingBy("count"))}))).SetReplaceSynonymsInHighlight(true).SetReplicas( - []string{""}).SetResponseFields( - []string{"algolia"}).SetRestrictHighlightAndSnippetArrays(true).SetSearchableAttributes( - []string{"foo"}).SetSemanticSearch( - search.NewEmptySemanticSearch().SetEventSources( - []string{"foo"})).SetSeparatorsToIndex("bar").SetSnippetEllipsisText("---").SetSortFacetValuesBy("date").SetTypoTolerance(search.BoolAsTypoTolerance(false)).SetUnretrievableAttributes( - []string{"foo"}).SetUserData(map[string]any{"user": "data"}))) + search.NewEmptyIndexSettings().SetAttributeForDistinct("url"))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}`) + ja.Assertf(*echo.Body, `{"attributeForDistinct":"url"}`) }) - t.Run("searchableAttributesWithCustomRankingsAndAttributesForFaceting", func(t *testing.T) { + t.Run("set_distinct", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"brand", "name", "categories", "unordered(description)"}).SetCustomRanking( - []string{"desc(popularity)"}).SetAttributesForFaceting( - []string{"searchable(brand)", "type", "categories", "price"}))) + search.NewEmptyIndexSettings().SetDistinct(search.Int32AsDistinct(1)).SetAttributeForDistinct("url"))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}`) + ja.Assertf(*echo.Body, `{"distinct":1,"attributeForDistinct":"url"}`) }) - t.Run("searchableAttributesProductReferenceSuffixes", func(t *testing.T) { + t.Run("set_replace_synonyms_in_highlights", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"name", "product_reference", "product_reference_suffixes"}))) + search.NewEmptyIndexSettings().SetReplaceSynonymsInHighlight(false))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}`) + ja.Assertf(*echo.Body, `{"replaceSynonymsInHighlight":false}`) }) - t.Run("queryLanguageAndIgnorePlurals", func(t *testing.T) { + t.Run("set_min_proximity", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetQueryLanguages( - []search.SupportedLanguage{search.SupportedLanguage("en")}).SetIgnorePlurals(search.BoolAsIgnorePlurals(true)))) + search.NewEmptyIndexSettings().SetMinProximity(1))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"queryLanguages":["en"],"ignorePlurals":true}`) + ja.Assertf(*echo.Body, `{"minProximity":1}`) }) - t.Run("searchableAttributesInMovies", func(t *testing.T) { + t.Run("set_default_field", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( - "movies", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"title_eng", "title_fr", "title_es"}))) + "theIndexName", + search.NewEmptyIndexSettings().SetResponseFields( + []string{"hits", "hitsPerPage", "nbPages", "page"}))) require.NoError(t, err) - require.Equal(t, "/1/indexes/movies/settings", echo.Path) + require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["title_eng","title_fr","title_es"]}`) + ja.Assertf(*echo.Body, `{"responseFields":["hits","hitsPerPage","nbPages","page"]}`) }) - t.Run("disablePrefixOnAttributes", func(t *testing.T) { + t.Run("set_max_facet_hits", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDisablePrefixOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetMaxFacetHits(10))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"disablePrefixOnAttributes":["serial_number"]}`) + ja.Assertf(*echo.Body, `{"maxFacetHits":10}`) }) - t.Run("disableTypoToleranceOnAttributes", func(t *testing.T) { + t.Run("set_attribute_criteria_computed_by_min_proximity", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetDisableTypoToleranceOnAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetAttributeCriteriaComputedByMinProximity(true))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"disableTypoToleranceOnAttributes":["serial_number"]}`) + ja.Assertf(*echo.Body, `{"attributeCriteriaComputedByMinProximity":true}`) }) - t.Run("searchableAttributesSimpleExample", func(t *testing.T) { + t.Run("set_user_data", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"serial_number"}))) + search.NewEmptyIndexSettings().SetUserData(map[string]any{"extraData": "This is the custom data that you want to store in your index"}))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["serial_number"]}`) + ja.Assertf(*echo.Body, `{"userData":{"extraData":"This is the custom data that you want to store in your index"}}`) }) - t.Run("searchableAttributesSimpleExampleAlt", func(t *testing.T) { + t.Run("set_rendering_content", func(t *testing.T) { _, err := client.SetSettings(client.NewApiSetSettingsRequest( "theIndexName", - search.NewEmptyIndexSettings().SetSearchableAttributes( - []string{"serial_number", "serial_number_suffixes"}))) + search.NewEmptyIndexSettings().SetRenderingContent( + search.NewEmptyRenderingContent().SetFacetOrdering( + search.NewEmptyFacetOrdering().SetFacets( + search.NewEmptyFacets().SetOrder( + []string{"size", "brand"})).SetValues(map[string]search.Value{"brand": *search.NewEmptyValue().SetOrder( + []string{"uniqlo"}).SetHide( + []string{"muji"}).SetSortRemainingBy(search.SortRemainingBy("count")), "size": *search.NewEmptyValue().SetOrder( + []string{"S", "M", "L"}).SetSortRemainingBy(search.SortRemainingBy("hidden"))}))))) require.NoError(t, err) require.Equal(t, "/1/indexes/theIndexName/settings", echo.Path) require.Equal(t, "PUT", echo.Method) ja := jsonassert.New(t) - ja.Assertf(*echo.Body, `{"searchableAttributes":["serial_number","serial_number_suffixes"]}`) + ja.Assertf(*echo.Body, `{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}`) }) } diff --git a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java index 63fcb867ad..8c9c8077f1 100644 --- a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java +++ b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java @@ -3836,8 +3836,109 @@ void searchSingleIndexTest13() { } @Test - @DisplayName("facetFiltersNeg") + @DisplayName("facetFiltersBook") void searchSingleIndexTest14() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book")))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"facetFilters\":[\"category:Book\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("facetFiltersAND") + void searchSingleIndexTest15() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe")))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"facetFilters\":[\"category:Book\",\"author:John Doe\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("facetFiltersOR") + void searchSingleIndexTest16() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters( + FacetFilters.of( + Arrays.asList(FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe")))) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"facetFilters\":[[\"category:Book\",\"author:John Doe\"]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("facetFiltersCombined") + void searchSingleIndexTest17() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setFacetFilters( + FacetFilters.of( + Arrays.asList( + FacetFilters.of("author:John Doe"), + FacetFilters.of(Arrays.asList(FacetFilters.of("category:Book"), FacetFilters.of("category:Movie"))) + ) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"facetFilters\":[\"author:John" + " Doe\",[\"category:Book\",\"category:Movie\"]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("facetFiltersNeg") + void searchSingleIndexTest18() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setFacetFilters(FacetFilters.of("category:-Ebook")), Hit.class); }); @@ -3849,7 +3950,7 @@ void searchSingleIndexTest14() { @Test @DisplayName("filtersAndFacetFilters") - void searchSingleIndexTest15() { + void searchSingleIndexTest19() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -3873,7 +3974,7 @@ void searchSingleIndexTest15() { @Test @DisplayName("facet author genre") - void searchSingleIndexTest16() { + void searchSingleIndexTest20() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setFacets(Arrays.asList("author", "genre")), Hit.class); }); @@ -3885,7 +3986,7 @@ void searchSingleIndexTest16() { @Test @DisplayName("facet wildcard") - void searchSingleIndexTest17() { + void searchSingleIndexTest21() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setFacets(Arrays.asList("*")), Hit.class); }); @@ -3897,7 +3998,7 @@ void searchSingleIndexTest17() { @Test @DisplayName("maxValuesPerFacet") - void searchSingleIndexTest18() { + void searchSingleIndexTest22() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setMaxValuesPerFacet(1000), Hit.class); }); @@ -3909,7 +4010,7 @@ void searchSingleIndexTest18() { @Test @DisplayName("aroundLatLng") - void searchSingleIndexTest19() { + void searchSingleIndexTest23() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setAroundLatLng("40.71, -74.01"), Hit.class); }); @@ -3921,7 +4022,7 @@ void searchSingleIndexTest19() { @Test @DisplayName("aroundLatLngViaIP") - void searchSingleIndexTest20() { + void searchSingleIndexTest24() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setAroundLatLngViaIP(true), Hit.class); }); @@ -3933,7 +4034,7 @@ void searchSingleIndexTest20() { @Test @DisplayName("aroundRadius") - void searchSingleIndexTest21() { + void searchSingleIndexTest25() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -3951,7 +4052,7 @@ void searchSingleIndexTest21() { @Test @DisplayName("insideBoundingBox") - void searchSingleIndexTest22() { + void searchSingleIndexTest26() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -3976,7 +4077,7 @@ void searchSingleIndexTest22() { @Test @DisplayName("insidePolygon") - void searchSingleIndexTest23() { + void searchSingleIndexTest27() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4016,7 +4117,7 @@ void searchSingleIndexTest23() { @Test @DisplayName("insidePolygon") - void searchSingleIndexTest24() { + void searchSingleIndexTest28() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4056,7 +4157,7 @@ void searchSingleIndexTest24() { @Test @DisplayName("optionalFilters") - void searchSingleIndexTest25() { + void searchSingleIndexTest29() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4074,7 +4175,7 @@ void searchSingleIndexTest25() { @Test @DisplayName("optionalFiltersMany") - void searchSingleIndexTest26() { + void searchSingleIndexTest30() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4105,7 +4206,7 @@ void searchSingleIndexTest26() { @Test @DisplayName("optionalFiltersSimple") - void searchSingleIndexTest27() { + void searchSingleIndexTest31() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4126,7 +4227,7 @@ void searchSingleIndexTest27() { @Test @DisplayName("restrictSearchableAttributes") - void searchSingleIndexTest28() { + void searchSingleIndexTest32() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setRestrictSearchableAttributes(Arrays.asList("title_fr")), Hit.class); }); @@ -4139,7 +4240,7 @@ void searchSingleIndexTest28() { @Test @DisplayName("getRankingInfo") - void searchSingleIndexTest29() { + void searchSingleIndexTest33() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setGetRankingInfo(true), Hit.class); }); @@ -4151,7 +4252,7 @@ void searchSingleIndexTest29() { @Test @DisplayName("clickAnalytics") - void searchSingleIndexTest30() { + void searchSingleIndexTest34() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setClickAnalytics(true), Hit.class); }); @@ -4163,7 +4264,7 @@ void searchSingleIndexTest30() { @Test @DisplayName("clickAnalyticsUserToken") - void searchSingleIndexTest31() { + void searchSingleIndexTest35() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setClickAnalytics(true).setUserToken("user-1"), Hit.class); }); @@ -4176,7 +4277,7 @@ void searchSingleIndexTest31() { @Test @DisplayName("enablePersonalization") - void searchSingleIndexTest32() { + void searchSingleIndexTest36() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setEnablePersonalization(true).setUserToken("user-1"), Hit.class); }); @@ -4190,7 +4291,7 @@ void searchSingleIndexTest32() { @Test @DisplayName("userToken") - void searchSingleIndexTest33() { + void searchSingleIndexTest37() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setUserToken("user-1"), Hit.class); }); @@ -4200,9 +4301,22 @@ void searchSingleIndexTest33() { assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"userToken\":\"user-1\"}", req.body, JSONCompareMode.STRICT)); } + @Test + @DisplayName("userToken1234") + void searchSingleIndexTest38() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setUserToken("user-1234"), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"userToken\":\"user-1234\"}", req.body, JSONCompareMode.STRICT) + ); + } + @Test @DisplayName("analyticsTag") - void searchSingleIndexTest34() { + void searchSingleIndexTest39() { assertDoesNotThrow(() -> { client.searchSingleIndex("indexName", new SearchParamsObject().setAnalyticsTags(Arrays.asList("YOUR_ANALYTICS_TAG")), Hit.class); }); @@ -4214,7 +4328,7 @@ void searchSingleIndexTest34() { @Test @DisplayName("facetFiltersUsers") - void searchSingleIndexTest35() { + void searchSingleIndexTest40() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4233,7 +4347,7 @@ void searchSingleIndexTest35() { @Test @DisplayName("buildTheQuery") - void searchSingleIndexTest36() { + void searchSingleIndexTest41() { assertDoesNotThrow(() -> { client.searchSingleIndex( "indexName", @@ -4257,32 +4371,39 @@ void searchSingleIndexTest36() { } @Test - @DisplayName("searchSynonyms with minimal parameters") - void searchSynonymsTest() { + @DisplayName("attributesToHighlightOverride") + void searchSingleIndexTest42() { assertDoesNotThrow(() -> { - client.searchSynonyms("indexName"); + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAttributesToHighlight(Arrays.asList("title", "content")), + Hit.class + ); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/indexName/synonyms/search", req.path); + assertEquals("/1/indexes/indexName/query", req.path); assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"attributesToHighlight\":[\"title\",\"content\"]}", req.body, JSONCompareMode.STRICT) + ); } @Test - @DisplayName("searchSynonyms with all parameters") - void searchSynonymsTest1() { + @DisplayName("disableTypoToleranceOnAttributes") + void searchSingleIndexTest43() { assertDoesNotThrow(() -> { - client.searchSynonyms( + client.searchSingleIndex( "indexName", - new SearchSynonymsParams().setQuery("myQuery").setType(SynonymType.ALTCORRECTION_1).setPage(10).setHitsPerPage(10) + new SearchParamsObject().setQuery("query").setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number")), + Hit.class ); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/indexName/synonyms/search", req.path); + assertEquals("/1/indexes/indexName/query", req.path); assertEquals("POST", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}", + "{\"query\":\"query\",\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT ) @@ -4290,49 +4411,63 @@ void searchSynonymsTest1() { } @Test - @DisplayName("searchUserIds") - void searchUserIdsTest() { + @DisplayName("search_a_query") + void searchSingleIndexTest44() { assertDoesNotThrow(() -> { - client.searchUserIds(new SearchUserIdsParams().setQuery("test").setClusterName("theClusterName").setPage(5).setHitsPerPage(10)); + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("shirt"), Hit.class); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/clusters/mapping/search", req.path); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"shirt\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("search_everything") + void searchSingleIndexTest45() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery(""), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("api_filtering_range_example") + void searchSingleIndexTest46() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("books").setFilters("price:10 TO 20"), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); assertEquals("POST", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}", - req.body, - JSONCompareMode.STRICT - ) + JSONAssert.assertEquals("{\"query\":\"books\",\"filters\":\"price:10 TO 20\"}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("get setDictionarySettings results with minimal parameters") - void setDictionarySettingsTest() { + @DisplayName("search_a_query") + void searchSingleIndexTest47() { assertDoesNotThrow(() -> { - client.setDictionarySettings( - new DictionarySettingsParams() - .setDisableStandardEntries( - new StandardEntries() - .setPlurals( - new HashMap() { - { - put("fr", false); - put("en", false); - put("ru", true); - } - } - ) - ) + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("") + .setSimilarQuery("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen") + .setFilters("year:1991 TO 2001"), + Hit.class ); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/dictionaries/*/settings", req.path); - assertEquals("PUT", req.method); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}", + "{\"query\":\"\",\"similarQuery\":\"Comedy Drama Crime McDormand Macy Buscemi" + + " Stormare Presnell Coen\",\"filters\":\"year:1991 TO 2001\"}", req.body, JSONCompareMode.STRICT ) @@ -4340,560 +4475,3127 @@ void setDictionarySettingsTest() { } @Test - @DisplayName("get setDictionarySettings results with all parameters") - void setDictionarySettingsTest1() { + @DisplayName("override_retrievable_attributes") + void searchSingleIndexTest48() { assertDoesNotThrow(() -> { - client.setDictionarySettings( - new DictionarySettingsParams() - .setDisableStandardEntries( - new StandardEntries() - .setPlurals( - new HashMap() { - { - put("fr", false); - put("en", false); - put("ru", true); - } - } - ) - .setStopwords( - new HashMap() { - { - put("fr", false); - } - } - ) - .setCompounds( - new HashMap() { - { - put("ru", true); - } - } - ) - ) + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAttributesToRetrieve(Arrays.asList("title", "content")), + Hit.class ); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/dictionaries/*/settings", req.path); - assertEquals("PUT", req.method); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}", - req.body, - JSONCompareMode.STRICT - ) + JSONAssert.assertEquals("{\"query\":\"query\",\"attributesToRetrieve\":[\"title\",\"content\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("minimal parameters") - void setSettingsTest() { + @DisplayName("restrict_searchable_attributes") + void searchSingleIndexTest49() { assertDoesNotThrow(() -> { - client.setSettings("cts_e2e_settings", new IndexSettings().setPaginationLimitedTo(10), true); - }); - EchoResponse req = echo.getLastResponse(); + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setRestrictSearchableAttributes(Arrays.asList("title", "author")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"restrictSearchableAttributes\":[\"title\",\"author\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("override_default_relevancy") + void searchSingleIndexTest50() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setRelevancyStrictness(70), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"relevancyStrictness\":70}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("apply_filters") + void searchSingleIndexTest51() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFilters("(category:Book OR category:Ebook) AND _tags:published"), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"filters\":\"(category:Book OR category:Ebook) AND" + " _tags:published\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("apply_all_filters") + void searchSingleIndexTest52() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setFilters( + "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\"" + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"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\\\"\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("escape_spaces") + void searchSingleIndexTest53() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFilters("category:\"Books and Comics\""), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"filters\":\"category:\\\"Books and Comics\\\"\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("escape_keywords") + void searchSingleIndexTest54() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setFilters("keyword:\"OR\""), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"filters\":\"keyword:\\\"OR\\\"\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("escape_single_quotes") + void searchSingleIndexTest55() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFilters("content:\"It's a wonderful day\""), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"filters\":\"content:\\\"It's a wonderful day\\\"\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("escape_double_quotes") + void searchSingleIndexTest56() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFilters("content:\"She said \"Hello World\""), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"filters\":\"content:\\\"She said \\\"Hello World\\\"\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("apply_filters") + void searchSingleIndexTest57() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setOptionalFilters( + OptionalFilters.of(Arrays.asList(OptionalFilters.of("category:Book"), OptionalFilters.of("author:John Doe"))) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:John Doe\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("apply_negative_filters") + void searchSingleIndexTest58() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setOptionalFilters( + OptionalFilters.of(Arrays.asList(OptionalFilters.of("category:Book"), OptionalFilters.of("author:-John Doe"))) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:-John" + " Doe\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("apply_numeric_filters") + void searchSingleIndexTest59() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setNumericFilters( + NumericFilters.of( + Arrays.asList( + NumericFilters.of("price < 1000"), + NumericFilters.of(Arrays.asList(NumericFilters.of("inStock = 1"), NumericFilters.of("deliveryDate < 1441755506"))) + ) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"numericFilters\":[\"price < 1000\",[\"inStock =" + " 1\",\"deliveryDate < 1441755506\"]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("apply_tag_filters") + void searchSingleIndexTest60() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setTagFilters( + TagFilters.of( + Arrays.asList(TagFilters.of("SciFi"), TagFilters.of(Arrays.asList(TagFilters.of("Book"), TagFilters.of("Movie")))) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"tagFilters\":[\"SciFi\",[\"Book\",\"Movie\"]]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("apply_filters") + void searchSingleIndexTest61() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setSumOrFiltersScores(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"sumOrFiltersScores\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("facets_all") + void searchSingleIndexTest62() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setFacets(Arrays.asList("*")), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"facets\":[\"*\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("retrieve_only_some_facets") + void searchSingleIndexTest63() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setFacets(Arrays.asList("category", "author")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"facets\":[\"category\",\"author\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_max_values_per_facet") + void searchSingleIndexTest64() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setMaxValuesPerFacet(20), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"maxValuesPerFacet\":20}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("enable_faceting_after_distinct") + void searchSingleIndexTest65() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setFacetingAfterDistinct(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"facetingAfterDistinct\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("sort_facet_values_alphabetically") + void searchSingleIndexTest66() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setSortFacetValuesBy("count"), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"sortFacetValuesBy\":\"count\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_attributes_to_snippet") + void searchSingleIndexTest67() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAttributesToSnippet(Arrays.asList("title", "content:80")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"attributesToSnippet\":[\"title\",\"content:80\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_highlight_pre_tag") + void searchSingleIndexTest68() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setHighlightPreTag(""), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"highlightPreTag\":\"\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_highlight_post_tag") + void searchSingleIndexTest69() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setHighlightPostTag(""), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"highlightPostTag\":\"\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_snippet_ellipsis_text") + void searchSingleIndexTest70() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setSnippetEllipsisText(""), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"snippetEllipsisText\":\"\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("enable_restrict_highlight_and_snippet_arrays") + void searchSingleIndexTest71() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setRestrictHighlightAndSnippetArrays(false), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"restrictHighlightAndSnippetArrays\":false}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("access_page") + void searchSingleIndexTest72() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setPage(0), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"page\":0}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_default_hits_per_page") + void searchSingleIndexTest73() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setHitsPerPage(10), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"hitsPerPage\":10}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("get_nth_hit") + void searchSingleIndexTest74() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setOffset(4), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"offset\":4}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("get_n_results") + void searchSingleIndexTest75() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setLength(4), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"length\":4}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_default_min_word_size_for_one_typo") + void searchSingleIndexTest76() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setMinWordSizefor1Typo(2), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"minWordSizefor1Typo\":2}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_default_min_word_size_for_two_typos") + void searchSingleIndexTest77() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setMinWordSizefor2Typos(2), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"minWordSizefor2Typos\":2}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_default_typo_tolerance_mode") + void searchSingleIndexTest78() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setTypoTolerance(TypoTolerance.of(false)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"typoTolerance\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("disable_typos_on_numeric_tokens_at_search_time") + void searchSingleIndexTest79() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAllowTyposOnNumericTokens(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"allowTyposOnNumericTokens\":false}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("search_around_a_position") + void searchSingleIndexTest80() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAroundLatLng("40.71, -74.01"), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"aroundLatLng\":\"40.71, -74.01\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("search_around_server_ip") + void searchSingleIndexTest81() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAroundLatLngViaIP(true), + Hit.class, + new RequestOptions() + .addExtraHeader("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to" + " search around") + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"aroundLatLngViaIP\":true}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedHeaders = json.readValue( + "{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you" + " would like to search around\"}", + new TypeReference>() {} + ); + Map actualHeaders = req.headers; + + for (Map.Entry p : expectedHeaders.entrySet()) { + assertEquals(p.getValue(), actualHeaders.get(p.getKey())); + } + } catch (JsonProcessingException e) { + fail("failed to parse headers json"); + } + } + + @Test + @DisplayName("set_around_radius") + void searchSingleIndexTest82() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAroundRadius(AroundRadius.of(1000)), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"aroundRadius\":1000}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("disable_automatic_radius") + void searchSingleIndexTest83() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAroundRadius(AroundRadiusAll.ALL), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"aroundRadius\":\"all\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_geo_search_precision") + void searchSingleIndexTest84() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAroundPrecision(AroundPrecision.of(100)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"aroundPrecision\":100}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_geo_search_precision_non_linear") + void searchSingleIndexTest85() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setAroundPrecision( + AroundPrecision.of(Arrays.asList(new Range().setFrom(0).setValue(25), new Range().setFrom(2000).setValue(1000))) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"aroundPrecision\":[{\"from\":0,\"value\":25},{\"from\":2000,\"value\":1000}]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("set_minimum_geo_search_radius") + void searchSingleIndexTest86() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setMinimumAroundRadius(1000), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"minimumAroundRadius\":1000}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("search_inside_rectangular_area") + void searchSingleIndexTest87() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setInsideBoundingBox( + InsideBoundingBox.of(Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("search_inside_multiple_rectangular_areas") + void searchSingleIndexTest88() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setInsideBoundingBox( + InsideBoundingBox.of( + Arrays.asList( + Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), + Arrays.asList(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875) + ) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("search_inside_polygon_area") + void searchSingleIndexTest89() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setInsidePolygon( + Arrays.asList(Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"insidePolygon\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("search_inside_multiple_polygon_areas") + void searchSingleIndexTest90() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setInsidePolygon( + Arrays.asList( + Arrays.asList(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), + Arrays.asList( + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + 45.17210966999772, + 1.009765625, + 50.62626704081, + 4.6181640625 + ) + ) + ), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"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]]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("set_querylanguages_override") + void searchSingleIndexTest91() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"ignorePlurals\":[\"ca\",\"es\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_querylanguages_override") + void searchSingleIndexTest92() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_querylanguages_override") + void searchSingleIndexTest93() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.CA, SupportedLanguage.ES))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_querylanguages_with_japanese_query") + void searchSingleIndexTest94() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setQueryLanguages(Arrays.asList(SupportedLanguage.JA, SupportedLanguage.EN)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"queryLanguages\":[\"ja\",\"en\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_natural_languages") + void searchSingleIndexTest95() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("").setNaturalLanguages(Arrays.asList(SupportedLanguage.FR)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"\",\"naturalLanguages\":[\"fr\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_natural_languages_with_query") + void searchSingleIndexTest96() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("") + .setNaturalLanguages(Arrays.asList(SupportedLanguage.FR)) + .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.FIRST_WORDS), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"\",\"naturalLanguages\":[\"fr\"],\"removeWordsIfNoResults\":\"firstWords\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("enable_decompound_query_search_time") + void searchSingleIndexTest97() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setDecompoundQuery(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"decompoundQuery\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("enable_rules_search_time") + void searchSingleIndexTest98() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setEnableRules(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"enableRules\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_rule_contexts") + void searchSingleIndexTest99() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setRuleContexts(Arrays.asList("front_end", "website2")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"ruleContexts\":[\"front_end\",\"website2\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("enable_personalization") + void searchSingleIndexTest100() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setEnablePersonalization(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"enablePersonalization\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("enable_personalization_with_user_token") + void searchSingleIndexTest101() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setEnablePersonalization(true).setUserToken("123456"), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("personalization_impact") + void searchSingleIndexTest102() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setPersonalizationImpact(20), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"personalizationImpact\":20}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_user_token") + void searchSingleIndexTest103() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setUserToken("123456"), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"userToken\":\"123456\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_user_token_with_personalization") + void searchSingleIndexTest104() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setEnablePersonalization(true).setUserToken("123456"), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("override_default_query_type") + void searchSingleIndexTest105() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setQueryType(QueryType.PREFIX_ALL), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"queryType\":\"prefixAll\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_remove_words_if_no_results") + void searchSingleIndexTest106() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"removeWordsIfNoResults\":\"lastWords\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("enable_advanced_syntax_search_time") + void searchSingleIndexTest107() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAdvancedSyntax(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"advancedSyntax\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("overide_default_optional_words") + void searchSingleIndexTest108() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setOptionalWords(OptionalWords.of(Arrays.asList("toyota", "2020 2021"))), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"optionalWords\":[\"toyota\",\"2020 2021\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("disabling_exact_for_some_attributes_search_time") + void searchSingleIndexTest109() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setDisableExactOnAttributes(Arrays.asList("description")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"disableExactOnAttributes\":[\"description\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_exact_single_word_query") + void searchSingleIndexTest110() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setExactOnSingleWordQuery(ExactOnSingleWordQuery.NONE), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"exactOnSingleWordQuery\":\"none\"}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_default_aternative_as_exact") + void searchSingleIndexTest111() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAlternativesAsExact(Arrays.asList(AlternativesAsExact.MULTI_WORDS_SYNONYM)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"alternativesAsExact\":[\"multiWordsSynonym\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("enable_advanced_syntax_exact_phrase") + void searchSingleIndexTest112() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("enable_advanced_syntax_exclude_words") + void searchSingleIndexTest113() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject() + .setQuery("query") + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXCLUDE_WORDS)), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"excludeWords\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("override_distinct") + void searchSingleIndexTest114() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setDistinct(Distinct.of(0)), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"distinct\":0}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("get_ranking_info") + void searchSingleIndexTest115() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setGetRankingInfo(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"getRankingInfo\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("disable_click_analytics") + void searchSingleIndexTest116() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setClickAnalytics(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"clickAnalytics\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("enable_click_analytics") + void searchSingleIndexTest117() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setClickAnalytics(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"clickAnalytics\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("disable_analytics") + void searchSingleIndexTest118() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setAnalytics(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"analytics\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("add_analytics_tags") + void searchSingleIndexTest119() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setAnalyticsTags(Arrays.asList("front_end", "website2")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"analyticsTags\":[\"front_end\",\"website2\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("disable_synonyms") + void searchSingleIndexTest120() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setSynonyms(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"synonyms\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_replace_synonyms_in_highlights") + void searchSingleIndexTest121() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setReplaceSynonymsInHighlight(true), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"replaceSynonymsInHighlight\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_min_proximity") + void searchSingleIndexTest122() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setMinProximity(2), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"minProximity\":2}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("override_default_field") + void searchSingleIndexTest123() { + assertDoesNotThrow(() -> { + client.searchSingleIndex( + "indexName", + new SearchParamsObject().setQuery("query").setResponseFields(Arrays.asList("hits", "facets")), + Hit.class + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"responseFields\":[\"hits\",\"facets\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("override_percentile_computation") + void searchSingleIndexTest124() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setPercentileComputation(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"query\":\"query\",\"percentileComputation\":false}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("set_ab_test") + void searchSingleIndexTest125() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setEnableABTest(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"enableABTest\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_enable_re_ranking") + void searchSingleIndexTest126() { + assertDoesNotThrow(() -> { + client.searchSingleIndex("indexName", new SearchParamsObject().setQuery("query").setEnableReRanking(false), Hit.class); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/query", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"query\":\"query\",\"enableReRanking\":false}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("searchSynonyms with minimal parameters") + void searchSynonymsTest() { + assertDoesNotThrow(() -> { + client.searchSynonyms("indexName"); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/synonyms/search", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("searchSynonyms with all parameters") + void searchSynonymsTest1() { + assertDoesNotThrow(() -> { + client.searchSynonyms( + "indexName", + new SearchSynonymsParams().setQuery("myQuery").setType(SynonymType.ALTCORRECTION_1).setPage(10).setHitsPerPage(10) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/indexName/synonyms/search", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("searchUserIds") + void searchUserIdsTest() { + assertDoesNotThrow(() -> { + client.searchUserIds(new SearchUserIdsParams().setQuery("test").setClusterName("theClusterName").setPage(5).setHitsPerPage(10)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/clusters/mapping/search", req.path); + assertEquals("POST", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("get setDictionarySettings results with minimal parameters") + void setDictionarySettingsTest() { + assertDoesNotThrow(() -> { + client.setDictionarySettings( + new DictionarySettingsParams() + .setDisableStandardEntries( + new StandardEntries() + .setPlurals( + new HashMap() { + { + put("fr", false); + put("en", false); + put("ru", true); + } + } + ) + ) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/dictionaries/*/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("get setDictionarySettings results with all parameters") + void setDictionarySettingsTest1() { + assertDoesNotThrow(() -> { + client.setDictionarySettings( + new DictionarySettingsParams() + .setDisableStandardEntries( + new StandardEntries() + .setPlurals( + new HashMap() { + { + put("fr", false); + put("en", false); + put("ru", true); + } + } + ) + .setStopwords( + new HashMap() { + { + put("fr", false); + } + } + ) + .setCompounds( + new HashMap() { + { + put("ru", true); + } + } + ) + ) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/dictionaries/*/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("minimal parameters") + void setSettingsTest() { + assertDoesNotThrow(() -> { + client.setSettings("cts_e2e_settings", new IndexSettings().setPaginationLimitedTo(10), true); + }); + EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/cts_e2e_settings/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"paginationLimitedTo\":10}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"paginationLimitedTo\":10}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("boolean typoTolerance") + void setSettingsTest1() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"typoTolerance\":true}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("enum typoTolerance") + void setSettingsTest2() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setTypoTolerance(TypoToleranceEnum.MIN), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"typoTolerance\":\"min\"}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("ignorePlurals") + void setSettingsTest3() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(true)), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("list of string ignorePlurals") + void setSettingsTest4() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.FR))), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ignorePlurals\":[\"fr\"]}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("removeStopWords boolean") + void setSettingsTest5() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setRemoveStopWords(RemoveStopWords.of(true)), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"removeStopWords\":true}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("removeStopWords list of string") + void setSettingsTest6() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.FR))), + true + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"removeStopWords\":[\"fr\"]}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("boolean distinct") + void setSettingsTest7() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(true)), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":true}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("integer distinct") + void setSettingsTest8() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(1)), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":1}", req.body, JSONCompareMode.STRICT)); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("distinct company") + void setSettingsTest9() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("company").setDistinct(Distinct.of(true))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributeForDistinct\":\"company\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("distinct design") + void setSettingsTest10() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("design").setDistinct(Distinct.of(true))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributeForDistinct\":\"design\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("distinct true") + void setSettingsTest11() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(true))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":true}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("distinct section") + void setSettingsTest12() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("section").setDistinct(Distinct.of(true))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributeForDistinct\":\"section\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("attributesForFaceting allergens") + void setSettingsTest13() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("allergens"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"allergens\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("api_attributes_for_faceting") + void setSettingsTest14() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("genre", "author"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"genre\",\"author\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("api_attributes_for_faceting_searchable") + void setSettingsTest15() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("genre", "searchable(author)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"genre\",\"searchable(author)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("api_attributes_for_filter_only") + void setSettingsTest16() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(genre)", "author"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"filterOnly(genre)\",\"author\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("attributesForFaceting categoryPageId") + void setSettingsTest17() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("searchable(categoryPageId)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("unretrievableAttributes") + void setSettingsTest18() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setUnretrievableAttributes(Arrays.asList("visible_by"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"unretrievableAttributes\":[\"visible_by\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("attributesForFaceting user restricted data") + void setSettingsTest19() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(visible_by)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("attributesForFaceting optional filters") + void setSettingsTest20() { + assertDoesNotThrow(() -> { + client.setSettings( + "", + new IndexSettings().setAttributesForFaceting(Arrays.asList("can_deliver_quickly", "restaurant")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("attributesForFaceting redirect index") + void setSettingsTest21() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("query_terms"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"query_terms\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("attributesForFaceting multiple consequences") + void setSettingsTest22() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("director"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"director\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("attributesForFaceting in-depth optional filters") + void setSettingsTest23() { + assertDoesNotThrow(() -> { + client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(brand)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesForFaceting\":[\"filterOnly(brand)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("mode neuralSearch") + void setSettingsTest24() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"neuralSearch\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("mode keywordSearch") + void setSettingsTest25() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"keywordSearch\"}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("searchableAttributes same priority") + void setSettingsTest26() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("title,comments", "ingredients"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("searchableAttributes higher priority") + void setSettingsTest27() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("title", "ingredients"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"title\",\"ingredients\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("customRanking retweets") + void setSettingsTest28() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(retweets)", "desc(likes)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("customRanking boosted") + void setSettingsTest29() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(boosted)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"customRanking\":[\"desc(boosted)\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("customRanking pageviews") + void setSettingsTest30() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(pageviews)", "desc(comments)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("customRanking applying search parameters for a specific query") + void setSettingsTest31() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setCustomRanking(Arrays.asList("desc(nb_airline_liaisons)")) + .setAttributesForFaceting(Arrays.asList("city, country")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city," + " country\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("customRanking rounded pageviews") + void setSettingsTest32() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(rounded_pageviews)", "desc(comments)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("customRanking price") + void setSettingsTest33() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(price)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"customRanking\":[\"desc(price)\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("ranking exhaustive") + void setSettingsTest34() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("ranking standard replica") + void setSettingsTest35() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setRanking(Arrays.asList("desc(post_date_timestamp)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ranking\":[\"desc(post_date_timestamp)\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("ranking virtual replica") + void setSettingsTest36() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(post_date_timestamp)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"customRanking\":[\"desc(post_date_timestamp)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("customRanking and ranking sort alphabetically") + void setSettingsTest37() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setCustomRanking(Arrays.asList("asc(textual_attribute)")) + .setRanking(Arrays.asList("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("relevancyStrictness") + void setSettingsTest38() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setCustomRanking(Arrays.asList("asc(textual_attribute)")).setRelevancyStrictness(0) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("create replica index") + void setSettingsTest39() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList("products_price_desc"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"products_price_desc\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("create replica index articles") + void setSettingsTest40() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList("articles_date_desc"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"articles_date_desc\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("create virtual replica index") + void setSettingsTest41() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList("virtual(products_price_desc)"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"virtual(products_price_desc)\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("unlink replica index") + void setSettingsTest42() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList(""))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("forwardToReplicas") + void setSettingsTest43() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("name", "description")), true); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"name\",\"description\"]}", req.body, JSONCompareMode.STRICT) + ); + + try { + Map expectedQuery = json.readValue( + "{\"forwardToReplicas\":\"true\"}", + new TypeReference>() {} + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } catch (JsonProcessingException e) { + fail("failed to parse queryParameters json"); + } + } + + @Test + @DisplayName("maxValuesPerFacet") + void setSettingsTest44() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMaxValuesPerFacet(1000)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxValuesPerFacet\":1000}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("maxFacetHits") + void setSettingsTest45() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMaxFacetHits(1000)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxFacetHits\":1000}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("attributesForFaceting complex") + void setSettingsTest46() { + assertDoesNotThrow(() -> { + client.setSettings( + "", + new IndexSettings().setAttributesForFaceting(Arrays.asList("actor", "filterOnly(category)", "searchable(publisher)")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("ranking closest dates") + void setSettingsTest47() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setRanking(Arrays.asList("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("searchableAttributes item variation") + void setSettingsTest48() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("design", "type", "color"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("searchableAttributes around location") + void setSettingsTest49() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) + .setCustomRanking(Arrays.asList("desc(links_count)")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("attributesToHighlight") + void setSettingsTest50() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributesToHighlight(Arrays.asList("author", "title", "content"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesToHighlight\":[\"author\",\"title\",\"content\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("attributesToHighlightStar") + void setSettingsTest51() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributesToHighlight(Arrays.asList("*"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesToHighlight\":[\"*\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("everything") + void setSettingsTest52() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setAdvancedSyntax(true) + .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)) + .setAllowCompressionOfIntegerArray(true) + .setAllowTyposOnNumericTokens(true) + .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.SINGLE_WORD_SYNONYM)) + .setAttributeCriteriaComputedByMinProximity(true) + .setAttributeForDistinct("test") + .setAttributesForFaceting(Arrays.asList("algolia")) + .setAttributesToHighlight(Arrays.asList("algolia")) + .setAttributesToRetrieve(Arrays.asList("algolia")) + .setAttributesToSnippet(Arrays.asList("algolia")) + .setAttributesToTransliterate(Arrays.asList("algolia")) + .setCamelCaseAttributes(Arrays.asList("algolia")) + .setCustomNormalization( + new HashMap() { + { + put( + "algolia", + new HashMap() { + { + put("aloglia", "aglolia"); + } + } + ); + } + } + ) + .setCustomRanking(Arrays.asList("algolia")) + .setDecompoundQuery(false) + .setDecompoundedAttributes( + new HashMap() { + { + put("algolia", "aloglia"); + } + } + ) + .setDisableExactOnAttributes(Arrays.asList("algolia")) + .setDisablePrefixOnAttributes(Arrays.asList("algolia")) + .setDisableTypoToleranceOnAttributes(Arrays.asList("algolia")) + .setDisableTypoToleranceOnWords(Arrays.asList("algolia")) + .setDistinct(Distinct.of(3)) + .setEnablePersonalization(true) + .setEnableReRanking(false) + .setEnableRules(true) + .setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE) + .setHighlightPreTag("") + .setHighlightPostTag("") + .setHitsPerPage(10) + .setIgnorePlurals(IgnorePlurals.of(false)) + .setIndexLanguages(Arrays.asList(SupportedLanguage.FR)) + .setKeepDiacriticsOnCharacters("abc") + .setMaxFacetHits(20) + .setMaxValuesPerFacet(30) + .setMinProximity(6) + .setMinWordSizefor1Typo(5) + .setMinWordSizefor2Typos(11) + .setMode(Mode.NEURAL_SEARCH) + .setNumericAttributesForFiltering(Arrays.asList("algolia")) + .setOptionalWords(OptionalWords.of(Arrays.asList("myspace"))) + .setPaginationLimitedTo(0) + .setQueryLanguages(Arrays.asList(SupportedLanguage.FR)) + .setQueryType(QueryType.PREFIX_LAST) + .setRanking(Arrays.asList("geo")) + .setReRankingApplyFilter(ReRankingApplyFilter.of("mySearch:filters")) + .setRelevancyStrictness(10) + .setRemoveStopWords(RemoveStopWords.of(false)) + .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS) + .setRenderingContent( + new RenderingContent() + .setFacetOrdering( + new FacetOrdering() + .setFacets(new Facets().setOrder(Arrays.asList("a", "b"))) + .setValues( + new HashMap() { + { + put("a", new Value().setOrder(Arrays.asList("b")).setSortRemainingBy(SortRemainingBy.COUNT)); + } + } + ) + ) + ) + .setReplaceSynonymsInHighlight(true) + .setReplicas(Arrays.asList("")) + .setResponseFields(Arrays.asList("algolia")) + .setRestrictHighlightAndSnippetArrays(true) + .setSearchableAttributes(Arrays.asList("foo")) + .setSemanticSearch(new SemanticSearch().setEventSources(Arrays.asList("foo"))) + .setSeparatorsToIndex("bar") + .setSnippetEllipsisText("---") + .setSortFacetValuesBy("date") + .setTypoTolerance(TypoTolerance.of(false)) + .setUnretrievableAttributes(Arrays.asList("foo")) + .setUserData( + new HashMap() { + { + put("user", "data"); + } + } + ) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}", + req.body, + JSONCompareMode.STRICT + ) + ); + } - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} + @Test + @DisplayName("searchableAttributesWithCustomRankingsAndAttributesForFaceting") + void setSettingsTest53() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setSearchableAttributes(Arrays.asList("brand", "name", "categories", "unordered(description)")) + .setCustomRanking(Arrays.asList("desc(popularity)")) + .setAttributesForFaceting(Arrays.asList("searchable(brand)", "type", "categories", "price")) ); - Map actualQuery = req.queryParameters; + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + @Test + @DisplayName("searchableAttributesOrdering") + void setSettingsTest54() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("unordered(title)", "cast"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"unordered(title)\",\"cast\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("searchableAttributesProductReferenceSuffixes") + void setSettingsTest55() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setSearchableAttributes(Arrays.asList("name", "product_reference", "product_reference_suffixes")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } + + @Test + @DisplayName("queryLanguageAndIgnorePlurals") + void setSettingsTest56() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.EN)).setIgnorePlurals(IgnorePlurals.of(true)) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("searchableAttributesInMovies") + void setSettingsTest57() { + assertDoesNotThrow(() -> { + client.setSettings("movies", new IndexSettings().setSearchableAttributes(Arrays.asList("title_eng", "title_fr", "title_es"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/movies/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("disablePrefixOnAttributes") + void setSettingsTest58() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("serial_number"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"disablePrefixOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("disableTypoToleranceOnAttributes") + void setSettingsTest59() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT) + ); + } + + @Test + @DisplayName("searchableAttributesSimpleExample") + void setSettingsTest60() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number"))); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"searchableAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("searchableAttributesSimpleExampleAlt") + void setSettingsTest61() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number", "serial_number_suffixes")) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}", req.body, JSONCompareMode.STRICT) + ); } @Test - @DisplayName("boolean typoTolerance") - void setSettingsTest1() { + @DisplayName("set_searchable_attributes") + void setSettingsTest62() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)), true); + client.setSettings( + "theIndexName", + new IndexSettings() + .setSearchableAttributes(Arrays.asList("title,alternative_title", "author", "unordered(text)", "emails.personal")) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"typoTolerance\":true}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"searchableAttributes\":[\"title,alternative_title\",\"author\",\"unordered(text)\",\"emails.personal\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); + } - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} + @Test + @DisplayName("set_searchable_attributes") + void setSettingsTest63() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setAttributesForFaceting( + Arrays.asList( + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ) + ) ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"attributesForFaceting\":[\"author\",\"filterOnly(isbn)\",\"searchable(edition)\",\"afterDistinct(category)\",\"afterDistinct(searchable(publisher))\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); } @Test - @DisplayName("enum typoTolerance") - void setSettingsTest2() { + @DisplayName("unretrievable_attributes") + void setSettingsTest64() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setTypoTolerance(TypoToleranceEnum.MIN), true); + client.setSettings("theIndexName", new IndexSettings().setUnretrievableAttributes(Arrays.asList("total_number_of_sales"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"typoTolerance\":\"min\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"unretrievableAttributes\":[\"total_number_of_sales\"]}", req.body, JSONCompareMode.STRICT) + ); } @Test - @DisplayName("ignorePlurals") - void setSettingsTest3() { + @DisplayName("set_retrievable_attributes") + void setSettingsTest65() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(true)), true); + client.setSettings("theIndexName", new IndexSettings().setAttributesToRetrieve(Arrays.asList("author", "title", "content"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesToRetrieve\":[\"author\",\"title\",\"content\"]}", req.body, JSONCompareMode.STRICT) + ); } @Test - @DisplayName("list of string ignorePlurals") - void setSettingsTest4() { + @DisplayName("set_all_attributes_as_retrievable") + void setSettingsTest66() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setIgnorePlurals(IgnorePlurals.of(Arrays.asList(SupportedLanguage.FR))), true); + client.setSettings("theIndexName", new IndexSettings().setAttributesToRetrieve(Arrays.asList("*"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ignorePlurals\":[\"fr\"]}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesToRetrieve\":[\"*\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("removeStopWords boolean") - void setSettingsTest5() { + @DisplayName("specify_attributes_not_to_retrieve") + void setSettingsTest67() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setRemoveStopWords(RemoveStopWords.of(true)), true); + client.setSettings("theIndexName", new IndexSettings().setAttributesToRetrieve(Arrays.asList("*", "-SKU", "-internal_desc"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"removeStopWords\":true}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesToRetrieve\":[\"*\",\"-SKU\",\"-internal_desc\"]}", req.body, JSONCompareMode.STRICT) + ); + } - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; + @Test + @DisplayName("neural_search") + void setSettingsTest68() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"neuralSearch\"}", req.body, JSONCompareMode.STRICT)); + } - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + @Test + @DisplayName("keyword_search") + void setSettingsTest69() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"keywordSearch\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("removeStopWords list of string") - void setSettingsTest6() { + @DisplayName("set_default_ranking") + void setSettingsTest70() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", - new IndexSettings().setRemoveStopWords(RemoveStopWords.of(Arrays.asList(SupportedLanguage.FR))), - true + new IndexSettings().setRanking(Arrays.asList("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom")) ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"removeStopWords\":[\"fr\"]}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"ranking\":[\"typo\",\"geo\",\"words\",\"filters\",\"attribute\",\"proximity\",\"exact\",\"custom\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); } @Test - @DisplayName("boolean distinct") - void setSettingsTest7() { + @DisplayName("set_ranking_by_attribute_asc") + void setSettingsTest71() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(true)), true); + client.setSettings( + "theIndexName", + new IndexSettings() + .setRanking(Arrays.asList("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":true}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"ranking\":[\"asc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); } @Test - @DisplayName("integer distinct") - void setSettingsTest8() { + @DisplayName("set_ranking_by_attribute_desc") + void setSettingsTest72() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(1)), true); + client.setSettings( + "theIndexName", + new IndexSettings() + .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":1}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + req.body, + JSONCompareMode.STRICT + ) + ); } @Test - @DisplayName("distinct company") - void setSettingsTest9() { + @DisplayName("restrict_searchable_attributes") + void setSettingsTest73() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("company").setDistinct(Distinct.of(true))); + client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(popularity)", "asc(price)"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributeForDistinct\":\"company\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"customRanking\":[\"desc(popularity)\",\"asc(price)\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("distinct design") - void setSettingsTest10() { + @DisplayName("set_default_relevancy") + void setSettingsTest74() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("design").setDistinct(Distinct.of(true))); + client.setSettings("theIndexName", new IndexSettings().setRelevancyStrictness(90)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"relevancyStrictness\":90}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_replicas") + void setSettingsTest75() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings().setReplicas(Arrays.asList("name_of_replica_index1", "name_of_replica_index2")) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributeForDistinct\":\"design\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"replicas\":[\"name_of_replica_index1\",\"name_of_replica_index2\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("distinct true") - void setSettingsTest11() { + @DisplayName("set_default_max_values_per_facet") + void setSettingsTest76() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(true))); + client.setSettings("theIndexName", new IndexSettings().setMaxValuesPerFacet(100)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":true}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxValuesPerFacet\":100}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("distinct section") - void setSettingsTest12() { + @DisplayName("set_default_sort_facet_values_by") + void setSettingsTest77() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("section").setDistinct(Distinct.of(true))); + client.setSettings("theIndexName", new IndexSettings().setSortFacetValuesBy("alpha")); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributeForDistinct\":\"section\",\"distinct\":true}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"sortFacetValuesBy\":\"alpha\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting allergens") - void setSettingsTest13() { + @DisplayName("set_attributes_to_snippet") + void setSettingsTest78() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("allergens"))); + client.setSettings("theIndexName", new IndexSettings().setAttributesToSnippet(Arrays.asList("content:80", "description"))); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"allergens\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> + JSONAssert.assertEquals("{\"attributesToSnippet\":[\"content:80\",\"description\"]}", req.body, JSONCompareMode.STRICT) + ); } @Test - @DisplayName("attributesForFaceting categoryPageId") - void setSettingsTest14() { + @DisplayName("set_all_attributes_to_snippet") + void setSettingsTest79() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("searchable(categoryPageId)"))); + client.setSettings("theIndexName", new IndexSettings().setAttributesToSnippet(Arrays.asList("*:80"))); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesToSnippet\":[\"*:80\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("unretrievableAttributes") - void setSettingsTest15() { + @DisplayName("set_default_highlight_pre_tag") + void setSettingsTest80() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setUnretrievableAttributes(Arrays.asList("visible_by"))); + client.setSettings("theIndexName", new IndexSettings().setHighlightPreTag("")); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"unretrievableAttributes\":[\"visible_by\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"highlightPreTag\":\"\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting user restricted data") - void setSettingsTest16() { + @DisplayName("set_default_highlight_post_tag") + void setSettingsTest81() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(visible_by)"))); + client.setSettings("theIndexName", new IndexSettings().setHighlightPostTag("")); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"highlightPostTag\":\"\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting optional filters") - void setSettingsTest17() { + @DisplayName("set_default_snippet_ellipsis_text") + void setSettingsTest82() { assertDoesNotThrow(() -> { - client.setSettings( - "", - new IndexSettings().setAttributesForFaceting(Arrays.asList("can_deliver_quickly", "restaurant")) - ); + client.setSettings("theIndexName", new IndexSettings().setSnippetEllipsisText("…")); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"snippetEllipsisText\":\"…\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting redirect index") - void setSettingsTest18() { + @DisplayName("enable_restrict_highlight_and_snippet_arrays_by_default") + void setSettingsTest83() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("query_terms"))); + client.setSettings("theIndexName", new IndexSettings().setRestrictHighlightAndSnippetArrays(true)); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"query_terms\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"restrictHighlightAndSnippetArrays\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting multiple consequences") - void setSettingsTest19() { + @DisplayName("set_default_hits_per_page") + void setSettingsTest84() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("director"))); + client.setSettings("theIndexName", new IndexSettings().setHitsPerPage(20)); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributesForFaceting\":[\"director\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"hitsPerPage\":20}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting in-depth optional filters") - void setSettingsTest20() { + @DisplayName("set_pagination_limit") + void setSettingsTest85() { assertDoesNotThrow(() -> { - client.setSettings("", new IndexSettings().setAttributesForFaceting(Arrays.asList("filterOnly(brand)"))); + client.setSettings("theIndexName", new IndexSettings().setPaginationLimitedTo(1000)); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"attributesForFaceting\":[\"filterOnly(brand)\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"paginationLimitedTo\":1000}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("mode neuralSearch") - void setSettingsTest21() { + @DisplayName("set_default_min_word_size_for_one_typo") + void setSettingsTest86() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setMode(Mode.NEURAL_SEARCH)); + client.setSettings("theIndexName", new IndexSettings().setMinWordSizefor1Typo(4)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"neuralSearch\"}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"minWordSizefor1Typo\":4}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("mode keywordSearch") - void setSettingsTest22() { + @DisplayName("set_default_min_word_size_for_two_typos") + void setSettingsTest87() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setMode(Mode.KEYWORD_SEARCH)); + client.setSettings("theIndexName", new IndexSettings().setMinWordSizefor2Typos(4)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"mode\":\"keywordSearch\"}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"minWordSizefor2Typos\":4}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributes same priority") - void setSettingsTest23() { + @DisplayName("set_default_typo_tolerance_mode") + void setSettingsTest88() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("title,comments", "ingredients"))); + client.setSettings("theIndexName", new IndexSettings().setTypoTolerance(TypoTolerance.of(true))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"typoTolerance\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributes higher priority") - void setSettingsTest24() { + @DisplayName("disable_typos_on_numeric_tokens_by_default") + void setSettingsTest89() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("title", "ingredients"))); + client.setSettings("theIndexName", new IndexSettings().setAllowTyposOnNumericTokens(false)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"title\",\"ingredients\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"allowTyposOnNumericTokens\":false}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("customRanking retweets") - void setSettingsTest25() { + @DisplayName("disable_typo_tolerance_for_words") + void setSettingsTest90() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(retweets)", "desc(likes)"))); + client.setSettings("theIndexName", new IndexSettings().setDisableTypoToleranceOnWords(Arrays.asList("wheel", "1X2BCD"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"disableTypoToleranceOnWords\":[\"wheel\",\"1X2BCD\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("customRanking boosted") - void setSettingsTest26() { + @DisplayName("set_separators_to_index") + void setSettingsTest91() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(boosted)"))); + client.setSettings("theIndexName", new IndexSettings().setSeparatorsToIndex("+#")); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"customRanking\":[\"desc(boosted)\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"separatorsToIndex\":\"+#\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("customRanking pageviews") - void setSettingsTest27() { + @DisplayName("set_languages_using_querylanguages") + void setSettingsTest92() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(pageviews)", "desc(comments)"))); + client.setSettings( + "theIndexName", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.ES)).setIgnorePlurals(IgnorePlurals.of(true)) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"queryLanguages\":[\"es\"],\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("customRanking applying search parameters for a specific query") - void setSettingsTest28() { + @DisplayName("set_attributes_to_transliterate") + void setSettingsTest93() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", new IndexSettings() - .setCustomRanking(Arrays.asList("desc(nb_airline_liaisons)")) - .setAttributesForFaceting(Arrays.asList("city, country")) + .setIndexLanguages(Arrays.asList(SupportedLanguage.JA)) + .setAttributesToTransliterate(Arrays.asList("name", "description")) ); }); EchoResponse req = echo.getLastResponse(); @@ -4901,7 +7603,7 @@ void setSettingsTest28() { assertEquals("PUT", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city," + " country\"]}", + "{\"indexLanguages\":[\"ja\"],\"attributesToTransliterate\":[\"name\",\"description\"]}", req.body, JSONCompareMode.STRICT ) @@ -4909,39 +7611,71 @@ void setSettingsTest28() { } @Test - @DisplayName("customRanking rounded pageviews") - void setSettingsTest29() { + @DisplayName("set_languages_using_querylanguages") + void setSettingsTest94() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(rounded_pageviews)", "desc(comments)"))); + client.setSettings( + "theIndexName", + new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.ES)).setRemoveStopWords(RemoveStopWords.of(true)) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"queryLanguages\":[\"es\"],\"removeStopWords\":true}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("customRanking price") - void setSettingsTest30() { + @DisplayName("set_camel_case_attributes") + void setSettingsTest95() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(price)"))); + client.setSettings("theIndexName", new IndexSettings().setCamelCaseAttributes(Arrays.asList("description"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"customRanking\":[\"desc(price)\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"camelCaseAttributes\":[\"description\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("ranking exhaustive") - void setSettingsTest31() { + @DisplayName("set_decompounded_attributes") + void setSettingsTest96() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", new IndexSettings() - .setRanking(Arrays.asList("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + .setDecompoundedAttributes( + new HashMap() { + { + put("de", Arrays.asList("name")); + } + } + ) + ); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"decompoundedAttributes\":{\"de\":[\"name\"]}}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_decompounded_multiple_attributes") + void setSettingsTest97() { + assertDoesNotThrow(() -> { + client.setSettings( + "theIndexName", + new IndexSettings() + .setDecompoundedAttributes( + new HashMap() { + { + put("de", Arrays.asList("name_de", "description_de")); + put("fi", Arrays.asList("name_fi", "description_fi")); + } + } + ) ); }); EchoResponse req = echo.getLastResponse(); @@ -4949,7 +7683,7 @@ void setSettingsTest31() { assertEquals("PUT", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", + "{\"decompoundedAttributes\":{\"de\":[\"name_de\",\"description_de\"],\"fi\":[\"name_fi\",\"description_fi\"]}}", req.body, JSONCompareMode.STRICT ) @@ -4957,40 +7691,58 @@ void setSettingsTest31() { } @Test - @DisplayName("ranking standard replica") - void setSettingsTest32() { + @DisplayName("set_keep_diacritics_on_characters") + void setSettingsTest98() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setRanking(Arrays.asList("desc(post_date_timestamp)"))); + client.setSettings("theIndexName", new IndexSettings().setKeepDiacriticsOnCharacters("øé")); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"ranking\":[\"desc(post_date_timestamp)\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"keepDiacriticsOnCharacters\":\"øé\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("ranking virtual replica") - void setSettingsTest33() { + @DisplayName("set_custom_normalization") + void setSettingsTest99() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setCustomRanking(Arrays.asList("desc(post_date_timestamp)"))); + client.setSettings( + "theIndexName", + new IndexSettings() + .setCustomNormalization( + new HashMap() { + { + put( + "default", + new HashMap() { + { + put("ä", "ae"); + } + } + ); + } + } + ) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"customRanking\":[\"desc(post_date_timestamp)\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"customNormalization\":{\"default\":{\"ä\":\"ae\"}}}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("customRanking and ranking sort alphabetically") - void setSettingsTest34() { + @DisplayName("set_languages_using_querylanguages") + void setSettingsTest100() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", new IndexSettings() - .setCustomRanking(Arrays.asList("asc(textual_attribute)")) - .setRanking(Arrays.asList("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + .setQueryLanguages(Arrays.asList(SupportedLanguage.ES)) + .setRemoveStopWords(RemoveStopWords.of(true)) + .setIgnorePlurals(IgnorePlurals.of(true)) ); }); EchoResponse req = echo.getLastResponse(); @@ -4998,7 +7750,7 @@ void setSettingsTest34() { assertEquals("PUT", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals( - "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}", + "{\"queryLanguages\":[\"es\"],\"removeStopWords\":true,\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT ) @@ -5006,483 +7758,348 @@ void setSettingsTest34() { } @Test - @DisplayName("relevancyStrictness") - void setSettingsTest35() { + @DisplayName("set_indexlanguages") + void setSettingsTest101() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings().setCustomRanking(Arrays.asList("asc(textual_attribute)")).setRelevancyStrictness(0) - ); + client.setSettings("theIndexName", new IndexSettings().setIndexLanguages(Arrays.asList(SupportedLanguage.JA))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"indexLanguages\":[\"ja\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("create replica index") - void setSettingsTest36() { + @DisplayName("enable_decompound_query_by_default") + void setSettingsTest102() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList("products_price_desc"))); + client.setSettings("theIndexName", new IndexSettings().setDecompoundQuery(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"products_price_desc\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"decompoundQuery\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("create virtual replica index") - void setSettingsTest37() { + @DisplayName("enable_rules_syntax_by_default") + void setSettingsTest103() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList("virtual(products_price_desc)"))); + client.setSettings("theIndexName", new IndexSettings().setEnableRules(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"virtual(products_price_desc)\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"enableRules\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("unlink replica index") - void setSettingsTest38() { + @DisplayName("enable_personalization_settings") + void setSettingsTest104() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setReplicas(Arrays.asList(""))); + client.setSettings("theIndexName", new IndexSettings().setEnablePersonalization(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replicas\":[\"\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"enablePersonalization\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("forwardToReplicas") - void setSettingsTest39() { + @DisplayName("set_default_query_type") + void setSettingsTest105() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("name", "description")), true); + client.setSettings("theIndexName", new IndexSettings().setQueryType(QueryType.PREFIX_LAST)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"name\",\"description\"]}", req.body, JSONCompareMode.STRICT) - ); - - try { - Map expectedQuery = json.readValue( - "{\"forwardToReplicas\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"queryType\":\"prefixLast\"}", req.body, JSONCompareMode.STRICT)); + } - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } + @Test + @DisplayName("set_default_remove_words_if_no_result") + void setSettingsTest106() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setRemoveWordsIfNoResults(RemoveWordsIfNoResults.NONE)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"removeWordsIfNoResults\":\"none\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("maxValuesPerFacet") - void setSettingsTest40() { + @DisplayName("enable_advanced_syntax_by_default") + void setSettingsTest107() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setMaxValuesPerFacet(1000)); + client.setSettings("theIndexName", new IndexSettings().setAdvancedSyntax(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxValuesPerFacet\":1000}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"advancedSyntax\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("maxFacetHits") - void setSettingsTest41() { + @DisplayName("set_default_optional_words") + void setSettingsTest108() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setMaxFacetHits(1000)); + client.setSettings("theIndexName", new IndexSettings().setOptionalWords(OptionalWords.of(Arrays.asList("blue", "iphone case")))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxFacetHits\":1000}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"optionalWords\":[\"blue\",\"iphone case\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("attributesForFaceting complex") - void setSettingsTest42() { + @DisplayName("disabling_prefix_search_for_some_attributes_by_default") + void setSettingsTest109() { assertDoesNotThrow(() -> { - client.setSettings( - "", - new IndexSettings().setAttributesForFaceting(Arrays.asList("actor", "filterOnly(category)", "searchable(publisher)")) - ); + client.setSettings("theIndexName", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("sku"))); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"disablePrefixOnAttributes\":[\"sku\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("ranking closest dates") - void setSettingsTest43() { + @DisplayName("disabling_exact_for_some_attributes_by_default") + void setSettingsTest110() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings() - .setRanking(Arrays.asList("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) - ); + client.setSettings("theIndexName", new IndexSettings().setDisableExactOnAttributes(Arrays.asList("description"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"disableExactOnAttributes\":[\"description\"]}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributes item variation") - void setSettingsTest44() { + @DisplayName("set_default_exact_single_word_query") + void setSettingsTest111() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("design", "type", "color"))); + client.setSettings("theIndexName", new IndexSettings().setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"exactOnSingleWordQuery\":\"attribute\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributes around location") - void setSettingsTest45() { + @DisplayName("set_default_aternative_as_exact") + void setSettingsTest112() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", new IndexSettings() - .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) - .setCustomRanking(Arrays.asList("desc(links_count)")) + .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.IGNORE_PLURALS, AlternativesAsExact.SINGLE_WORD_SYNONYM)) ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", - req.body, - JSONCompareMode.STRICT - ) + JSONAssert.assertEquals("{\"alternativesAsExact\":[\"ignorePlurals\",\"singleWordSynonym\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("searchableAttributes around location") - void setSettingsTest46() { + @DisplayName("enable_advanced_syntax_by_default") + void setSettingsTest113() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings() - .setSearchableAttributes(Arrays.asList("name", "country", "code", "iata_code")) - .setCustomRanking(Arrays.asList("desc(links_count)")) - ); + client.setSettings("theIndexName", new IndexSettings().setAdvancedSyntax(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"advancedSyntax\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("disableTypoToleranceOnAttributes") - void setSettingsTest47() { + @DisplayName("set_numeric_attributes_for_filtering") + void setSettingsTest114() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("theIndexName", new IndexSettings().setNumericAttributesForFiltering(Arrays.asList("quantity", "popularity"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"numericAttributesForFiltering\":[\"quantity\",\"popularity\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("everything") - void setSettingsTest48() { + @DisplayName("enable_compression_of_integer_array") + void setSettingsTest115() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings() - .setAdvancedSyntax(true) - .setAdvancedSyntaxFeatures(Arrays.asList(AdvancedSyntaxFeatures.EXACT_PHRASE)) - .setAllowCompressionOfIntegerArray(true) - .setAllowTyposOnNumericTokens(true) - .setAlternativesAsExact(Arrays.asList(AlternativesAsExact.SINGLE_WORD_SYNONYM)) - .setAttributeCriteriaComputedByMinProximity(true) - .setAttributeForDistinct("test") - .setAttributesForFaceting(Arrays.asList("algolia")) - .setAttributesToHighlight(Arrays.asList("algolia")) - .setAttributesToRetrieve(Arrays.asList("algolia")) - .setAttributesToSnippet(Arrays.asList("algolia")) - .setAttributesToTransliterate(Arrays.asList("algolia")) - .setCamelCaseAttributes(Arrays.asList("algolia")) - .setCustomNormalization( - new HashMap() { - { - put( - "algolia", - new HashMap() { - { - put("aloglia", "aglolia"); - } - } - ); - } - } - ) - .setCustomRanking(Arrays.asList("algolia")) - .setDecompoundQuery(false) - .setDecompoundedAttributes( - new HashMap() { - { - put("algolia", "aloglia"); - } - } - ) - .setDisableExactOnAttributes(Arrays.asList("algolia")) - .setDisablePrefixOnAttributes(Arrays.asList("algolia")) - .setDisableTypoToleranceOnAttributes(Arrays.asList("algolia")) - .setDisableTypoToleranceOnWords(Arrays.asList("algolia")) - .setDistinct(Distinct.of(3)) - .setEnablePersonalization(true) - .setEnableReRanking(false) - .setEnableRules(true) - .setExactOnSingleWordQuery(ExactOnSingleWordQuery.ATTRIBUTE) - .setHighlightPreTag("") - .setHighlightPostTag("") - .setHitsPerPage(10) - .setIgnorePlurals(IgnorePlurals.of(false)) - .setIndexLanguages(Arrays.asList(SupportedLanguage.FR)) - .setKeepDiacriticsOnCharacters("abc") - .setMaxFacetHits(20) - .setMaxValuesPerFacet(30) - .setMinProximity(6) - .setMinWordSizefor1Typo(5) - .setMinWordSizefor2Typos(11) - .setMode(Mode.NEURAL_SEARCH) - .setNumericAttributesForFiltering(Arrays.asList("algolia")) - .setOptionalWords(OptionalWords.of(Arrays.asList("myspace"))) - .setPaginationLimitedTo(0) - .setQueryLanguages(Arrays.asList(SupportedLanguage.FR)) - .setQueryType(QueryType.PREFIX_LAST) - .setRanking(Arrays.asList("geo")) - .setReRankingApplyFilter(ReRankingApplyFilter.of("mySearch:filters")) - .setRelevancyStrictness(10) - .setRemoveStopWords(RemoveStopWords.of(false)) - .setRemoveWordsIfNoResults(RemoveWordsIfNoResults.LAST_WORDS) - .setRenderingContent( - new RenderingContent() - .setFacetOrdering( - new FacetOrdering() - .setFacets(new Facets().setOrder(Arrays.asList("a", "b"))) - .setValues( - new HashMap() { - { - put("a", new Value().setOrder(Arrays.asList("b")).setSortRemainingBy(SortRemainingBy.COUNT)); - } - } - ) - ) - ) - .setReplaceSynonymsInHighlight(true) - .setReplicas(Arrays.asList("")) - .setResponseFields(Arrays.asList("algolia")) - .setRestrictHighlightAndSnippetArrays(true) - .setSearchableAttributes(Arrays.asList("foo")) - .setSemanticSearch(new SemanticSearch().setEventSources(Arrays.asList("foo"))) - .setSeparatorsToIndex("bar") - .setSnippetEllipsisText("---") - .setSortFacetValuesBy("date") - .setTypoTolerance(TypoTolerance.of(false)) - .setUnretrievableAttributes(Arrays.asList("foo")) - .setUserData( - new HashMap() { - { - put("user", "data"); - } - } - ) - ); + client.setSettings("theIndexName", new IndexSettings().setAllowCompressionOfIntegerArray(true)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"allowCompressionOfIntegerArray\":true}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributesWithCustomRankingsAndAttributesForFaceting") - void setSettingsTest49() { + @DisplayName("set_attributes_for_distinct") + void setSettingsTest116() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings() - .setSearchableAttributes(Arrays.asList("brand", "name", "categories", "unordered(description)")) - .setCustomRanking(Arrays.asList("desc(popularity)")) - .setAttributesForFaceting(Arrays.asList("searchable(brand)", "type", "categories", "price")) - ); + client.setSettings("theIndexName", new IndexSettings().setAttributeForDistinct("url")); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}", - req.body, - JSONCompareMode.STRICT - ) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributeForDistinct\":\"url\"}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributesProductReferenceSuffixes") - void setSettingsTest50() { + @DisplayName("set_distinct") + void setSettingsTest117() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings().setSearchableAttributes(Arrays.asList("name", "product_reference", "product_reference_suffixes")) - ); + client.setSettings("theIndexName", new IndexSettings().setDistinct(Distinct.of(1)).setAttributeForDistinct("url")); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals( - "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}", - req.body, - JSONCompareMode.STRICT - ) + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"distinct\":1,\"attributeForDistinct\":\"url\"}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("queryLanguageAndIgnorePlurals") - void setSettingsTest51() { + @DisplayName("set_replace_synonyms_in_highlights") + void setSettingsTest118() { assertDoesNotThrow(() -> { - client.setSettings( - "theIndexName", - new IndexSettings().setQueryLanguages(Arrays.asList(SupportedLanguage.EN)).setIgnorePlurals(IgnorePlurals.of(true)) - ); + client.setSettings("theIndexName", new IndexSettings().setReplaceSynonymsInHighlight(false)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"replaceSynonymsInHighlight\":false}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("searchableAttributesInMovies") - void setSettingsTest52() { + @DisplayName("set_min_proximity") + void setSettingsTest119() { assertDoesNotThrow(() -> { - client.setSettings("movies", new IndexSettings().setSearchableAttributes(Arrays.asList("title_eng", "title_fr", "title_es"))); + client.setSettings("theIndexName", new IndexSettings().setMinProximity(1)); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/movies/settings", req.path); + assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}", req.body, JSONCompareMode.STRICT) - ); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"minProximity\":1}", req.body, JSONCompareMode.STRICT)); } @Test - @DisplayName("disablePrefixOnAttributes") - void setSettingsTest53() { + @DisplayName("set_default_field") + void setSettingsTest120() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDisablePrefixOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("theIndexName", new IndexSettings().setResponseFields(Arrays.asList("hits", "hitsPerPage", "nbPages", "page"))); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"disablePrefixOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals("{\"responseFields\":[\"hits\",\"hitsPerPage\",\"nbPages\",\"page\"]}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("disableTypoToleranceOnAttributes") - void setSettingsTest54() { + @DisplayName("set_max_facet_hits") + void setSettingsTest121() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setDisableTypoToleranceOnAttributes(Arrays.asList("serial_number"))); + client.setSettings("theIndexName", new IndexSettings().setMaxFacetHits(10)); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT) + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"maxFacetHits\":10}", req.body, JSONCompareMode.STRICT)); + } + + @Test + @DisplayName("set_attribute_criteria_computed_by_min_proximity") + void setSettingsTest122() { + assertDoesNotThrow(() -> { + client.setSettings("theIndexName", new IndexSettings().setAttributeCriteriaComputedByMinProximity(true)); + }); + EchoResponse req = echo.getLastResponse(); + assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("PUT", req.method); + assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"attributeCriteriaComputedByMinProximity\":true}", req.body, JSONCompareMode.STRICT) ); } @Test - @DisplayName("searchableAttributesSimpleExample") - void setSettingsTest55() { + @DisplayName("set_user_data") + void setSettingsTest123() { assertDoesNotThrow(() -> { - client.setSettings("theIndexName", new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number"))); + client.setSettings( + "theIndexName", + new IndexSettings() + .setUserData( + new HashMap() { + { + put("extraData", "This is the custom data that you want to store in your index"); + } + } + ) + ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"searchableAttributes\":[\"serial_number\"]}", req.body, JSONCompareMode.STRICT)); + assertDoesNotThrow(() -> + JSONAssert.assertEquals( + "{\"userData\":{\"extraData\":\"This is the custom data that you want to store in" + " your index\"}}", + req.body, + JSONCompareMode.STRICT + ) + ); } @Test - @DisplayName("searchableAttributesSimpleExampleAlt") - void setSettingsTest56() { + @DisplayName("set_rendering_content") + void setSettingsTest124() { assertDoesNotThrow(() -> { client.setSettings( "theIndexName", - new IndexSettings().setSearchableAttributes(Arrays.asList("serial_number", "serial_number_suffixes")) + new IndexSettings() + .setRenderingContent( + new RenderingContent() + .setFacetOrdering( + new FacetOrdering() + .setFacets(new Facets().setOrder(Arrays.asList("size", "brand"))) + .setValues( + new HashMap() { + { + put( + "brand", + new Value() + .setOrder(Arrays.asList("uniqlo")) + .setHide(Arrays.asList("muji")) + .setSortRemainingBy(SortRemainingBy.COUNT) + ); + put("size", new Value().setOrder(Arrays.asList("S", "M", "L")).setSortRemainingBy(SortRemainingBy.HIDDEN)); + } + } + ) + ) + ) ); }); EchoResponse req = echo.getLastResponse(); assertEquals("/1/indexes/theIndexName/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}", req.body, JSONCompareMode.STRICT) + JSONAssert.assertEquals( + "{\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"size\",\"brand\"]},\"values\":{\"brand\":{\"order\":[\"uniqlo\"],\"hide\":[\"muji\"],\"sortRemainingBy\":\"count\"},\"size\":{\"order\":[\"S\",\"M\",\"L\"],\"sortRemainingBy\":\"hidden\"}}}}}", + req.body, + JSONCompareMode.STRICT + ) ); } diff --git a/tests/output/javascript/src/requests/search.test.ts b/tests/output/javascript/src/requests/search.test.ts index e4083901f1..73bebad039 100644 --- a/tests/output/javascript/src/requests/search.test.ts +++ b/tests/output/javascript/src/requests/search.test.ts @@ -2641,6 +2641,57 @@ describe('searchSingleIndex', () => { expect(req.searchParams).toStrictEqual(undefined); }); + test('facetFiltersBook', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['category:Book'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facetFilters: ['category:Book'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('facetFiltersAND', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['category:Book', 'author:John Doe'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facetFilters: ['category:Book', 'author:John Doe'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('facetFiltersOR', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: [['category:Book', 'author:John Doe']] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facetFilters: [['category:Book', 'author:John Doe']] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('facetFiltersCombined', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetFilters: ['author:John Doe', ['category:Book', 'category:Movie']] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + facetFilters: ['author:John Doe', ['category:Book', 'category:Movie']], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + test('facetFiltersNeg', async () => { const req = (await client.searchSingleIndex({ indexName: 'indexName', @@ -2918,6 +2969,18 @@ describe('searchSingleIndex', () => { expect(req.searchParams).toStrictEqual(undefined); }); + test('userToken1234', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', userToken: 'user-1234' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', userToken: 'user-1234' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + test('analyticsTag', async () => { const req = (await client.searchSingleIndex({ indexName: 'indexName', @@ -2957,948 +3020,2920 @@ describe('searchSingleIndex', () => { }); expect(req.searchParams).toStrictEqual(undefined); }); -}); -describe('searchSynonyms', () => { - test('searchSynonyms with minimal parameters', async () => { - const req = (await client.searchSynonyms({ indexName: 'indexName' })) as unknown as EchoResponse; + test('attributesToHighlightOverride', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToHighlight: ['title', 'content'] }, + })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/indexName/synonyms/search'); + expect(req.path).toEqual('/1/indexes/indexName/query'); expect(req.method).toEqual('POST'); - expect(req.data).toEqual({}); + expect(req.data).toEqual({ query: 'query', attributesToHighlight: ['title', 'content'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchSynonyms with all parameters', async () => { - const req = (await client.searchSynonyms({ + test('disableTypoToleranceOnAttributes', async () => { + const req = (await client.searchSingleIndex({ indexName: 'indexName', - searchSynonymsParams: { query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }, + searchParams: { query: 'query', disableTypoToleranceOnAttributes: ['serial_number'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/indexName/synonyms/search'); + expect(req.path).toEqual('/1/indexes/indexName/query'); expect(req.method).toEqual('POST'); - expect(req.data).toEqual({ query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }); + expect(req.data).toEqual({ query: 'query', disableTypoToleranceOnAttributes: ['serial_number'] }); expect(req.searchParams).toStrictEqual(undefined); }); -}); -describe('searchUserIds', () => { - test('searchUserIds', async () => { - const req = (await client.searchUserIds({ - query: 'test', - clusterName: 'theClusterName', - page: 5, - hitsPerPage: 10, + test('search_a_query', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'shirt' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/clusters/mapping/search'); + expect(req.path).toEqual('/1/indexes/indexName/query'); expect(req.method).toEqual('POST'); - expect(req.data).toEqual({ query: 'test', clusterName: 'theClusterName', page: 5, hitsPerPage: 10 }); + expect(req.data).toEqual({ query: 'shirt' }); expect(req.searchParams).toStrictEqual(undefined); }); -}); -describe('setDictionarySettings', () => { - test('get setDictionarySettings results with minimal parameters', async () => { - const req = (await client.setDictionarySettings({ - disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + test('search_everything', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: '' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/dictionaries/*/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ disableStandardEntries: { plurals: { fr: false, en: false, ru: true } } }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: '' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('get setDictionarySettings results with all parameters', async () => { - const req = (await client.setDictionarySettings({ - disableStandardEntries: { - plurals: { fr: false, en: false, ru: true }, - stopwords: { fr: false }, - compounds: { ru: true }, + test('api_filtering_range_example', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'books', filters: 'price:10 TO 20' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'books', filters: 'price:10 TO 20' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_a_query', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: '', + similarQuery: 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen', + filters: 'year:1991 TO 2001', }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/dictionaries/*/settings'); - expect(req.method).toEqual('PUT'); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); expect(req.data).toEqual({ - disableStandardEntries: { - plurals: { fr: false, en: false, ru: true }, - stopwords: { fr: false }, - compounds: { ru: true }, - }, + query: '', + similarQuery: 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen', + filters: 'year:1991 TO 2001', }); expect(req.searchParams).toStrictEqual(undefined); }); -}); -describe('setSettings', () => { - test('minimal parameters', async () => { - const req = (await client.setSettings({ - indexName: 'cts_e2e_settings', - indexSettings: { paginationLimitedTo: 10 }, - forwardToReplicas: true, + test('override_retrievable_attributes', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToRetrieve: ['title', 'content'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ paginationLimitedTo: 10 }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', attributesToRetrieve: ['title', 'content'] }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('boolean typoTolerance', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { typoTolerance: true }, - forwardToReplicas: true, + test('restrict_searchable_attributes', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', restrictSearchableAttributes: ['title', 'author'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ typoTolerance: true }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', restrictSearchableAttributes: ['title', 'author'] }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('enum typoTolerance', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { typoTolerance: 'min' }, - forwardToReplicas: true, + test('override_default_relevancy', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', relevancyStrictness: 70 }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ typoTolerance: 'min' }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', relevancyStrictness: 70 }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('ignorePlurals', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { ignorePlurals: true }, - forwardToReplicas: true, + test('apply_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: '(category:Book OR category:Ebook) AND _tags:published' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ ignorePlurals: true }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', filters: '(category:Book OR category:Ebook) AND _tags:published' }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('list of string ignorePlurals', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { ignorePlurals: ['fr'] }, - forwardToReplicas: true, + test('apply_all_filters', async () => { + const req = (await client.searchSingleIndex({ + 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"', + }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ ignorePlurals: ['fr'] }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + 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"', + }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('removeStopWords boolean', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { removeStopWords: true }, - forwardToReplicas: true, + test('escape_spaces', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'category:"Books and Comics"' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ removeStopWords: true }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', filters: 'category:"Books and Comics"' }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('removeStopWords list of string', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { removeStopWords: ['fr'] }, - forwardToReplicas: true, + test('escape_keywords', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'keyword:"OR"' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ removeStopWords: ['fr'] }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', filters: 'keyword:"OR"' }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('boolean distinct', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { distinct: true }, - forwardToReplicas: true, + test('escape_single_quotes', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'content:"It\'s a wonderful day"' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ distinct: true }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', filters: 'content:"It\'s a wonderful day"' }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('integer distinct', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { distinct: 1 }, - forwardToReplicas: true, + test('escape_double_quotes', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', filters: 'content:"She said "Hello World"' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); - expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ distinct: 1 }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', filters: 'content:"She said "Hello World"' }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('distinct company', async () => { - const req = (await client.setSettings({ - indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'company', distinct: true }, + test('apply_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalFilters: ['category:Book', 'author:John Doe'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', optionalFilters: ['category:Book', 'author:John Doe'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('apply_negative_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalFilters: ['category:Book', 'author:-John Doe'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', optionalFilters: ['category:Book', 'author:-John Doe'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('apply_numeric_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', numericFilters: ['price < 1000', ['inStock = 1', 'deliveryDate < 1441755506']] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + numericFilters: ['price < 1000', ['inStock = 1', 'deliveryDate < 1441755506']], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('apply_tag_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', tagFilters: ['SciFi', ['Book', 'Movie']] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', tagFilters: ['SciFi', ['Book', 'Movie']] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('apply_filters', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', sumOrFiltersScores: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', sumOrFiltersScores: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('facets_all', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facets: ['*'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facets: ['*'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('retrieve_only_some_facets', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facets: ['category', 'author'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facets: ['category', 'author'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_max_values_per_facet', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', maxValuesPerFacet: 20 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', maxValuesPerFacet: 20 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_faceting_after_distinct', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', facetingAfterDistinct: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', facetingAfterDistinct: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('sort_facet_values_alphabetically', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', sortFacetValuesBy: 'count' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', sortFacetValuesBy: 'count' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_attributes_to_snippet', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', attributesToSnippet: ['title', 'content:80'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', attributesToSnippet: ['title', 'content:80'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_highlight_pre_tag', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', highlightPreTag: '' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', highlightPreTag: '' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_highlight_post_tag', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', highlightPostTag: '' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', highlightPostTag: '' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_snippet_ellipsis_text', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', snippetEllipsisText: '' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', snippetEllipsisText: '' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_restrict_highlight_and_snippet_arrays', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', restrictHighlightAndSnippetArrays: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', restrictHighlightAndSnippetArrays: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('access_page', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', page: 0 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', page: 0 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_hits_per_page', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', hitsPerPage: 10 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', hitsPerPage: 10 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('get_nth_hit', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', offset: 4 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', offset: 4 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('get_n_results', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', length: 4 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', length: 4 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_min_word_size_for_one_typo', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minWordSizefor1Typo: 2 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', minWordSizefor1Typo: 2 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_min_word_size_for_two_typos', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minWordSizefor2Typos: 2 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', minWordSizefor2Typos: 2 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_typo_tolerance_mode', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', typoTolerance: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', typoTolerance: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_typos_on_numeric_tokens_at_search_time', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', allowTyposOnNumericTokens: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', allowTyposOnNumericTokens: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_around_a_position', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundLatLng: '40.71, -74.01' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', aroundLatLng: '40.71, -74.01' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_around_server_ip', async () => { + const req = (await client.searchSingleIndex( + { indexName: 'indexName', searchParams: { 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', + }, + }, + )) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', aroundLatLngViaIP: true }); + expect(req.searchParams).toStrictEqual(undefined); + expect(req.headers).toEqual( + expect.objectContaining({ + 'x-forwarded-for': '94.228.178.246 // should be replaced with the actual IP you would like to search around', + }), + ); + }); + + test('set_around_radius', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundRadius: 1000 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', aroundRadius: 1000 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_automatic_radius', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundRadius: 'all' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', aroundRadius: 'all' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_geo_search_precision', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', aroundPrecision: 100 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', aroundPrecision: 100 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_geo_search_precision_non_linear', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + aroundPrecision: [ + { from: 0, value: 25 }, + { from: 2000, value: 1000 }, + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + aroundPrecision: [ + { from: 0, value: 25 }, + { from: 2000, value: 1000 }, + ], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_minimum_geo_search_radius', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minimumAroundRadius: 1000 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', minimumAroundRadius: 1000 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_inside_rectangular_area', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insideBoundingBox: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + insideBoundingBox: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_inside_multiple_rectangular_areas', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insideBoundingBox: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875], + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + insideBoundingBox: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875], + ], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_inside_polygon_area', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { + query: 'query', + insidePolygon: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625], + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + query: 'query', + insidePolygon: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625], + ], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('search_inside_multiple_polygon_areas', async () => { + const req = (await client.searchSingleIndex({ + 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, + ], + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + 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, + ], + ], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_querylanguages_override', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', ignorePlurals: ['ca', 'es'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', ignorePlurals: ['ca', 'es'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_querylanguages_override', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeStopWords: ['ca', 'es'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', removeStopWords: ['ca', 'es'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_querylanguages_override', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeStopWords: ['ca', 'es'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', removeStopWords: ['ca', 'es'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_querylanguages_with_japanese_query', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', queryLanguages: ['ja', 'en'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', queryLanguages: ['ja', 'en'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_natural_languages', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: '', naturalLanguages: ['fr'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: '', naturalLanguages: ['fr'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_natural_languages_with_query', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: '', naturalLanguages: ['fr'], removeWordsIfNoResults: 'firstWords' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: '', naturalLanguages: ['fr'], removeWordsIfNoResults: 'firstWords' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_decompound_query_search_time', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', decompoundQuery: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', decompoundQuery: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_rules_search_time', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableRules: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enableRules: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_rule_contexts', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', ruleContexts: ['front_end', 'website2'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', ruleContexts: ['front_end', 'website2'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_personalization', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enablePersonalization: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_personalization_with_user_token', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enablePersonalization: true, userToken: '123456' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('personalization_impact', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', personalizationImpact: 20 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', personalizationImpact: 20 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_user_token', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', userToken: '123456' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', userToken: '123456' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_user_token_with_personalization', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enablePersonalization: true, userToken: '123456' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enablePersonalization: true, userToken: '123456' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_query_type', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', queryType: 'prefixAll' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', queryType: 'prefixAll' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_remove_words_if_no_results', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', removeWordsIfNoResults: 'lastWords' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', removeWordsIfNoResults: 'lastWords' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_advanced_syntax_search_time', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', advancedSyntax: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('overide_default_optional_words', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', optionalWords: ['toyota', '2020 2021'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', optionalWords: ['toyota', '2020 2021'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disabling_exact_for_some_attributes_search_time', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', disableExactOnAttributes: ['description'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', disableExactOnAttributes: ['description'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_exact_single_word_query', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', exactOnSingleWordQuery: 'none' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', exactOnSingleWordQuery: 'none' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_aternative_as_exact', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', alternativesAsExact: ['multiWordsSynonym'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', alternativesAsExact: ['multiWordsSynonym'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_advanced_syntax_exact_phrase', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['exactPhrase'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['exactPhrase'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_advanced_syntax_exclude_words', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['excludeWords'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', advancedSyntax: true, advancedSyntaxFeatures: ['excludeWords'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_distinct', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', distinct: 0 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', distinct: 0 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('get_ranking_info', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', getRankingInfo: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', getRankingInfo: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_click_analytics', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', clickAnalytics: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', clickAnalytics: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_click_analytics', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', clickAnalytics: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', clickAnalytics: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_analytics', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', analytics: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', analytics: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('add_analytics_tags', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', analyticsTags: ['front_end', 'website2'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', analyticsTags: ['front_end', 'website2'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_synonyms', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', synonyms: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', synonyms: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_replace_synonyms_in_highlights', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', replaceSynonymsInHighlight: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', replaceSynonymsInHighlight: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_min_proximity', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', minProximity: 2 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', minProximity: 2 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_default_field', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', responseFields: ['hits', 'facets'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', responseFields: ['hits', 'facets'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('override_percentile_computation', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', percentileComputation: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', percentileComputation: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_ab_test', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableABTest: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enableABTest: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_enable_re_ranking', async () => { + const req = (await client.searchSingleIndex({ + indexName: 'indexName', + searchParams: { query: 'query', enableReRanking: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/query'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'query', enableReRanking: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); +}); + +describe('searchSynonyms', () => { + test('searchSynonyms with minimal parameters', async () => { + const req = (await client.searchSynonyms({ indexName: 'indexName' })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/synonyms/search'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({}); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchSynonyms with all parameters', async () => { + const req = (await client.searchSynonyms({ + indexName: 'indexName', + searchSynonymsParams: { query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/indexName/synonyms/search'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'myQuery', type: 'altcorrection1', page: 10, hitsPerPage: 10 }); + expect(req.searchParams).toStrictEqual(undefined); + }); +}); + +describe('searchUserIds', () => { + test('searchUserIds', async () => { + const req = (await client.searchUserIds({ + query: 'test', + clusterName: 'theClusterName', + page: 5, + hitsPerPage: 10, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/clusters/mapping/search'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ query: 'test', clusterName: 'theClusterName', page: 5, hitsPerPage: 10 }); + expect(req.searchParams).toStrictEqual(undefined); + }); +}); + +describe('setDictionarySettings', () => { + test('get setDictionarySettings results with minimal parameters', async () => { + const req = (await client.setDictionarySettings({ + disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/dictionaries/*/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ disableStandardEntries: { plurals: { fr: false, en: false, ru: true } } }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('get setDictionarySettings results with all parameters', async () => { + const req = (await client.setDictionarySettings({ + disableStandardEntries: { + plurals: { fr: false, en: false, ru: true }, + stopwords: { fr: false }, + compounds: { ru: true }, + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/dictionaries/*/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + disableStandardEntries: { + plurals: { fr: false, en: false, ru: true }, + stopwords: { fr: false }, + compounds: { ru: true }, + }, + }); + expect(req.searchParams).toStrictEqual(undefined); + }); +}); + +describe('setSettings', () => { + test('minimal parameters', async () => { + const req = (await client.setSettings({ + indexName: 'cts_e2e_settings', + indexSettings: { paginationLimitedTo: 10 }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ paginationLimitedTo: 10 }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('boolean typoTolerance', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { typoTolerance: true }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ typoTolerance: true }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('enum typoTolerance', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { typoTolerance: 'min' }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ typoTolerance: 'min' }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('ignorePlurals', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ignorePlurals: true }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ ignorePlurals: true }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('list of string ignorePlurals', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ignorePlurals: ['fr'] }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ ignorePlurals: ['fr'] }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('removeStopWords boolean', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { removeStopWords: true }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ removeStopWords: true }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('removeStopWords list of string', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { removeStopWords: ['fr'] }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ removeStopWords: ['fr'] }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('boolean distinct', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { distinct: true }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ distinct: true }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('integer distinct', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { distinct: 1 }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ distinct: 1 }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('distinct company', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'company', distinct: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributeForDistinct: 'company', distinct: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('distinct design', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'design', distinct: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributeForDistinct: 'design', distinct: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('distinct true', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { distinct: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ distinct: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('distinct section', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributeForDistinct: 'section', distinct: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributeForDistinct: 'section', distinct: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting allergens', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['allergens'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['allergens'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('api_attributes_for_faceting', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['genre', 'author'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['genre', 'author'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('api_attributes_for_faceting_searchable', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['genre', 'searchable(author)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['genre', 'searchable(author)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('api_attributes_for_filter_only', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(genre)', 'author'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['filterOnly(genre)', 'author'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting categoryPageId', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['searchable(categoryPageId)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['searchable(categoryPageId)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('unretrievableAttributes', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { unretrievableAttributes: ['visible_by'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ unretrievableAttributes: ['visible_by'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting user restricted data', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(visible_by)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['filterOnly(visible_by)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting optional filters', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting redirect index', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['query_terms'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['query_terms'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting multiple consequences', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['director'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['director'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting in-depth optional filters', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['filterOnly(brand)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['filterOnly(brand)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('mode neuralSearch', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { mode: 'neuralSearch' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ mode: 'neuralSearch' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('mode keywordSearch', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { mode: 'keywordSearch' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ mode: 'keywordSearch' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributes same priority', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['title,comments', 'ingredients'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['title,comments', 'ingredients'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributes higher priority', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['title', 'ingredients'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['title', 'ingredients'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking retweets', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(retweets)', 'desc(likes)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(retweets)', 'desc(likes)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking boosted', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(boosted)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(boosted)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking pageviews', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(pageviews)', 'desc(comments)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(pageviews)', 'desc(comments)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking applying search parameters for a specific query', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(nb_airline_liaisons)'], attributesForFaceting: ['city, country'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + customRanking: ['desc(nb_airline_liaisons)'], + attributesForFaceting: ['city, country'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking rounded pageviews', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking price', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(price)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(price)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('ranking exhaustive', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('ranking standard replica', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { ranking: ['desc(post_date_timestamp)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ ranking: ['desc(post_date_timestamp)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('ranking virtual replica', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(post_date_timestamp)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['desc(post_date_timestamp)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('customRanking and ranking sort alphabetically', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + customRanking: ['asc(textual_attribute)'], + ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + customRanking: ['asc(textual_attribute)'], + ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('relevancyStrictness', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('create replica index', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['products_price_desc'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ replicas: ['products_price_desc'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('create replica index articles', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['articles_date_desc'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ replicas: ['articles_date_desc'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('create virtual replica index', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: ['virtual(products_price_desc)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ replicas: ['virtual(products_price_desc)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('unlink replica index', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { replicas: [''] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ replicas: [''] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('forwardToReplicas', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['name', 'description'] }, + forwardToReplicas: true, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['name', 'description'] }); + expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + }); + + test('maxValuesPerFacet', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { maxValuesPerFacet: 1000 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ maxValuesPerFacet: 1000 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('maxFacetHits', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { maxFacetHits: 1000 }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ maxFacetHits: 1000 }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesForFaceting complex', async () => { + const req = (await client.setSettings({ + indexName: '', + indexSettings: { attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('ranking closest dates', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + ranking: [ + 'asc(date_timestamp)', + 'typo', + 'geo', + 'words', + 'filters', + 'proximity', + 'attribute', + 'exact', + 'custom', + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + ranking: ['asc(date_timestamp)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributes item variation', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['design', 'type', 'color'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['design', 'type', 'color'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributes around location', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['name', 'country', 'code', 'iata_code'], + customRanking: ['desc(links_count)'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + searchableAttributes: ['name', 'country', 'code', 'iata_code'], + customRanking: ['desc(links_count)'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesToHighlight', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributesToHighlight: ['author', 'title', 'content'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesToHighlight: ['author', 'title', 'content'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('attributesToHighlightStar', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { attributesToHighlight: ['*'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ attributesToHighlight: ['*'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('everything', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + advancedSyntax: true, + advancedSyntaxFeatures: ['exactPhrase'], + allowCompressionOfIntegerArray: true, + allowTyposOnNumericTokens: true, + alternativesAsExact: ['singleWordSynonym'], + attributeCriteriaComputedByMinProximity: true, + attributeForDistinct: 'test', + attributesForFaceting: ['algolia'], + attributesToHighlight: ['algolia'], + attributesToRetrieve: ['algolia'], + attributesToSnippet: ['algolia'], + attributesToTransliterate: ['algolia'], + camelCaseAttributes: ['algolia'], + customNormalization: { algolia: { aloglia: 'aglolia' } }, + customRanking: ['algolia'], + decompoundQuery: false, + decompoundedAttributes: { algolia: 'aloglia' }, + disableExactOnAttributes: ['algolia'], + disablePrefixOnAttributes: ['algolia'], + disableTypoToleranceOnAttributes: ['algolia'], + disableTypoToleranceOnWords: ['algolia'], + distinct: 3, + enablePersonalization: true, + enableReRanking: false, + enableRules: true, + exactOnSingleWordQuery: 'attribute', + highlightPreTag: '', + highlightPostTag: '', + hitsPerPage: 10, + ignorePlurals: false, + indexLanguages: ['fr'], + keepDiacriticsOnCharacters: 'abc', + maxFacetHits: 20, + maxValuesPerFacet: 30, + minProximity: 6, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + mode: 'neuralSearch', + numericAttributesForFiltering: ['algolia'], + optionalWords: ['myspace'], + paginationLimitedTo: 0, + queryLanguages: ['fr'], + queryType: 'prefixLast', + ranking: ['geo'], + reRankingApplyFilter: 'mySearch:filters', + relevancyStrictness: 10, + removeStopWords: false, + removeWordsIfNoResults: 'lastWords', + renderingContent: { + facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, + }, + replaceSynonymsInHighlight: true, + replicas: [''], + responseFields: ['algolia'], + restrictHighlightAndSnippetArrays: true, + searchableAttributes: ['foo'], + semanticSearch: { eventSources: ['foo'] }, + separatorsToIndex: 'bar', + snippetEllipsisText: '---', + sortFacetValuesBy: 'date', + typoTolerance: false, + unretrievableAttributes: ['foo'], + userData: { user: 'data' }, + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + advancedSyntax: true, + advancedSyntaxFeatures: ['exactPhrase'], + allowCompressionOfIntegerArray: true, + allowTyposOnNumericTokens: true, + alternativesAsExact: ['singleWordSynonym'], + attributeCriteriaComputedByMinProximity: true, + attributeForDistinct: 'test', + attributesForFaceting: ['algolia'], + attributesToHighlight: ['algolia'], + attributesToRetrieve: ['algolia'], + attributesToSnippet: ['algolia'], + attributesToTransliterate: ['algolia'], + camelCaseAttributes: ['algolia'], + customNormalization: { algolia: { aloglia: 'aglolia' } }, + customRanking: ['algolia'], + decompoundQuery: false, + decompoundedAttributes: { algolia: 'aloglia' }, + disableExactOnAttributes: ['algolia'], + disablePrefixOnAttributes: ['algolia'], + disableTypoToleranceOnAttributes: ['algolia'], + disableTypoToleranceOnWords: ['algolia'], + distinct: 3, + enablePersonalization: true, + enableReRanking: false, + enableRules: true, + exactOnSingleWordQuery: 'attribute', + highlightPreTag: '', + highlightPostTag: '', + hitsPerPage: 10, + ignorePlurals: false, + indexLanguages: ['fr'], + keepDiacriticsOnCharacters: 'abc', + maxFacetHits: 20, + maxValuesPerFacet: 30, + minProximity: 6, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + mode: 'neuralSearch', + numericAttributesForFiltering: ['algolia'], + optionalWords: ['myspace'], + paginationLimitedTo: 0, + queryLanguages: ['fr'], + queryType: 'prefixLast', + ranking: ['geo'], + reRankingApplyFilter: 'mySearch:filters', + relevancyStrictness: 10, + removeStopWords: false, + removeWordsIfNoResults: 'lastWords', + renderingContent: { + facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, + }, + replaceSynonymsInHighlight: true, + replicas: [''], + responseFields: ['algolia'], + restrictHighlightAndSnippetArrays: true, + searchableAttributes: ['foo'], + semanticSearch: { eventSources: ['foo'] }, + separatorsToIndex: 'bar', + snippetEllipsisText: '---', + sortFacetValuesBy: 'date', + typoTolerance: false, + unretrievableAttributes: ['foo'], + userData: { user: 'data' }, + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesWithCustomRankingsAndAttributesForFaceting', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], + customRanking: ['desc(popularity)'], + attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], + customRanking: ['desc(popularity)'], + attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesOrdering', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['unordered(title)', 'cast'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['unordered(title)', 'cast'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesProductReferenceSuffixes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('queryLanguageAndIgnorePlurals', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { queryLanguages: ['en'], ignorePlurals: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ queryLanguages: ['en'], ignorePlurals: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesInMovies', async () => { + const req = (await client.setSettings({ + indexName: 'movies', + indexSettings: { searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/movies/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disablePrefixOnAttributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disablePrefixOnAttributes: ['serial_number'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ disablePrefixOnAttributes: ['serial_number'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disableTypoToleranceOnAttributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ disableTypoToleranceOnAttributes: ['serial_number'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesSimpleExample', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['serial_number'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['serial_number'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('searchableAttributesSimpleExampleAlt', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ searchableAttributes: ['serial_number', 'serial_number_suffixes'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_searchable_attributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + searchableAttributes: ['title,alternative_title', 'author', 'unordered(text)', 'emails.personal'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + searchableAttributes: ['title,alternative_title', 'author', 'unordered(text)', 'emails.personal'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_searchable_attributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { + attributesForFaceting: [ + 'author', + 'filterOnly(isbn)', + 'searchable(edition)', + 'afterDistinct(category)', + 'afterDistinct(searchable(publisher))', + ], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ + attributesForFaceting: [ + 'author', + 'filterOnly(isbn)', + 'searchable(edition)', + 'afterDistinct(category)', + 'afterDistinct(searchable(publisher))', + ], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('unretrievable_attributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { unretrievableAttributes: ['total_number_of_sales'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributeForDistinct: 'company', distinct: true }); + expect(req.data).toEqual({ unretrievableAttributes: ['total_number_of_sales'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('distinct design', async () => { + test('set_retrievable_attributes', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'design', distinct: true }, + indexSettings: { attributesToRetrieve: ['author', 'title', 'content'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributeForDistinct: 'design', distinct: true }); + expect(req.data).toEqual({ attributesToRetrieve: ['author', 'title', 'content'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('distinct true', async () => { + test('set_all_attributes_as_retrievable', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { distinct: true }, + indexSettings: { attributesToRetrieve: ['*'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ distinct: true }); + expect(req.data).toEqual({ attributesToRetrieve: ['*'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('distinct section', async () => { + test('specify_attributes_not_to_retrieve', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { attributeForDistinct: 'section', distinct: true }, + indexSettings: { attributesToRetrieve: ['*', '-SKU', '-internal_desc'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributeForDistinct: 'section', distinct: true }); + expect(req.data).toEqual({ attributesToRetrieve: ['*', '-SKU', '-internal_desc'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting allergens', async () => { + test('neural_search', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['allergens'] }, + indexName: 'theIndexName', + indexSettings: { mode: 'neuralSearch' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['allergens'] }); + expect(req.data).toEqual({ mode: 'neuralSearch' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting categoryPageId', async () => { + test('keyword_search', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['searchable(categoryPageId)'] }, + indexName: 'theIndexName', + indexSettings: { mode: 'keywordSearch' }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['searchable(categoryPageId)'] }); + expect(req.data).toEqual({ mode: 'keywordSearch' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('unretrievableAttributes', async () => { + test('set_default_ranking', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { unretrievableAttributes: ['visible_by'] }, + indexName: 'theIndexName', + indexSettings: { ranking: ['typo', 'geo', 'words', 'filters', 'attribute', 'proximity', 'exact', 'custom'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ unretrievableAttributes: ['visible_by'] }); + expect(req.data).toEqual({ + ranking: ['typo', 'geo', 'words', 'filters', 'attribute', 'proximity', 'exact', 'custom'], + }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting user restricted data', async () => { + test('set_ranking_by_attribute_asc', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['filterOnly(visible_by)'] }, + indexName: 'theIndexName', + indexSettings: { + ranking: ['asc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['filterOnly(visible_by)'] }); + expect(req.data).toEqual({ + ranking: ['asc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting optional filters', async () => { + test('set_ranking_by_attribute_desc', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }, + indexName: 'theIndexName', + indexSettings: { + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['can_deliver_quickly', 'restaurant'] }); + expect(req.data).toEqual({ + ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], + }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting redirect index', async () => { + test('restrict_searchable_attributes', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['query_terms'] }, + indexName: 'theIndexName', + indexSettings: { customRanking: ['desc(popularity)', 'asc(price)'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['query_terms'] }); + expect(req.data).toEqual({ customRanking: ['desc(popularity)', 'asc(price)'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting multiple consequences', async () => { + test('set_default_relevancy', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['director'] }, + indexName: 'theIndexName', + indexSettings: { relevancyStrictness: 90 }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['director'] }); + expect(req.data).toEqual({ relevancyStrictness: 90 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting in-depth optional filters', async () => { + test('set_replicas', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['filterOnly(brand)'] }, + indexName: 'theIndexName', + indexSettings: { replicas: ['name_of_replica_index1', 'name_of_replica_index2'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['filterOnly(brand)'] }); + expect(req.data).toEqual({ replicas: ['name_of_replica_index1', 'name_of_replica_index2'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('mode neuralSearch', async () => { + test('set_default_max_values_per_facet', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { mode: 'neuralSearch' }, + indexSettings: { maxValuesPerFacet: 100 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ mode: 'neuralSearch' }); + expect(req.data).toEqual({ maxValuesPerFacet: 100 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('mode keywordSearch', async () => { + test('set_default_sort_facet_values_by', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { mode: 'keywordSearch' }, + indexSettings: { sortFacetValuesBy: 'alpha' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ mode: 'keywordSearch' }); + expect(req.data).toEqual({ sortFacetValuesBy: 'alpha' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributes same priority', async () => { + test('set_attributes_to_snippet', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['title,comments', 'ingredients'] }, + indexSettings: { attributesToSnippet: ['content:80', 'description'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['title,comments', 'ingredients'] }); + expect(req.data).toEqual({ attributesToSnippet: ['content:80', 'description'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributes higher priority', async () => { + test('set_all_attributes_to_snippet', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['title', 'ingredients'] }, + indexSettings: { attributesToSnippet: ['*:80'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['title', 'ingredients'] }); + expect(req.data).toEqual({ attributesToSnippet: ['*:80'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking retweets', async () => { + test('set_default_highlight_pre_tag', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(retweets)', 'desc(likes)'] }, + indexSettings: { highlightPreTag: '' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(retweets)', 'desc(likes)'] }); + expect(req.data).toEqual({ highlightPreTag: '' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking boosted', async () => { + test('set_default_highlight_post_tag', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(boosted)'] }, + indexSettings: { highlightPostTag: '' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(boosted)'] }); + expect(req.data).toEqual({ highlightPostTag: '' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking pageviews', async () => { + test('set_default_snippet_ellipsis_text', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(pageviews)', 'desc(comments)'] }, + indexSettings: { snippetEllipsisText: '…' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(pageviews)', 'desc(comments)'] }); + expect(req.data).toEqual({ snippetEllipsisText: '…' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking applying search parameters for a specific query', async () => { + test('enable_restrict_highlight_and_snippet_arrays_by_default', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(nb_airline_liaisons)'], attributesForFaceting: ['city, country'] }, + indexSettings: { restrictHighlightAndSnippetArrays: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - customRanking: ['desc(nb_airline_liaisons)'], - attributesForFaceting: ['city, country'], - }); + expect(req.data).toEqual({ restrictHighlightAndSnippetArrays: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking rounded pageviews', async () => { + test('set_default_hits_per_page', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }, + indexSettings: { hitsPerPage: 20 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(rounded_pageviews)', 'desc(comments)'] }); + expect(req.data).toEqual({ hitsPerPage: 20 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking price', async () => { + test('set_pagination_limit', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(price)'] }, + indexSettings: { paginationLimitedTo: 1000 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(price)'] }); + expect(req.data).toEqual({ paginationLimitedTo: 1000 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('ranking exhaustive', async () => { + test('set_default_min_word_size_for_one_typo', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], - }, + indexSettings: { minWordSizefor1Typo: 4 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - ranking: ['desc(price)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], - }); + expect(req.data).toEqual({ minWordSizefor1Typo: 4 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('ranking standard replica', async () => { + test('set_default_min_word_size_for_two_typos', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { ranking: ['desc(post_date_timestamp)'] }, + indexSettings: { minWordSizefor2Typos: 4 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ ranking: ['desc(post_date_timestamp)'] }); + expect(req.data).toEqual({ minWordSizefor2Typos: 4 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('ranking virtual replica', async () => { + test('set_default_typo_tolerance_mode', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['desc(post_date_timestamp)'] }, + indexSettings: { typoTolerance: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['desc(post_date_timestamp)'] }); + expect(req.data).toEqual({ typoTolerance: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('customRanking and ranking sort alphabetically', async () => { + test('disable_typos_on_numeric_tokens_by_default', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { allowTyposOnNumericTokens: false }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ allowTyposOnNumericTokens: false }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('disable_typo_tolerance_for_words', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { disableTypoToleranceOnWords: ['wheel', '1X2BCD'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ disableTypoToleranceOnWords: ['wheel', '1X2BCD'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_separators_to_index', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { separatorsToIndex: '+#' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ separatorsToIndex: '+#' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_languages_using_querylanguages', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { queryLanguages: ['es'], ignorePlurals: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ queryLanguages: ['es'], ignorePlurals: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_attributes_to_transliterate', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { indexLanguages: ['ja'], attributesToTransliterate: ['name', 'description'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ indexLanguages: ['ja'], attributesToTransliterate: ['name', 'description'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_languages_using_querylanguages', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { queryLanguages: ['es'], removeStopWords: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ queryLanguages: ['es'], removeStopWords: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_camel_case_attributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { camelCaseAttributes: ['description'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ camelCaseAttributes: ['description'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_decompounded_attributes', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { decompoundedAttributes: { de: ['name'] } }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ decompoundedAttributes: { de: ['name'] } }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_decompounded_multiple_attributes', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', indexSettings: { - customRanking: ['asc(textual_attribute)'], - ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], + decompoundedAttributes: { de: ['name_de', 'description_de'], fi: ['name_fi', 'description_fi'] }, }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); expect(req.data).toEqual({ - customRanking: ['asc(textual_attribute)'], - ranking: ['custom', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact'], + decompoundedAttributes: { de: ['name_de', 'description_de'], fi: ['name_fi', 'description_fi'] }, }); expect(req.searchParams).toStrictEqual(undefined); }); - test('relevancyStrictness', async () => { + test('set_keep_diacritics_on_characters', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { keepDiacriticsOnCharacters: 'øé' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ keepDiacriticsOnCharacters: 'øé' }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_custom_normalization', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { customNormalization: { default: { ä: 'ae' } } }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ customNormalization: { default: { ä: 'ae' } } }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_languages_using_querylanguages', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { queryLanguages: ['es'], removeStopWords: true, ignorePlurals: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ queryLanguages: ['es'], removeStopWords: true, ignorePlurals: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('set_indexlanguages', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { indexLanguages: ['ja'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ indexLanguages: ['ja'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_decompound_query_by_default', async () => { + const req = (await client.setSettings({ + indexName: 'theIndexName', + indexSettings: { decompoundQuery: true }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ decompoundQuery: true }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('enable_rules_syntax_by_default', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }, + indexSettings: { enableRules: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ customRanking: ['asc(textual_attribute)'], relevancyStrictness: 0 }); + expect(req.data).toEqual({ enableRules: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('create replica index', async () => { + test('enable_personalization_settings', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { replicas: ['products_price_desc'] }, + indexSettings: { enablePersonalization: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ replicas: ['products_price_desc'] }); + expect(req.data).toEqual({ enablePersonalization: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('create virtual replica index', async () => { + test('set_default_query_type', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { replicas: ['virtual(products_price_desc)'] }, + indexSettings: { queryType: 'prefixLast' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ replicas: ['virtual(products_price_desc)'] }); + expect(req.data).toEqual({ queryType: 'prefixLast' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('unlink replica index', async () => { + test('set_default_remove_words_if_no_result', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { replicas: [''] }, + indexSettings: { removeWordsIfNoResults: 'none' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ replicas: [''] }); + expect(req.data).toEqual({ removeWordsIfNoResults: 'none' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('forwardToReplicas', async () => { + test('enable_advanced_syntax_by_default', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['name', 'description'] }, - forwardToReplicas: true, + indexSettings: { advancedSyntax: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['name', 'description'] }); - expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + expect(req.data).toEqual({ advancedSyntax: true }); + expect(req.searchParams).toStrictEqual(undefined); }); - test('maxValuesPerFacet', async () => { + test('set_default_optional_words', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { maxValuesPerFacet: 1000 }, + indexSettings: { optionalWords: ['blue', 'iphone case'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ maxValuesPerFacet: 1000 }); + expect(req.data).toEqual({ optionalWords: ['blue', 'iphone case'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('maxFacetHits', async () => { + test('disabling_prefix_search_for_some_attributes_by_default', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { maxFacetHits: 1000 }, + indexSettings: { disablePrefixOnAttributes: ['sku'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ maxFacetHits: 1000 }); + expect(req.data).toEqual({ disablePrefixOnAttributes: ['sku'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('attributesForFaceting complex', async () => { + test('disabling_exact_for_some_attributes_by_default', async () => { const req = (await client.setSettings({ - indexName: '', - indexSettings: { attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }, + indexName: 'theIndexName', + indexSettings: { disableExactOnAttributes: ['description'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/%3CYOUR_INDEX_NAME%3E/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ attributesForFaceting: ['actor', 'filterOnly(category)', 'searchable(publisher)'] }); + expect(req.data).toEqual({ disableExactOnAttributes: ['description'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('ranking closest dates', async () => { + test('set_default_exact_single_word_query', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - ranking: [ - 'asc(date_timestamp)', - 'typo', - 'geo', - 'words', - 'filters', - 'proximity', - 'attribute', - 'exact', - 'custom', - ], - }, + indexSettings: { exactOnSingleWordQuery: 'attribute' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - ranking: ['asc(date_timestamp)', 'typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'], - }); + expect(req.data).toEqual({ exactOnSingleWordQuery: 'attribute' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributes item variation', async () => { + test('set_default_aternative_as_exact', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['design', 'type', 'color'] }, + indexSettings: { alternativesAsExact: ['ignorePlurals', 'singleWordSynonym'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['design', 'type', 'color'] }); + expect(req.data).toEqual({ alternativesAsExact: ['ignorePlurals', 'singleWordSynonym'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributes around location', async () => { + test('enable_advanced_syntax_by_default', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }, + indexSettings: { advancedSyntax: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }); + expect(req.data).toEqual({ advancedSyntax: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributes around location', async () => { + test('set_numeric_attributes_for_filtering', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }, + indexSettings: { numericAttributesForFiltering: ['quantity', 'popularity'] }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - searchableAttributes: ['name', 'country', 'code', 'iata_code'], - customRanking: ['desc(links_count)'], - }); + expect(req.data).toEqual({ numericAttributesForFiltering: ['quantity', 'popularity'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('disableTypoToleranceOnAttributes', async () => { + test('enable_compression_of_integer_array', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + indexSettings: { allowCompressionOfIntegerArray: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ disableTypoToleranceOnAttributes: ['serial_number'] }); + expect(req.data).toEqual({ allowCompressionOfIntegerArray: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('everything', async () => { + test('set_attributes_for_distinct', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - advancedSyntax: true, - advancedSyntaxFeatures: ['exactPhrase'], - allowCompressionOfIntegerArray: true, - allowTyposOnNumericTokens: true, - alternativesAsExact: ['singleWordSynonym'], - attributeCriteriaComputedByMinProximity: true, - attributeForDistinct: 'test', - attributesForFaceting: ['algolia'], - attributesToHighlight: ['algolia'], - attributesToRetrieve: ['algolia'], - attributesToSnippet: ['algolia'], - attributesToTransliterate: ['algolia'], - camelCaseAttributes: ['algolia'], - customNormalization: { algolia: { aloglia: 'aglolia' } }, - customRanking: ['algolia'], - decompoundQuery: false, - decompoundedAttributes: { algolia: 'aloglia' }, - disableExactOnAttributes: ['algolia'], - disablePrefixOnAttributes: ['algolia'], - disableTypoToleranceOnAttributes: ['algolia'], - disableTypoToleranceOnWords: ['algolia'], - distinct: 3, - enablePersonalization: true, - enableReRanking: false, - enableRules: true, - exactOnSingleWordQuery: 'attribute', - highlightPreTag: '', - highlightPostTag: '', - hitsPerPage: 10, - ignorePlurals: false, - indexLanguages: ['fr'], - keepDiacriticsOnCharacters: 'abc', - maxFacetHits: 20, - maxValuesPerFacet: 30, - minProximity: 6, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - mode: 'neuralSearch', - numericAttributesForFiltering: ['algolia'], - optionalWords: ['myspace'], - paginationLimitedTo: 0, - queryLanguages: ['fr'], - queryType: 'prefixLast', - ranking: ['geo'], - reRankingApplyFilter: 'mySearch:filters', - relevancyStrictness: 10, - removeStopWords: false, - removeWordsIfNoResults: 'lastWords', - renderingContent: { - facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, - }, - replaceSynonymsInHighlight: true, - replicas: [''], - responseFields: ['algolia'], - restrictHighlightAndSnippetArrays: true, - searchableAttributes: ['foo'], - semanticSearch: { eventSources: ['foo'] }, - separatorsToIndex: 'bar', - snippetEllipsisText: '---', - sortFacetValuesBy: 'date', - typoTolerance: false, - unretrievableAttributes: ['foo'], - userData: { user: 'data' }, - }, + indexSettings: { attributeForDistinct: 'url' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - advancedSyntax: true, - advancedSyntaxFeatures: ['exactPhrase'], - allowCompressionOfIntegerArray: true, - allowTyposOnNumericTokens: true, - alternativesAsExact: ['singleWordSynonym'], - attributeCriteriaComputedByMinProximity: true, - attributeForDistinct: 'test', - attributesForFaceting: ['algolia'], - attributesToHighlight: ['algolia'], - attributesToRetrieve: ['algolia'], - attributesToSnippet: ['algolia'], - attributesToTransliterate: ['algolia'], - camelCaseAttributes: ['algolia'], - customNormalization: { algolia: { aloglia: 'aglolia' } }, - customRanking: ['algolia'], - decompoundQuery: false, - decompoundedAttributes: { algolia: 'aloglia' }, - disableExactOnAttributes: ['algolia'], - disablePrefixOnAttributes: ['algolia'], - disableTypoToleranceOnAttributes: ['algolia'], - disableTypoToleranceOnWords: ['algolia'], - distinct: 3, - enablePersonalization: true, - enableReRanking: false, - enableRules: true, - exactOnSingleWordQuery: 'attribute', - highlightPreTag: '', - highlightPostTag: '', - hitsPerPage: 10, - ignorePlurals: false, - indexLanguages: ['fr'], - keepDiacriticsOnCharacters: 'abc', - maxFacetHits: 20, - maxValuesPerFacet: 30, - minProximity: 6, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - mode: 'neuralSearch', - numericAttributesForFiltering: ['algolia'], - optionalWords: ['myspace'], - paginationLimitedTo: 0, - queryLanguages: ['fr'], - queryType: 'prefixLast', - ranking: ['geo'], - reRankingApplyFilter: 'mySearch:filters', - relevancyStrictness: 10, - removeStopWords: false, - removeWordsIfNoResults: 'lastWords', - renderingContent: { - facetOrdering: { facets: { order: ['a', 'b'] }, values: { a: { order: ['b'], sortRemainingBy: 'count' } } }, - }, - replaceSynonymsInHighlight: true, - replicas: [''], - responseFields: ['algolia'], - restrictHighlightAndSnippetArrays: true, - searchableAttributes: ['foo'], - semanticSearch: { eventSources: ['foo'] }, - separatorsToIndex: 'bar', - snippetEllipsisText: '---', - sortFacetValuesBy: 'date', - typoTolerance: false, - unretrievableAttributes: ['foo'], - userData: { user: 'data' }, - }); + expect(req.data).toEqual({ attributeForDistinct: 'url' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributesWithCustomRankingsAndAttributesForFaceting', async () => { + test('set_distinct', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { - searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], - customRanking: ['desc(popularity)'], - attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], - }, + indexSettings: { distinct: 1, attributeForDistinct: 'url' }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ - searchableAttributes: ['brand', 'name', 'categories', 'unordered(description)'], - customRanking: ['desc(popularity)'], - attributesForFaceting: ['searchable(brand)', 'type', 'categories', 'price'], - }); + expect(req.data).toEqual({ distinct: 1, attributeForDistinct: 'url' }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributesProductReferenceSuffixes', async () => { + test('set_replace_synonyms_in_highlights', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }, + indexSettings: { replaceSynonymsInHighlight: false }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['name', 'product_reference', 'product_reference_suffixes'] }); + expect(req.data).toEqual({ replaceSynonymsInHighlight: false }); expect(req.searchParams).toStrictEqual(undefined); }); - test('queryLanguageAndIgnorePlurals', async () => { + test('set_min_proximity', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { queryLanguages: ['en'], ignorePlurals: true }, + indexSettings: { minProximity: 1 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ queryLanguages: ['en'], ignorePlurals: true }); + expect(req.data).toEqual({ minProximity: 1 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributesInMovies', async () => { + test('set_default_field', async () => { const req = (await client.setSettings({ - indexName: 'movies', - indexSettings: { searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }, + indexName: 'theIndexName', + indexSettings: { responseFields: ['hits', 'hitsPerPage', 'nbPages', 'page'] }, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/movies/settings'); + expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['title_eng', 'title_fr', 'title_es'] }); + expect(req.data).toEqual({ responseFields: ['hits', 'hitsPerPage', 'nbPages', 'page'] }); expect(req.searchParams).toStrictEqual(undefined); }); - test('disablePrefixOnAttributes', async () => { + test('set_max_facet_hits', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disablePrefixOnAttributes: ['serial_number'] }, + indexSettings: { maxFacetHits: 10 }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ disablePrefixOnAttributes: ['serial_number'] }); + expect(req.data).toEqual({ maxFacetHits: 10 }); expect(req.searchParams).toStrictEqual(undefined); }); - test('disableTypoToleranceOnAttributes', async () => { + test('set_attribute_criteria_computed_by_min_proximity', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { disableTypoToleranceOnAttributes: ['serial_number'] }, + indexSettings: { attributeCriteriaComputedByMinProximity: true }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ disableTypoToleranceOnAttributes: ['serial_number'] }); + expect(req.data).toEqual({ attributeCriteriaComputedByMinProximity: true }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributesSimpleExample', async () => { + test('set_user_data', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['serial_number'] }, + indexSettings: { userData: { extraData: 'This is the custom data that you want to store in your index' } }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['serial_number'] }); + expect(req.data).toEqual({ + userData: { extraData: 'This is the custom data that you want to store in your index' }, + }); expect(req.searchParams).toStrictEqual(undefined); }); - test('searchableAttributesSimpleExampleAlt', async () => { + test('set_rendering_content', async () => { const req = (await client.setSettings({ indexName: 'theIndexName', - indexSettings: { searchableAttributes: ['serial_number', 'serial_number_suffixes'] }, + indexSettings: { + renderingContent: { + facetOrdering: { + facets: { order: ['size', 'brand'] }, + values: { + brand: { order: ['uniqlo'], hide: ['muji'], sortRemainingBy: 'count' }, + size: { order: ['S', 'M', 'L'], sortRemainingBy: 'hidden' }, + }, + }, + }, + }, })) as unknown as EchoResponse; expect(req.path).toEqual('/1/indexes/theIndexName/settings'); expect(req.method).toEqual('PUT'); - expect(req.data).toEqual({ searchableAttributes: ['serial_number', 'serial_number_suffixes'] }); + expect(req.data).toEqual({ + renderingContent: { + facetOrdering: { + facets: { order: ['size', 'brand'] }, + values: { + brand: { order: ['uniqlo'], hide: ['muji'], sortRemainingBy: 'count' }, + size: { order: ['S', 'M', 'L'], sortRemainingBy: 'hidden' }, + }, + }, + }, + }); expect(req.searchParams).toStrictEqual(undefined); }); }); diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt index 56e7a75a6b..86ec84a44d 100644 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt +++ b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt @@ -3895,7 +3895,87 @@ class SearchTest { } @Test - fun `facetFiltersNeg14`() = runTest { + fun `facetFiltersBook14`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("category:Book"))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facetFilters":["category:Book"]}""", it.body) + }, + ) + } + + @Test + fun `facetFiltersAND15`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe"))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facetFilters":["category:Book","author:John Doe"]}""", it.body) + }, + ) + } + + @Test + fun `facetFiltersOR16`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("author:John Doe"))))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}""", it.body) + }, + ) + } + + @Test + fun `facetFiltersCombined17`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facetFilters = FacetFilters.of(listOf(FacetFilters.of("author:John Doe"), FacetFilters.of(listOf(FacetFilters.of("category:Book"), FacetFilters.of("category:Movie"))))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}""", it.body) + }, + ) + } + + @Test + fun `facetFiltersNeg18`() = runTest { client.runTest( call = { searchSingleIndex( @@ -3914,7 +3994,7 @@ class SearchTest { } @Test - fun `filtersAndFacetFilters15`() = runTest { + fun `filtersAndFacetFilters19`() = runTest { client.runTest( call = { searchSingleIndex( @@ -3934,7 +4014,7 @@ class SearchTest { } @Test - fun `facet author genre16`() = runTest { + fun `facet author genre20`() = runTest { client.runTest( call = { searchSingleIndex( @@ -3953,7 +4033,7 @@ class SearchTest { } @Test - fun `facet wildcard17`() = runTest { + fun `facet wildcard21`() = runTest { client.runTest( call = { searchSingleIndex( @@ -3972,7 +4052,7 @@ class SearchTest { } @Test - fun `maxValuesPerFacet18`() = runTest { + fun `maxValuesPerFacet22`() = runTest { client.runTest( call = { searchSingleIndex( @@ -3991,7 +4071,7 @@ class SearchTest { } @Test - fun `aroundLatLng19`() = runTest { + fun `aroundLatLng23`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4010,7 +4090,7 @@ class SearchTest { } @Test - fun `aroundLatLngViaIP20`() = runTest { + fun `aroundLatLngViaIP24`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4029,7 +4109,7 @@ class SearchTest { } @Test - fun `aroundRadius21`() = runTest { + fun `aroundRadius25`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4049,7 +4129,7 @@ class SearchTest { } @Test - fun `insideBoundingBox22`() = runTest { + fun `insideBoundingBox26`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4068,7 +4148,7 @@ class SearchTest { } @Test - fun `insidePolygon23`() = runTest { + fun `insidePolygon27`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4087,7 +4167,7 @@ class SearchTest { } @Test - fun `insidePolygon24`() = runTest { + fun `insidePolygon28`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4106,7 +4186,7 @@ class SearchTest { } @Test - fun `optionalFilters25`() = runTest { + fun `optionalFilters29`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4125,7 +4205,7 @@ class SearchTest { } @Test - fun `optionalFiltersMany26`() = runTest { + fun `optionalFiltersMany30`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4144,7 +4224,7 @@ class SearchTest { } @Test - fun `optionalFiltersSimple27`() = runTest { + fun `optionalFiltersSimple31`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4163,7 +4243,7 @@ class SearchTest { } @Test - fun `restrictSearchableAttributes28`() = runTest { + fun `restrictSearchableAttributes32`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4182,7 +4262,7 @@ class SearchTest { } @Test - fun `getRankingInfo29`() = runTest { + fun `getRankingInfo33`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4201,7 +4281,7 @@ class SearchTest { } @Test - fun `clickAnalytics30`() = runTest { + fun `clickAnalytics34`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4220,7 +4300,7 @@ class SearchTest { } @Test - fun `clickAnalyticsUserToken31`() = runTest { + fun `clickAnalyticsUserToken35`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4240,7 +4320,7 @@ class SearchTest { } @Test - fun `enablePersonalization32`() = runTest { + fun `enablePersonalization36`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4260,7 +4340,7 @@ class SearchTest { } @Test - fun `userToken33`() = runTest { + fun `userToken37`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4279,7 +4359,27 @@ class SearchTest { } @Test - fun `analyticsTag34`() = runTest { + fun `userToken123438`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + userToken = "user-1234", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","userToken":"user-1234"}""", it.body) + }, + ) + } + + @Test + fun `analyticsTag39`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4298,7 +4398,7 @@ class SearchTest { } @Test - fun `facetFiltersUsers35`() = runTest { + fun `facetFiltersUsers40`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4317,7 +4417,7 @@ class SearchTest { } @Test - fun `buildTheQuery36`() = runTest { + fun `buildTheQuery41`() = runTest { client.runTest( call = { searchSingleIndex( @@ -4337,1309 +4437,4377 @@ class SearchTest { ) } - // searchSynonyms - @Test - fun `searchSynonyms with minimal parameters`() = runTest { + fun `attributesToHighlightOverride42`() = runTest { client.runTest( call = { - searchSynonyms( + searchSingleIndex( indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + attributesToHighlight = listOf("title", "content"), + ), ) }, intercept = { - assertEquals("/1/indexes/indexName/synonyms/search".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{}""", it.body) + assertJsonBody("""{"query":"query","attributesToHighlight":["title","content"]}""", it.body) }, ) } @Test - fun `searchSynonyms with all parameters1`() = runTest { + fun `disableTypoToleranceOnAttributes43`() = runTest { client.runTest( call = { - searchSynonyms( + searchSingleIndex( indexName = "indexName", - searchSynonymsParams = SearchSynonymsParams( - query = "myQuery", - type = SynonymType.entries.first { it.value == "altcorrection1" }, - page = 10, - hitsPerPage = 10, + searchParams = SearchParamsObject( + query = "query", + disableTypoToleranceOnAttributes = listOf("serial_number"), ), ) }, intercept = { - assertEquals("/1/indexes/indexName/synonyms/search".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""", it.body) + assertJsonBody("""{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}""", it.body) }, ) } - // searchUserIds - @Test - fun `searchUserIds`() = runTest { + fun `search_a_query44`() = runTest { client.runTest( call = { - searchUserIds( - searchUserIdsParams = SearchUserIdsParams( - query = "test", - clusterName = "theClusterName", - page = 5, - hitsPerPage = 10, + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "shirt", ), ) }, intercept = { - assertEquals("/1/clusters/mapping/search".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""", it.body) + assertJsonBody("""{"query":"shirt"}""", it.body) }, ) } - // setDictionarySettings - @Test - fun `get setDictionarySettings results with minimal parameters`() = runTest { + fun `search_everything45`() = runTest { client.runTest( call = { - setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = mapOf("fr" to false, "en" to false, "ru" to true), - ), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "", ), ) }, intercept = { - assertEquals("/1/dictionaries/*/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":""}""", it.body) }, ) } @Test - fun `get setDictionarySettings results with all parameters1`() = runTest { + fun `api_filtering_range_example46`() = runTest { client.runTest( call = { - setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = mapOf("fr" to false, "en" to false, "ru" to true), - stopwords = mapOf("fr" to false), - compounds = mapOf("ru" to true), - ), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "books", + filters = "price:10 TO 20", ), ) }, intercept = { - assertEquals("/1/dictionaries/*/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"books","filters":"price:10 TO 20"}""", it.body) }, ) } - // setSettings - @Test - fun `minimal parameters`() = runTest { + fun `search_a_query47`() = runTest { client.runTest( call = { - setSettings( - indexName = "cts_e2e_settings", - indexSettings = IndexSettings( - paginationLimitedTo = 10, + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "", + similarQuery = "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters = "year:1991 TO 2001", ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"paginationLimitedTo":10}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}""", it.body) }, ) } @Test - fun `boolean typoTolerance1`() = runTest { + fun `override_retrievable_attributes48`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - typoTolerance = TypoTolerance.of(true), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + attributesToRetrieve = listOf("title", "content"), ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"typoTolerance":true}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","attributesToRetrieve":["title","content"]}""", it.body) }, ) } @Test - fun `enum typoTolerance2`() = runTest { + fun `restrict_searchable_attributes49`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - typoTolerance = TypoToleranceEnum.entries.first { it.value == "min" }, + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + restrictSearchableAttributes = listOf("title", "author"), ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"typoTolerance":"min"}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","restrictSearchableAttributes":["title","author"]}""", it.body) }, ) } @Test - fun `ignorePlurals3`() = runTest { + fun `override_default_relevancy50`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - ignorePlurals = IgnorePlurals.of(true), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + relevancyStrictness = 70, ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"ignorePlurals":true}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","relevancyStrictness":70}""", it.body) }, ) } @Test - fun `list of string ignorePlurals4`() = runTest { + fun `apply_filters51`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + filters = "(category:Book OR category:Ebook) AND _tags:published", ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"ignorePlurals":["fr"]}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}""", it.body) }, ) } @Test - fun `removeStopWords boolean5`() = runTest { + fun `apply_all_filters52`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - removeStopWords = RemoveStopWords.of(true), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + 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\"", ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"removeStopWords":true}""", it.body) + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"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\""}""", it.body) }, ) } @Test - fun `removeStopWords list of string6`() = runTest { + fun `escape_spaces53`() = runTest { client.runTest( call = { - setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + filters = "category:\"Books and Comics\"", ), - forwardToReplicas = true, ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"removeStopWords":["fr"]}""", it.body) - }, + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","filters":"category:\"Books and Comics\""}""", it.body) + }, + ) + } + + @Test + fun `escape_keywords54`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + filters = "keyword:\"OR\"", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","filters":"keyword:\"OR\""}""", it.body) + }, + ) + } + + @Test + fun `escape_single_quotes55`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + filters = "content:\"It's a wonderful day\"", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","filters":"content:\"It's a wonderful day\""}""", it.body) + }, + ) + } + + @Test + fun `escape_double_quotes56`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + filters = "content:\"She said \"Hello World\"", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","filters":"content:\"She said \"Hello World\""}""", it.body) + }, + ) + } + + @Test + fun `apply_filters57`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("category:Book"), OptionalFilters.of("author:John Doe"))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","optionalFilters":["category:Book","author:John Doe"]}""", it.body) + }, + ) + } + + @Test + fun `apply_negative_filters58`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + optionalFilters = OptionalFilters.of(listOf(OptionalFilters.of("category:Book"), OptionalFilters.of("author:-John Doe"))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}""", it.body) + }, + ) + } + + @Test + fun `apply_numeric_filters59`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + numericFilters = NumericFilters.of(listOf(NumericFilters.of("price < 1000"), NumericFilters.of(listOf(NumericFilters.of("inStock = 1"), NumericFilters.of("deliveryDate < 1441755506"))))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}""", it.body) + }, + ) + } + + @Test + fun `apply_tag_filters60`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + tagFilters = TagFilters.of(listOf(TagFilters.of("SciFi"), TagFilters.of(listOf(TagFilters.of("Book"), TagFilters.of("Movie"))))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}""", it.body) + }, + ) + } + + @Test + fun `apply_filters61`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + sumOrFiltersScores = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","sumOrFiltersScores":true}""", it.body) + }, + ) + } + + @Test + fun `facets_all62`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facets = listOf("*"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facets":["*"]}""", it.body) + }, + ) + } + + @Test + fun `retrieve_only_some_facets63`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facets = listOf("category", "author"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facets":["category","author"]}""", it.body) + }, + ) + } + + @Test + fun `override_default_max_values_per_facet64`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + maxValuesPerFacet = 20, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","maxValuesPerFacet":20}""", it.body) + }, + ) + } + + @Test + fun `enable_faceting_after_distinct65`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + facetingAfterDistinct = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","facetingAfterDistinct":true}""", it.body) + }, + ) + } + + @Test + fun `sort_facet_values_alphabetically66`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + sortFacetValuesBy = "count", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","sortFacetValuesBy":"count"}""", it.body) + }, + ) + } + + @Test + fun `override_attributes_to_snippet67`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + attributesToSnippet = listOf("title", "content:80"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","attributesToSnippet":["title","content:80"]}""", it.body) + }, + ) + } + + @Test + fun `override_default_highlight_pre_tag68`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + highlightPreTag = "", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","highlightPreTag":""}""", it.body) + }, + ) + } + + @Test + fun `override_default_highlight_post_tag69`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + highlightPostTag = "", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","highlightPostTag":""}""", it.body) + }, + ) + } + + @Test + fun `override_default_snippet_ellipsis_text70`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + snippetEllipsisText = "", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","snippetEllipsisText":""}""", it.body) + }, + ) + } + + @Test + fun `enable_restrict_highlight_and_snippet_arrays71`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + restrictHighlightAndSnippetArrays = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","restrictHighlightAndSnippetArrays":false}""", it.body) + }, + ) + } + + @Test + fun `access_page72`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + page = 0, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","page":0}""", it.body) + }, + ) + } + + @Test + fun `override_default_hits_per_page73`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + hitsPerPage = 10, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","hitsPerPage":10}""", it.body) + }, + ) + } + + @Test + fun `get_nth_hit74`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + offset = 4, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","offset":4}""", it.body) + }, + ) + } + + @Test + fun `get_n_results75`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + length = 4, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","length":4}""", it.body) + }, + ) + } + + @Test + fun `override_default_min_word_size_for_one_typo76`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + minWordSizefor1Typo = 2, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","minWordSizefor1Typo":2}""", it.body) + }, + ) + } + + @Test + fun `override_default_min_word_size_for_two_typos77`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + minWordSizefor2Typos = 2, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","minWordSizefor2Typos":2}""", it.body) + }, + ) + } + + @Test + fun `override_default_typo_tolerance_mode78`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + typoTolerance = TypoTolerance.of(false), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","typoTolerance":false}""", it.body) + }, + ) + } + + @Test + fun `disable_typos_on_numeric_tokens_at_search_time79`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + allowTyposOnNumericTokens = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","allowTyposOnNumericTokens":false}""", it.body) + }, + ) + } + + @Test + fun `search_around_a_position80`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundLatLng = "40.71, -74.01", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","aroundLatLng":"40.71, -74.01"}""", it.body) + }, + ) + } + + @Test + fun `search_around_server_ip81`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundLatLngViaIP = true, + ), + requestOptions = RequestOptions( + headers = buildMap { + put("x-forwarded-for", "94.228.178.246 // should be replaced with the actual IP you would like to search around") + }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertContainsAll("""{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}""", it.headers) + assertJsonBody("""{"query":"query","aroundLatLngViaIP":true}""", it.body) + }, + ) + } + + @Test + fun `set_around_radius82`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundRadius = AroundRadius.of(1000), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","aroundRadius":1000}""", it.body) + }, + ) + } + + @Test + fun `disable_automatic_radius83`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundRadius = AroundRadiusAll.entries.first { it.value == "all" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","aroundRadius":"all"}""", it.body) + }, + ) + } + + @Test + fun `set_geo_search_precision84`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundPrecision = AroundPrecision.of(100), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","aroundPrecision":100}""", it.body) + }, + ) + } + + @Test + fun `set_geo_search_precision_non_linear85`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + aroundPrecision = AroundPrecision.of( + listOf( + Range( + from = 0, + value = 25, + ), + Range( + from = 2000, + value = 1000, + ), + ), + ), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}""", it.body) + }, + ) + } + + @Test + fun `set_minimum_geo_search_radius86`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + minimumAroundRadius = 1000, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","minimumAroundRadius":1000}""", it.body) + }, + ) + } + + @Test + fun `search_inside_rectangular_area87`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}""", it.body) + }, + ) + } + + @Test + fun `search_inside_multiple_rectangular_areas88`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + insideBoundingBox = InsideBoundingBox.of(listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875))), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}""", it.body) + }, + ) + } + + @Test + fun `search_inside_polygon_area89`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}""", it.body) + }, + ) + } + + @Test + fun `search_inside_multiple_polygon_areas90`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + insidePolygon = listOf(listOf(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), listOf(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, 50.62626704081, 4.6181640625)), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"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]]}""", it.body) + }, + ) + } + + @Test + fun `set_querylanguages_override91`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","ignorePlurals":["ca","es"]}""", it.body) + }, + ) + } + + @Test + fun `set_querylanguages_override92`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","removeStopWords":["ca","es"]}""", it.body) + }, + ) + } + + @Test + fun `set_querylanguages_override93`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "ca" }, SupportedLanguage.entries.first { it.value == "es" })), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","removeStopWords":["ca","es"]}""", it.body) + }, + ) + } + + @Test + fun `set_querylanguages_with_japanese_query94`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }, SupportedLanguage.entries.first { it.value == "en" }), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","queryLanguages":["ja","en"]}""", it.body) + }, + ) + } + + @Test + fun `set_natural_languages95`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "", + naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"","naturalLanguages":["fr"]}""", it.body) + }, + ) + } + + @Test + fun `override_natural_languages_with_query96`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "", + naturalLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "firstWords" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}""", it.body) + }, + ) + } + + @Test + fun `enable_decompound_query_search_time97`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + decompoundQuery = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","decompoundQuery":true}""", it.body) + }, + ) + } + + @Test + fun `enable_rules_search_time98`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enableRules = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enableRules":true}""", it.body) + }, + ) + } + + @Test + fun `set_rule_contexts99`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + ruleContexts = listOf("front_end", "website2"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","ruleContexts":["front_end","website2"]}""", it.body) + }, + ) + } + + @Test + fun `enable_personalization100`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enablePersonalization":true}""", it.body) + }, + ) + } + + @Test + fun `enable_personalization_with_user_token101`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + userToken = "123456", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enablePersonalization":true,"userToken":"123456"}""", it.body) + }, + ) + } + + @Test + fun `personalization_impact102`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + personalizationImpact = 20, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","personalizationImpact":20}""", it.body) + }, + ) + } + + @Test + fun `set_user_token103`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + userToken = "123456", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","userToken":"123456"}""", it.body) + }, + ) + } + + @Test + fun `set_user_token_with_personalization104`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enablePersonalization = true, + userToken = "123456", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enablePersonalization":true,"userToken":"123456"}""", it.body) + }, + ) + } + + @Test + fun `override_default_query_type105`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + queryType = QueryType.entries.first { it.value == "prefixAll" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","queryType":"prefixAll"}""", it.body) + }, + ) + } + + @Test + fun `override_default_remove_words_if_no_results106`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","removeWordsIfNoResults":"lastWords"}""", it.body) + }, + ) + } + + @Test + fun `enable_advanced_syntax_search_time107`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","advancedSyntax":true}""", it.body) + }, + ) + } + + @Test + fun `overide_default_optional_words108`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + optionalWords = OptionalWords.of(listOf("toyota", "2020 2021")), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","optionalWords":["toyota","2020 2021"]}""", it.body) + }, + ) + } + + @Test + fun `disabling_exact_for_some_attributes_search_time109`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + disableExactOnAttributes = listOf("description"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","disableExactOnAttributes":["description"]}""", it.body) + }, + ) + } + + @Test + fun `override_default_exact_single_word_query110`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "none" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","exactOnSingleWordQuery":"none"}""", it.body) + }, + ) + } + + @Test + fun `override_default_aternative_as_exact111`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "multiWordsSynonym" }), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","alternativesAsExact":["multiWordsSynonym"]}""", it.body) + }, + ) + } + + @Test + fun `enable_advanced_syntax_exact_phrase112`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}""", it.body) + }, + ) + } + + @Test + fun `enable_advanced_syntax_exclude_words113`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "excludeWords" }), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}""", it.body) + }, + ) + } + + @Test + fun `override_distinct114`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + distinct = Distinct.of(0), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","distinct":0}""", it.body) + }, + ) + } + + @Test + fun `get_ranking_info115`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + getRankingInfo = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","getRankingInfo":true}""", it.body) + }, + ) + } + + @Test + fun `disable_click_analytics116`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + clickAnalytics = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","clickAnalytics":false}""", it.body) + }, + ) + } + + @Test + fun `enable_click_analytics117`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + clickAnalytics = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","clickAnalytics":true}""", it.body) + }, + ) + } + + @Test + fun `disable_analytics118`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + analytics = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","analytics":false}""", it.body) + }, + ) + } + + @Test + fun `add_analytics_tags119`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + analyticsTags = listOf("front_end", "website2"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","analyticsTags":["front_end","website2"]}""", it.body) + }, + ) + } + + @Test + fun `disable_synonyms120`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + synonyms = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","synonyms":false}""", it.body) + }, + ) + } + + @Test + fun `override_replace_synonyms_in_highlights121`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + replaceSynonymsInHighlight = true, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","replaceSynonymsInHighlight":true}""", it.body) + }, + ) + } + + @Test + fun `override_min_proximity122`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + minProximity = 2, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","minProximity":2}""", it.body) + }, + ) + } + + @Test + fun `override_default_field123`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + responseFields = listOf("hits", "facets"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","responseFields":["hits","facets"]}""", it.body) + }, + ) + } + + @Test + fun `override_percentile_computation124`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + percentileComputation = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","percentileComputation":false}""", it.body) + }, + ) + } + + @Test + fun `set_ab_test125`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enableABTest = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enableABTest":false}""", it.body) + }, + ) + } + + @Test + fun `set_enable_re_ranking126`() = runTest { + client.runTest( + call = { + searchSingleIndex( + indexName = "indexName", + searchParams = SearchParamsObject( + query = "query", + enableReRanking = false, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/query".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"query","enableReRanking":false}""", it.body) + }, + ) + } + + // searchSynonyms + + @Test + fun `searchSynonyms with minimal parameters`() = runTest { + client.runTest( + call = { + searchSynonyms( + indexName = "indexName", + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/synonyms/search".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{}""", it.body) + }, + ) + } + + @Test + fun `searchSynonyms with all parameters1`() = runTest { + client.runTest( + call = { + searchSynonyms( + indexName = "indexName", + searchSynonymsParams = SearchSynonymsParams( + query = "myQuery", + type = SynonymType.entries.first { it.value == "altcorrection1" }, + page = 10, + hitsPerPage = 10, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/indexName/synonyms/search".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""", it.body) + }, + ) + } + + // searchUserIds + + @Test + fun `searchUserIds`() = runTest { + client.runTest( + call = { + searchUserIds( + searchUserIdsParams = SearchUserIdsParams( + query = "test", + clusterName = "theClusterName", + page = 5, + hitsPerPage = 10, + ), + ) + }, + intercept = { + assertEquals("/1/clusters/mapping/search".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("POST"), it.method) + assertJsonBody("""{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""", it.body) + }, + ) + } + + // setDictionarySettings + + @Test + fun `get setDictionarySettings results with minimal parameters`() = runTest { + client.runTest( + call = { + setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = mapOf("fr" to false, "en" to false, "ru" to true), + ), + ), + ) + }, + intercept = { + assertEquals("/1/dictionaries/*/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""", it.body) + }, + ) + } + + @Test + fun `get setDictionarySettings results with all parameters1`() = runTest { + client.runTest( + call = { + setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = mapOf("fr" to false, "en" to false, "ru" to true), + stopwords = mapOf("fr" to false), + compounds = mapOf("ru" to true), + ), + ), + ) + }, + intercept = { + assertEquals("/1/dictionaries/*/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""", it.body) + }, + ) + } + + // setSettings + + @Test + fun `minimal parameters`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "cts_e2e_settings", + indexSettings = IndexSettings( + paginationLimitedTo = 10, + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"paginationLimitedTo":10}""", it.body) + }, + ) + } + + @Test + fun `boolean typoTolerance1`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + typoTolerance = TypoTolerance.of(true), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"typoTolerance":true}""", it.body) + }, + ) + } + + @Test + fun `enum typoTolerance2`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + typoTolerance = TypoToleranceEnum.entries.first { it.value == "min" }, + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"typoTolerance":"min"}""", it.body) + }, + ) + } + + @Test + fun `ignorePlurals3`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ignorePlurals = IgnorePlurals.of(true), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"ignorePlurals":true}""", it.body) + }, + ) + } + + @Test + fun `list of string ignorePlurals4`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ignorePlurals = IgnorePlurals.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"ignorePlurals":["fr"]}""", it.body) + }, + ) + } + + @Test + fun `removeStopWords boolean5`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + removeStopWords = RemoveStopWords.of(true), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"removeStopWords":true}""", it.body) + }, + ) + } + + @Test + fun `removeStopWords list of string6`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + removeStopWords = RemoveStopWords.of(listOf(SupportedLanguage.entries.first { it.value == "fr" })), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"removeStopWords":["fr"]}""", it.body) + }, + ) + } + + @Test + fun `boolean distinct7`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Distinct.of(true), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"distinct":true}""", it.body) + }, + ) + } + + @Test + fun `integer distinct8`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Distinct.of(1), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"distinct":1}""", it.body) + }, + ) + } + + @Test + fun `distinct company9`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = "company", + distinct = Distinct.of(true), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributeForDistinct":"company","distinct":true}""", it.body) + }, + ) + } + + @Test + fun `distinct design10`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = "design", + distinct = Distinct.of(true), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributeForDistinct":"design","distinct":true}""", it.body) + }, + ) + } + + @Test + fun `distinct true11`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Distinct.of(true), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"distinct":true}""", it.body) + }, + ) + } + + @Test + fun `distinct section12`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = "section", + distinct = Distinct.of(true), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributeForDistinct":"section","distinct":true}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting allergens13`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("allergens"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["allergens"]}""", it.body) + }, + ) + } + + @Test + fun `api_attributes_for_faceting14`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("genre", "author"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["genre","author"]}""", it.body) + }, + ) + } + + @Test + fun `api_attributes_for_faceting_searchable15`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("genre", "searchable(author)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["genre","searchable(author)"]}""", it.body) + }, + ) + } + + @Test + fun `api_attributes_for_filter_only16`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(genre)", "author"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["filterOnly(genre)","author"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting categoryPageId17`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("searchable(categoryPageId)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["searchable(categoryPageId)"]}""", it.body) + }, + ) + } + + @Test + fun `unretrievableAttributes18`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + unretrievableAttributes = listOf("visible_by"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"unretrievableAttributes":["visible_by"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting user restricted data19`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(visible_by)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["filterOnly(visible_by)"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting optional filters20`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("can_deliver_quickly", "restaurant"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting redirect index21`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("query_terms"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["query_terms"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting multiple consequences22`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("director"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["director"]}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting in-depth optional filters23`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("filterOnly(brand)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["filterOnly(brand)"]}""", it.body) + }, + ) + } + + @Test + fun `mode neuralSearch24`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + mode = Mode.entries.first { it.value == "neuralSearch" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"mode":"neuralSearch"}""", it.body) + }, + ) + } + + @Test + fun `mode keywordSearch25`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + mode = Mode.entries.first { it.value == "keywordSearch" }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"mode":"keywordSearch"}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributes same priority26`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("title,comments", "ingredients"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["title,comments","ingredients"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributes higher priority27`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("title", "ingredients"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["title","ingredients"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking retweets28`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(retweets)", "desc(likes)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(retweets)","desc(likes)"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking boosted29`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(boosted)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(boosted)"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking pageviews30`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(pageviews)", "desc(comments)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(pageviews)","desc(comments)"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking applying search parameters for a specific query31`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(nb_airline_liaisons)"), + attributesForFaceting = listOf("city, country"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking rounded pageviews32`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(rounded_pageviews)", "desc(comments)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking price33`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(price)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(price)"]}""", it.body) + }, + ) + } + + @Test + fun `ranking exhaustive34`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + }, + ) + } + + @Test + fun `ranking standard replica35`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = listOf("desc(post_date_timestamp)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"ranking":["desc(post_date_timestamp)"]}""", it.body) + }, + ) + } + + @Test + fun `ranking virtual replica36`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(post_date_timestamp)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(post_date_timestamp)"]}""", it.body) + }, + ) + } + + @Test + fun `customRanking and ranking sort alphabetically37`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("asc(textual_attribute)"), + ranking = listOf("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""", it.body) + }, + ) + } + + @Test + fun `relevancyStrictness38`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("asc(textual_attribute)"), + relevancyStrictness = 0, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""", it.body) + }, + ) + } + + @Test + fun `create replica index39`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = listOf("products_price_desc"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"replicas":["products_price_desc"]}""", it.body) + }, + ) + } + + @Test + fun `create replica index articles40`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = listOf("articles_date_desc"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"replicas":["articles_date_desc"]}""", it.body) + }, + ) + } + + @Test + fun `create virtual replica index41`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = listOf("virtual(products_price_desc)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"replicas":["virtual(products_price_desc)"]}""", it.body) + }, + ) + } + + @Test + fun `unlink replica index42`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = listOf(""), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"replicas":[""]}""", it.body) + }, + ) + } + + @Test + fun `forwardToReplicas43`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "description"), + ), + forwardToReplicas = true, + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) + assertJsonBody("""{"searchableAttributes":["name","description"]}""", it.body) + }, + ) + } + + @Test + fun `maxValuesPerFacet44`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + maxValuesPerFacet = 1000, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"maxValuesPerFacet":1000}""", it.body) + }, + ) + } + + @Test + fun `maxFacetHits45`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + maxFacetHits = 1000, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"maxFacetHits":1000}""", it.body) + }, + ) + } + + @Test + fun `attributesForFaceting complex46`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = listOf("actor", "filterOnly(category)", "searchable(publisher)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""", it.body) + }, + ) + } + + @Test + fun `ranking closest dates47`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = listOf("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributes item variation48`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("design", "type", "color"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["design","type","color"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributes around location49`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "country", "code", "iata_code"), + customRanking = listOf("desc(links_count)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""", it.body) + }, + ) + } + + @Test + fun `attributesToHighlight50`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToHighlight = listOf("author", "title", "content"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesToHighlight":["author","title","content"]}""", it.body) + }, + ) + } + + @Test + fun `attributesToHighlightStar51`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToHighlight = listOf("*"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesToHighlight":["*"]}""", it.body) + }, + ) + } + + @Test + fun `everything52`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + advancedSyntax = true, + advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), + allowCompressionOfIntegerArray = true, + allowTyposOnNumericTokens = true, + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), + attributeCriteriaComputedByMinProximity = true, + attributeForDistinct = "test", + attributesForFaceting = listOf("algolia"), + attributesToHighlight = listOf("algolia"), + attributesToRetrieve = listOf("algolia"), + attributesToSnippet = listOf("algolia"), + attributesToTransliterate = listOf("algolia"), + camelCaseAttributes = listOf("algolia"), + customNormalization = mapOf("algolia" to mapOf("aloglia" to "aglolia")), + customRanking = listOf("algolia"), + decompoundQuery = false, + decompoundedAttributes = buildJsonObject { + put( + "algolia", + JsonPrimitive("aloglia"), + ) + }, + disableExactOnAttributes = listOf("algolia"), + disablePrefixOnAttributes = listOf("algolia"), + disableTypoToleranceOnAttributes = listOf("algolia"), + disableTypoToleranceOnWords = listOf("algolia"), + distinct = Distinct.of(3), + enablePersonalization = true, + enableReRanking = false, + enableRules = true, + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, + highlightPreTag = "", + highlightPostTag = "", + hitsPerPage = 10, + ignorePlurals = IgnorePlurals.of(false), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + keepDiacriticsOnCharacters = "abc", + maxFacetHits = 20, + maxValuesPerFacet = 30, + minProximity = 6, + minWordSizefor1Typo = 5, + minWordSizefor2Typos = 11, + mode = Mode.entries.first { it.value == "neuralSearch" }, + numericAttributesForFiltering = listOf("algolia"), + optionalWords = OptionalWords.of(listOf("myspace")), + paginationLimitedTo = 0, + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), + queryType = QueryType.entries.first { it.value == "prefixLast" }, + ranking = listOf("geo"), + reRankingApplyFilter = ReRankingApplyFilter.of("mySearch:filters"), + relevancyStrictness = 10, + removeStopWords = RemoveStopWords.of(false), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, + renderingContent = RenderingContent( + facetOrdering = FacetOrdering( + facets = Facets( + order = listOf("a", "b"), + ), + values = mapOf( + "a" to Value( + order = listOf("b"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, + ), + ), + ), + ), + replaceSynonymsInHighlight = true, + replicas = listOf(""), + responseFields = listOf("algolia"), + restrictHighlightAndSnippetArrays = true, + searchableAttributes = listOf("foo"), + semanticSearch = SemanticSearch( + eventSources = listOf("foo"), + ), + separatorsToIndex = "bar", + snippetEllipsisText = "---", + sortFacetValuesBy = "date", + typoTolerance = TypoTolerance.of(false), + unretrievableAttributes = listOf("foo"), + userData = buildJsonObject { + put( + "user", + JsonPrimitive("data"), + ) + }, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesWithCustomRankingsAndAttributesForFaceting53`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("brand", "name", "categories", "unordered(description)"), + customRanking = listOf("desc(popularity)"), + attributesForFaceting = listOf("searchable(brand)", "type", "categories", "price"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesOrdering54`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("unordered(title)", "cast"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["unordered(title)","cast"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesProductReferenceSuffixes55`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("name", "product_reference", "product_reference_suffixes"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""", it.body) + }, + ) + } + + @Test + fun `queryLanguageAndIgnorePlurals56`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "en" }), + ignorePlurals = IgnorePlurals.of(true), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"queryLanguages":["en"],"ignorePlurals":true}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesInMovies57`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "movies", + indexSettings = IndexSettings( + searchableAttributes = listOf("title_eng", "title_fr", "title_es"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/movies/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["title_eng","title_fr","title_es"]}""", it.body) + }, + ) + } + + @Test + fun `disablePrefixOnAttributes58`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + disablePrefixOnAttributes = listOf("serial_number"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"disablePrefixOnAttributes":["serial_number"]}""", it.body) + }, + ) + } + + @Test + fun `disableTypoToleranceOnAttributes59`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + disableTypoToleranceOnAttributes = listOf("serial_number"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"disableTypoToleranceOnAttributes":["serial_number"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesSimpleExample60`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("serial_number"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["serial_number"]}""", it.body) + }, + ) + } + + @Test + fun `searchableAttributesSimpleExampleAlt61`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("serial_number", "serial_number_suffixes"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["serial_number","serial_number_suffixes"]}""", it.body) + }, + ) + } + + @Test + fun `set_searchable_attributes62`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = listOf("title,alternative_title", "author", "unordered(text)", "emails.personal"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}""", it.body) + }, ) } @Test - fun `boolean distinct7`() = runTest { + fun `set_searchable_attributes63`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Distinct.of(true), + attributesForFaceting = listOf("author", "filterOnly(isbn)", "searchable(edition)", "afterDistinct(category)", "afterDistinct(searchable(publisher))"), ), - forwardToReplicas = true, ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"distinct":true}""", it.body) + assertJsonBody("""{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}""", it.body) }, ) } @Test - fun `integer distinct8`() = runTest { + fun `unretrievable_attributes64`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Distinct.of(1), + unretrievableAttributes = listOf("total_number_of_sales"), ), - forwardToReplicas = true, ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"distinct":1}""", it.body) + assertJsonBody("""{"unretrievableAttributes":["total_number_of_sales"]}""", it.body) }, ) } @Test - fun `distinct company9`() = runTest { + fun `set_retrievable_attributes65`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = "company", - distinct = Distinct.of(true), + attributesToRetrieve = listOf("author", "title", "content"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributeForDistinct":"company","distinct":true}""", it.body) + assertJsonBody("""{"attributesToRetrieve":["author","title","content"]}""", it.body) }, ) } @Test - fun `distinct design10`() = runTest { + fun `set_all_attributes_as_retrievable66`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = "design", - distinct = Distinct.of(true), + attributesToRetrieve = listOf("*"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributeForDistinct":"design","distinct":true}""", it.body) + assertJsonBody("""{"attributesToRetrieve":["*"]}""", it.body) }, ) } @Test - fun `distinct true11`() = runTest { + fun `specify_attributes_not_to_retrieve67`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Distinct.of(true), + attributesToRetrieve = listOf("*", "-SKU", "-internal_desc"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"distinct":true}""", it.body) + assertJsonBody("""{"attributesToRetrieve":["*","-SKU","-internal_desc"]}""", it.body) }, ) } @Test - fun `distinct section12`() = runTest { + fun `neural_search68`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = "section", - distinct = Distinct.of(true), + mode = Mode.entries.first { it.value == "neuralSearch" }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributeForDistinct":"section","distinct":true}""", it.body) + assertJsonBody("""{"mode":"neuralSearch"}""", it.body) }, ) } @Test - fun `attributesForFaceting allergens13`() = runTest { + fun `keyword_search69`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("allergens"), + mode = Mode.entries.first { it.value == "keywordSearch" }, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["allergens"]}""", it.body) + assertJsonBody("""{"mode":"keywordSearch"}""", it.body) }, ) } @Test - fun `attributesForFaceting categoryPageId14`() = runTest { + fun `set_default_ranking70`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("searchable(categoryPageId)"), + ranking = listOf("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"), ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["searchable(categoryPageId)"]}""", it.body) + assertJsonBody("""{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}""", it.body) }, ) } @Test - fun `unretrievableAttributes15`() = runTest { + fun `set_ranking_by_attribute_asc71`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - unretrievableAttributes = listOf("visible_by"), + ranking = listOf("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + }, + ) + } + + @Test + fun `set_ranking_by_attribute_desc72`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + }, + ) + } + + @Test + fun `restrict_searchable_attributes73`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = listOf("desc(popularity)", "asc(price)"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"customRanking":["desc(popularity)","asc(price)"]}""", it.body) + }, + ) + } + + @Test + fun `set_default_relevancy74`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + relevancyStrictness = 90, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"relevancyStrictness":90}""", it.body) + }, + ) + } + + @Test + fun `set_replicas75`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = listOf("name_of_replica_index1", "name_of_replica_index2"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"replicas":["name_of_replica_index1","name_of_replica_index2"]}""", it.body) + }, + ) + } + + @Test + fun `set_default_max_values_per_facet76`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + maxValuesPerFacet = 100, + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"maxValuesPerFacet":100}""", it.body) + }, + ) + } + + @Test + fun `set_default_sort_facet_values_by77`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + sortFacetValuesBy = "alpha", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"sortFacetValuesBy":"alpha"}""", it.body) + }, + ) + } + + @Test + fun `set_attributes_to_snippet78`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToSnippet = listOf("content:80", "description"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesToSnippet":["content:80","description"]}""", it.body) + }, + ) + } + + @Test + fun `set_all_attributes_to_snippet79`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToSnippet = listOf("*:80"), + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"attributesToSnippet":["*:80"]}""", it.body) + }, + ) + } + + @Test + fun `set_default_highlight_pre_tag80`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + highlightPreTag = "", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"highlightPreTag":""}""", it.body) + }, + ) + } + + @Test + fun `set_default_highlight_post_tag81`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + highlightPostTag = "", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"highlightPostTag":""}""", it.body) + }, + ) + } + + @Test + fun `set_default_snippet_ellipsis_text82`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + snippetEllipsisText = "…", + ), + ) + }, + intercept = { + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals(HttpMethod.parse("PUT"), it.method) + assertJsonBody("""{"snippetEllipsisText":"…"}""", it.body) + }, + ) + } + + @Test + fun `enable_restrict_highlight_and_snippet_arrays_by_default83`() = runTest { + client.runTest( + call = { + setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + restrictHighlightAndSnippetArrays = true, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"unretrievableAttributes":["visible_by"]}""", it.body) + assertJsonBody("""{"restrictHighlightAndSnippetArrays":true}""", it.body) }, ) } @Test - fun `attributesForFaceting user restricted data16`() = runTest { + fun `set_default_hits_per_page84`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("filterOnly(visible_by)"), + hitsPerPage = 20, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["filterOnly(visible_by)"]}""", it.body) + assertJsonBody("""{"hitsPerPage":20}""", it.body) }, ) } @Test - fun `attributesForFaceting optional filters17`() = runTest { + fun `set_pagination_limit85`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("can_deliver_quickly", "restaurant"), + paginationLimitedTo = 1000, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""", it.body) + assertJsonBody("""{"paginationLimitedTo":1000}""", it.body) }, ) } @Test - fun `attributesForFaceting redirect index18`() = runTest { + fun `set_default_min_word_size_for_one_typo86`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("query_terms"), + minWordSizefor1Typo = 4, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["query_terms"]}""", it.body) + assertJsonBody("""{"minWordSizefor1Typo":4}""", it.body) }, ) } @Test - fun `attributesForFaceting multiple consequences19`() = runTest { + fun `set_default_min_word_size_for_two_typos87`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("director"), + minWordSizefor2Typos = 4, ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["director"]}""", it.body) + assertJsonBody("""{"minWordSizefor2Typos":4}""", it.body) }, ) } @Test - fun `attributesForFaceting in-depth optional filters20`() = runTest { + fun `set_default_typo_tolerance_mode88`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("filterOnly(brand)"), + typoTolerance = TypoTolerance.of(true), ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["filterOnly(brand)"]}""", it.body) + assertJsonBody("""{"typoTolerance":true}""", it.body) }, ) } @Test - fun `mode neuralSearch21`() = runTest { + fun `disable_typos_on_numeric_tokens_by_default89`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - mode = Mode.entries.first { it.value == "neuralSearch" }, + allowTyposOnNumericTokens = false, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"mode":"neuralSearch"}""", it.body) + assertJsonBody("""{"allowTyposOnNumericTokens":false}""", it.body) }, ) } @Test - fun `mode keywordSearch22`() = runTest { + fun `disable_typo_tolerance_for_words90`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - mode = Mode.entries.first { it.value == "keywordSearch" }, + disableTypoToleranceOnWords = listOf("wheel", "1X2BCD"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"mode":"keywordSearch"}""", it.body) + assertJsonBody("""{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}""", it.body) }, ) } @Test - fun `searchableAttributes same priority23`() = runTest { + fun `set_separators_to_index91`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("title,comments", "ingredients"), + separatorsToIndex = "+#", ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["title,comments","ingredients"]}""", it.body) + assertJsonBody("""{"separatorsToIndex":"+#"}""", it.body) }, ) } @Test - fun `searchableAttributes higher priority24`() = runTest { + fun `set_languages_using_querylanguages92`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("title", "ingredients"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + ignorePlurals = IgnorePlurals.of(true), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["title","ingredients"]}""", it.body) + assertJsonBody("""{"queryLanguages":["es"],"ignorePlurals":true}""", it.body) }, ) } @Test - fun `customRanking retweets25`() = runTest { + fun `set_attributes_to_transliterate93`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(retweets)", "desc(likes)"), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }), + attributesToTransliterate = listOf("name", "description"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(retweets)","desc(likes)"]}""", it.body) + assertJsonBody("""{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}""", it.body) }, ) } @Test - fun `customRanking boosted26`() = runTest { + fun `set_languages_using_querylanguages94`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(boosted)"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + removeStopWords = RemoveStopWords.of(true), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(boosted)"]}""", it.body) + assertJsonBody("""{"queryLanguages":["es"],"removeStopWords":true}""", it.body) }, ) } @Test - fun `customRanking pageviews27`() = runTest { + fun `set_camel_case_attributes95`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(pageviews)", "desc(comments)"), + camelCaseAttributes = listOf("description"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(pageviews)","desc(comments)"]}""", it.body) + assertJsonBody("""{"camelCaseAttributes":["description"]}""", it.body) }, ) } @Test - fun `customRanking applying search parameters for a specific query28`() = runTest { + fun `set_decompounded_attributes96`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(nb_airline_liaisons)"), - attributesForFaceting = listOf("city, country"), + decompoundedAttributes = buildJsonObject { + put( + "de", + JsonArray( + listOf( + JsonPrimitive("name"), + ), + ), + ) + }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""", it.body) + assertJsonBody("""{"decompoundedAttributes":{"de":["name"]}}""", it.body) }, ) } @Test - fun `customRanking rounded pageviews29`() = runTest { + fun `set_decompounded_multiple_attributes97`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(rounded_pageviews)", "desc(comments)"), + decompoundedAttributes = buildJsonObject { + put( + "de", + JsonArray( + listOf( + JsonPrimitive("name_de"), + JsonPrimitive("description_de"), + ), + ), + ) + put( + "fi", + JsonArray( + listOf( + JsonPrimitive("name_fi"), + JsonPrimitive("description_fi"), + ), + ), + ) + }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""", it.body) + assertJsonBody("""{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}""", it.body) }, ) } @Test - fun `customRanking price30`() = runTest { + fun `set_keep_diacritics_on_characters98`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(price)"), + keepDiacriticsOnCharacters = "øé", ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(price)"]}""", it.body) + assertJsonBody("""{"keepDiacriticsOnCharacters":"øé"}""", it.body) }, ) } @Test - fun `ranking exhaustive31`() = runTest { + fun `set_custom_normalization99`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = listOf("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + customNormalization = mapOf("default" to mapOf("ä" to "ae")), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + assertJsonBody("""{"customNormalization":{"default":{"ä":"ae"}}}""", it.body) }, ) } @Test - fun `ranking standard replica32`() = runTest { + fun `set_languages_using_querylanguages100`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = listOf("desc(post_date_timestamp)"), + queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "es" }), + removeStopWords = RemoveStopWords.of(true), + ignorePlurals = IgnorePlurals.of(true), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"ranking":["desc(post_date_timestamp)"]}""", it.body) + assertJsonBody("""{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}""", it.body) }, ) } @Test - fun `ranking virtual replica33`() = runTest { + fun `set_indexlanguages101`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("desc(post_date_timestamp)"), + indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "ja" }), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["desc(post_date_timestamp)"]}""", it.body) + assertJsonBody("""{"indexLanguages":["ja"]}""", it.body) }, ) } @Test - fun `customRanking and ranking sort alphabetically34`() = runTest { + fun `enable_decompound_query_by_default102`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("asc(textual_attribute)"), - ranking = listOf("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"), + decompoundQuery = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""", it.body) + assertJsonBody("""{"decompoundQuery":true}""", it.body) }, ) } @Test - fun `relevancyStrictness35`() = runTest { + fun `enable_rules_syntax_by_default103`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = listOf("asc(textual_attribute)"), - relevancyStrictness = 0, + enableRules = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""", it.body) + assertJsonBody("""{"enableRules":true}""", it.body) }, ) } @Test - fun `create replica index36`() = runTest { + fun `enable_personalization_settings104`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = listOf("products_price_desc"), + enablePersonalization = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"replicas":["products_price_desc"]}""", it.body) + assertJsonBody("""{"enablePersonalization":true}""", it.body) }, ) } @Test - fun `create virtual replica index37`() = runTest { + fun `set_default_query_type105`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = listOf("virtual(products_price_desc)"), + queryType = QueryType.entries.first { it.value == "prefixLast" }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"replicas":["virtual(products_price_desc)"]}""", it.body) + assertJsonBody("""{"queryType":"prefixLast"}""", it.body) }, ) } @Test - fun `unlink replica index38`() = runTest { + fun `set_default_remove_words_if_no_result106`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = listOf(""), + removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "none" }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"replicas":[""]}""", it.body) + assertJsonBody("""{"removeWordsIfNoResults":"none"}""", it.body) }, ) } @Test - fun `forwardToReplicas39`() = runTest { + fun `enable_advanced_syntax_by_default107`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "description"), + advancedSyntax = true, ), - forwardToReplicas = true, ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"forwardToReplicas":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"searchableAttributes":["name","description"]}""", it.body) + assertJsonBody("""{"advancedSyntax":true}""", it.body) }, ) } @Test - fun `maxValuesPerFacet40`() = runTest { + fun `set_default_optional_words108`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - maxValuesPerFacet = 1000, + optionalWords = OptionalWords.of(listOf("blue", "iphone case")), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"maxValuesPerFacet":1000}""", it.body) + assertJsonBody("""{"optionalWords":["blue","iphone case"]}""", it.body) }, ) } @Test - fun `maxFacetHits41`() = runTest { + fun `disabling_prefix_search_for_some_attributes_by_default109`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - maxFacetHits = 1000, + disablePrefixOnAttributes = listOf("sku"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"maxFacetHits":1000}""", it.body) + assertJsonBody("""{"disablePrefixOnAttributes":["sku"]}""", it.body) }, ) } @Test - fun `attributesForFaceting complex42`() = runTest { + fun `disabling_exact_for_some_attributes_by_default110`() = runTest { client.runTest( call = { setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = listOf("actor", "filterOnly(category)", "searchable(publisher)"), + disableExactOnAttributes = listOf("description"), ), ) }, intercept = { - assertEquals("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""", it.body) + assertJsonBody("""{"disableExactOnAttributes":["description"]}""", it.body) }, ) } @Test - fun `ranking closest dates43`() = runTest { + fun `set_default_exact_single_word_query111`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = listOf("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"), + exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""", it.body) + assertJsonBody("""{"exactOnSingleWordQuery":"attribute"}""", it.body) }, ) } @Test - fun `searchableAttributes item variation44`() = runTest { + fun `set_default_aternative_as_exact112`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("design", "type", "color"), + alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "ignorePlurals" }, AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["design","type","color"]}""", it.body) + assertJsonBody("""{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}""", it.body) }, ) } @Test - fun `searchableAttributes around location45`() = runTest { + fun `enable_advanced_syntax_by_default113`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "country", "code", "iata_code"), - customRanking = listOf("desc(links_count)"), + advancedSyntax = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""", it.body) + assertJsonBody("""{"advancedSyntax":true}""", it.body) }, ) } @Test - fun `searchableAttributes around location46`() = runTest { + fun `set_numeric_attributes_for_filtering114`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "country", "code", "iata_code"), - customRanking = listOf("desc(links_count)"), + numericAttributesForFiltering = listOf("quantity", "popularity"), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""", it.body) + assertJsonBody("""{"numericAttributesForFiltering":["quantity","popularity"]}""", it.body) }, ) } @Test - fun `disableTypoToleranceOnAttributes47`() = runTest { + fun `enable_compression_of_integer_array115`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = listOf("serial_number"), + allowCompressionOfIntegerArray = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"disableTypoToleranceOnAttributes":["serial_number"]}""", it.body) + assertJsonBody("""{"allowCompressionOfIntegerArray":true}""", it.body) }, ) } @Test - fun `everything48`() = runTest { + fun `set_attributes_for_distinct116`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - advancedSyntax = true, - advancedSyntaxFeatures = listOf(AdvancedSyntaxFeatures.entries.first { it.value == "exactPhrase" }), - allowCompressionOfIntegerArray = true, - allowTyposOnNumericTokens = true, - alternativesAsExact = listOf(AlternativesAsExact.entries.first { it.value == "singleWordSynonym" }), - attributeCriteriaComputedByMinProximity = true, - attributeForDistinct = "test", - attributesForFaceting = listOf("algolia"), - attributesToHighlight = listOf("algolia"), - attributesToRetrieve = listOf("algolia"), - attributesToSnippet = listOf("algolia"), - attributesToTransliterate = listOf("algolia"), - camelCaseAttributes = listOf("algolia"), - customNormalization = mapOf("algolia" to mapOf("aloglia" to "aglolia")), - customRanking = listOf("algolia"), - decompoundQuery = false, - decompoundedAttributes = buildJsonObject { - put( - "algolia", - JsonPrimitive("aloglia"), - ) - }, - disableExactOnAttributes = listOf("algolia"), - disablePrefixOnAttributes = listOf("algolia"), - disableTypoToleranceOnAttributes = listOf("algolia"), - disableTypoToleranceOnWords = listOf("algolia"), - distinct = Distinct.of(3), - enablePersonalization = true, - enableReRanking = false, - enableRules = true, - exactOnSingleWordQuery = ExactOnSingleWordQuery.entries.first { it.value == "attribute" }, - highlightPreTag = "", - highlightPostTag = "", - hitsPerPage = 10, - ignorePlurals = IgnorePlurals.of(false), - indexLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), - keepDiacriticsOnCharacters = "abc", - maxFacetHits = 20, - maxValuesPerFacet = 30, - minProximity = 6, - minWordSizefor1Typo = 5, - minWordSizefor2Typos = 11, - mode = Mode.entries.first { it.value == "neuralSearch" }, - numericAttributesForFiltering = listOf("algolia"), - optionalWords = OptionalWords.of(listOf("myspace")), - paginationLimitedTo = 0, - queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "fr" }), - queryType = QueryType.entries.first { it.value == "prefixLast" }, - ranking = listOf("geo"), - reRankingApplyFilter = ReRankingApplyFilter.of("mySearch:filters"), - relevancyStrictness = 10, - removeStopWords = RemoveStopWords.of(false), - removeWordsIfNoResults = RemoveWordsIfNoResults.entries.first { it.value == "lastWords" }, - renderingContent = RenderingContent( - facetOrdering = FacetOrdering( - facets = Facets( - order = listOf("a", "b"), - ), - values = mapOf( - "a" to Value( - order = listOf("b"), - sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, - ), - ), - ), - ), - replaceSynonymsInHighlight = true, - replicas = listOf(""), - responseFields = listOf("algolia"), - restrictHighlightAndSnippetArrays = true, - searchableAttributes = listOf("foo"), - semanticSearch = SemanticSearch( - eventSources = listOf("foo"), - ), - separatorsToIndex = "bar", - snippetEllipsisText = "---", - sortFacetValuesBy = "date", - typoTolerance = TypoTolerance.of(false), - unretrievableAttributes = listOf("foo"), - userData = buildJsonObject { - put( - "user", - JsonPrimitive("data"), - ) - }, + attributeForDistinct = "url", ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""", it.body) + assertJsonBody("""{"attributeForDistinct":"url"}""", it.body) }, ) } @Test - fun `searchableAttributesWithCustomRankingsAndAttributesForFaceting49`() = runTest { + fun `set_distinct117`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("brand", "name", "categories", "unordered(description)"), - customRanking = listOf("desc(popularity)"), - attributesForFaceting = listOf("searchable(brand)", "type", "categories", "price"), + distinct = Distinct.of(1), + attributeForDistinct = "url", ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""", it.body) + assertJsonBody("""{"distinct":1,"attributeForDistinct":"url"}""", it.body) }, ) } @Test - fun `searchableAttributesProductReferenceSuffixes50`() = runTest { + fun `set_replace_synonyms_in_highlights118`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("name", "product_reference", "product_reference_suffixes"), + replaceSynonymsInHighlight = false, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""", it.body) + assertJsonBody("""{"replaceSynonymsInHighlight":false}""", it.body) }, ) } @Test - fun `queryLanguageAndIgnorePlurals51`() = runTest { + fun `set_min_proximity119`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - queryLanguages = listOf(SupportedLanguage.entries.first { it.value == "en" }), - ignorePlurals = IgnorePlurals.of(true), + minProximity = 1, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"queryLanguages":["en"],"ignorePlurals":true}""", it.body) + assertJsonBody("""{"minProximity":1}""", it.body) }, ) } @Test - fun `searchableAttributesInMovies52`() = runTest { + fun `set_default_field120`() = runTest { client.runTest( call = { setSettings( - indexName = "movies", + indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("title_eng", "title_fr", "title_es"), + responseFields = listOf("hits", "hitsPerPage", "nbPages", "page"), ), ) }, intercept = { - assertEquals("/1/indexes/movies/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["title_eng","title_fr","title_es"]}""", it.body) + assertJsonBody("""{"responseFields":["hits","hitsPerPage","nbPages","page"]}""", it.body) }, ) } @Test - fun `disablePrefixOnAttributes53`() = runTest { + fun `set_max_facet_hits121`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disablePrefixOnAttributes = listOf("serial_number"), + maxFacetHits = 10, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"disablePrefixOnAttributes":["serial_number"]}""", it.body) + assertJsonBody("""{"maxFacetHits":10}""", it.body) }, ) } @Test - fun `disableTypoToleranceOnAttributes54`() = runTest { + fun `set_attribute_criteria_computed_by_min_proximity122`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = listOf("serial_number"), + attributeCriteriaComputedByMinProximity = true, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"disableTypoToleranceOnAttributes":["serial_number"]}""", it.body) + assertJsonBody("""{"attributeCriteriaComputedByMinProximity":true}""", it.body) }, ) } @Test - fun `searchableAttributesSimpleExample55`() = runTest { + fun `set_user_data123`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("serial_number"), + userData = buildJsonObject { + put( + "extraData", + JsonPrimitive("This is the custom data that you want to store in your index"), + ) + }, ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["serial_number"]}""", it.body) + assertJsonBody("""{"userData":{"extraData":"This is the custom data that you want to store in your index"}}""", it.body) }, ) } @Test - fun `searchableAttributesSimpleExampleAlt56`() = runTest { + fun `set_rendering_content124`() = runTest { client.runTest( call = { setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = listOf("serial_number", "serial_number_suffixes"), + renderingContent = RenderingContent( + facetOrdering = FacetOrdering( + facets = Facets( + order = listOf("size", "brand"), + ), + values = mapOf( + "brand" to Value( + order = listOf("uniqlo"), + hide = listOf("muji"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "count" }, + ), + "size" to Value( + order = listOf("S", "M", "L"), + sortRemainingBy = SortRemainingBy.entries.first { it.value == "hidden" }, + ), + ), + ), + ), ), ) }, intercept = { assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{"searchableAttributes":["serial_number","serial_number_suffixes"]}""", it.body) + assertJsonBody("""{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}""", it.body) }, ) } diff --git a/tests/output/php/src/requests/SearchTest.php b/tests/output/php/src/requests/SearchTest.php index 41a1bf5e88..d19502a296 100644 --- a/tests/output/php/src/requests/SearchTest.php +++ b/tests/output/php/src/requests/SearchTest.php @@ -3840,8 +3840,108 @@ public function testSearchSingleIndex13(): void ]); } - #[TestDox('facetFiltersNeg')] + #[TestDox('facetFiltersBook')] public function testSearchSingleIndex14(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facetFilters' => [ + 'category:Book', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facetFilters":["category:Book"]}'), + ], + ]); + } + + #[TestDox('facetFiltersAND')] + public function testSearchSingleIndex15(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facetFilters' => [ + 'category:Book', + + 'author:John Doe', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facetFilters":["category:Book","author:John Doe"]}'), + ], + ]); + } + + #[TestDox('facetFiltersOR')] + public function testSearchSingleIndex16(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facetFilters' => [ + [ + 'category:Book', + + 'author:John Doe', + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}'), + ], + ]); + } + + #[TestDox('facetFiltersCombined')] + public function testSearchSingleIndex17(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facetFilters' => [ + 'author:John Doe', + + [ + 'category:Book', + + 'category:Movie', + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}'), + ], + ]); + } + + #[TestDox('facetFiltersNeg')] + public function testSearchSingleIndex18(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3860,7 +3960,7 @@ public function testSearchSingleIndex14(): void } #[TestDox('filtersAndFacetFilters')] - public function testSearchSingleIndex15(): void + public function testSearchSingleIndex19(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3882,7 +3982,7 @@ public function testSearchSingleIndex15(): void } #[TestDox('facet author genre')] - public function testSearchSingleIndex16(): void + public function testSearchSingleIndex20(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3905,7 +4005,7 @@ public function testSearchSingleIndex16(): void } #[TestDox('facet wildcard')] - public function testSearchSingleIndex17(): void + public function testSearchSingleIndex21(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3926,7 +4026,7 @@ public function testSearchSingleIndex17(): void } #[TestDox('maxValuesPerFacet')] - public function testSearchSingleIndex18(): void + public function testSearchSingleIndex22(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3945,7 +4045,7 @@ public function testSearchSingleIndex18(): void } #[TestDox('aroundLatLng')] - public function testSearchSingleIndex19(): void + public function testSearchSingleIndex23(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3964,7 +4064,7 @@ public function testSearchSingleIndex19(): void } #[TestDox('aroundLatLngViaIP')] - public function testSearchSingleIndex20(): void + public function testSearchSingleIndex24(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -3983,7 +4083,7 @@ public function testSearchSingleIndex20(): void } #[TestDox('aroundRadius')] - public function testSearchSingleIndex21(): void + public function testSearchSingleIndex25(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4003,7 +4103,7 @@ public function testSearchSingleIndex21(): void } #[TestDox('insideBoundingBox')] - public function testSearchSingleIndex22(): void + public function testSearchSingleIndex26(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4032,7 +4132,7 @@ public function testSearchSingleIndex22(): void } #[TestDox('insidePolygon')] - public function testSearchSingleIndex23(): void + public function testSearchSingleIndex27(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4077,7 +4177,7 @@ public function testSearchSingleIndex23(): void } #[TestDox('insidePolygon')] - public function testSearchSingleIndex24(): void + public function testSearchSingleIndex28(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4122,7 +4222,7 @@ public function testSearchSingleIndex24(): void } #[TestDox('optionalFilters')] - public function testSearchSingleIndex25(): void + public function testSearchSingleIndex29(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4143,7 +4243,7 @@ public function testSearchSingleIndex25(): void } #[TestDox('optionalFiltersMany')] - public function testSearchSingleIndex26(): void + public function testSearchSingleIndex30(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4168,7 +4268,7 @@ public function testSearchSingleIndex26(): void } #[TestDox('optionalFiltersSimple')] - public function testSearchSingleIndex27(): void + public function testSearchSingleIndex31(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4191,7 +4291,7 @@ public function testSearchSingleIndex27(): void } #[TestDox('restrictSearchableAttributes')] - public function testSearchSingleIndex28(): void + public function testSearchSingleIndex32(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4212,7 +4312,7 @@ public function testSearchSingleIndex28(): void } #[TestDox('getRankingInfo')] - public function testSearchSingleIndex29(): void + public function testSearchSingleIndex33(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4231,7 +4331,7 @@ public function testSearchSingleIndex29(): void } #[TestDox('clickAnalytics')] - public function testSearchSingleIndex30(): void + public function testSearchSingleIndex34(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4250,7 +4350,7 @@ public function testSearchSingleIndex30(): void } #[TestDox('clickAnalyticsUserToken')] - public function testSearchSingleIndex31(): void + public function testSearchSingleIndex35(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4270,7 +4370,7 @@ public function testSearchSingleIndex31(): void } #[TestDox('enablePersonalization')] - public function testSearchSingleIndex32(): void + public function testSearchSingleIndex36(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4290,7 +4390,7 @@ public function testSearchSingleIndex32(): void } #[TestDox('userToken')] - public function testSearchSingleIndex33(): void + public function testSearchSingleIndex37(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4308,8 +4408,28 @@ public function testSearchSingleIndex33(): void ]); } + #[TestDox('userToken1234')] + public function testSearchSingleIndex38(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'userToken' => 'user-1234', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","userToken":"user-1234"}'), + ], + ]); + } + #[TestDox('analyticsTag')] - public function testSearchSingleIndex34(): void + public function testSearchSingleIndex39(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4330,7 +4450,7 @@ public function testSearchSingleIndex34(): void } #[TestDox('facetFiltersUsers')] - public function testSearchSingleIndex35(): void + public function testSearchSingleIndex40(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4353,7 +4473,7 @@ public function testSearchSingleIndex35(): void } #[TestDox('buildTheQuery')] - public function testSearchSingleIndex36(): void + public function testSearchSingleIndex41(): void { $client = $this->getClient(); $client->searchSingleIndex( @@ -4375,173 +4495,2059 @@ public function testSearchSingleIndex36(): void ]); } - #[TestDox('searchSynonyms with minimal parameters')] - public function testSearchSynonyms(): void + #[TestDox('attributesToHighlightOverride')] + public function testSearchSingleIndex42(): void { $client = $this->getClient(); - $client->searchSynonyms( + $client->searchSingleIndex( 'indexName', + ['query' => 'query', + 'attributesToHighlight' => [ + 'title', + + 'content', + ], + ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/indexName/synonyms/search', + 'path' => '/1/indexes/indexName/query', 'method' => 'POST', - 'body' => json_decode('{}'), + 'body' => json_decode('{"query":"query","attributesToHighlight":["title","content"]}'), ], ]); } - #[TestDox('searchSynonyms with all parameters')] - public function testSearchSynonyms1(): void + #[TestDox('disableTypoToleranceOnAttributes')] + public function testSearchSingleIndex43(): void { $client = $this->getClient(); - $client->searchSynonyms( + $client->searchSingleIndex( 'indexName', - ['query' => 'myQuery', - 'type' => 'altcorrection1', - 'page' => 10, - 'hitsPerPage' => 10, + ['query' => 'query', + 'disableTypoToleranceOnAttributes' => [ + 'serial_number', + ], ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/indexName/synonyms/search', + 'path' => '/1/indexes/indexName/query', 'method' => 'POST', - 'body' => json_decode('{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}'), + 'body' => json_decode('{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}'), ], ]); } - #[TestDox('searchUserIds')] - public function testSearchUserIds(): void + #[TestDox('search_a_query')] + public function testSearchSingleIndex44(): void { $client = $this->getClient(); - $client->searchUserIds( - ['query' => 'test', - 'clusterName' => 'theClusterName', - 'page' => 5, - 'hitsPerPage' => 10, + $client->searchSingleIndex( + 'indexName', + ['query' => 'shirt', ], ); $this->assertRequests([ [ - 'path' => '/1/clusters/mapping/search', + 'path' => '/1/indexes/indexName/query', 'method' => 'POST', - 'body' => json_decode('{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}'), + 'body' => json_decode('{"query":"shirt"}'), ], ]); } - #[TestDox('get setDictionarySettings results with minimal parameters')] - public function testSetDictionarySettings(): void + #[TestDox('search_everything')] + public function testSearchSingleIndex45(): void { $client = $this->getClient(); - $client->setDictionarySettings( - ['disableStandardEntries' => ['plurals' => ['fr' => false, - 'en' => false, - 'ru' => true, - ], - ], + $client->searchSingleIndex( + 'indexName', + ['query' => '', ], ); $this->assertRequests([ [ - 'path' => '/1/dictionaries/*/settings', - 'method' => 'PUT', - 'body' => json_decode('{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}'), + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":""}'), ], ]); } - #[TestDox('get setDictionarySettings results with all parameters')] - public function testSetDictionarySettings1(): void + #[TestDox('api_filtering_range_example')] + public function testSearchSingleIndex46(): void { $client = $this->getClient(); - $client->setDictionarySettings( - ['disableStandardEntries' => ['plurals' => ['fr' => false, - 'en' => false, - 'ru' => true, - ], - 'stopwords' => ['fr' => false, - ], - 'compounds' => ['ru' => true, - ], - ], + $client->searchSingleIndex( + 'indexName', + ['query' => 'books', + 'filters' => 'price:10 TO 20', ], ); $this->assertRequests([ [ - 'path' => '/1/dictionaries/*/settings', - 'method' => 'PUT', - 'body' => json_decode('{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}'), + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"books","filters":"price:10 TO 20"}'), ], ]); } - #[TestDox('minimal parameters')] - public function testSetSettings(): void + #[TestDox('search_a_query')] + public function testSearchSingleIndex47(): void { $client = $this->getClient(); - $client->setSettings( - 'cts_e2e_settings', - ['paginationLimitedTo' => 10, + $client->searchSingleIndex( + 'indexName', + ['query' => '', + 'similarQuery' => 'Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen', + 'filters' => 'year:1991 TO 2001', ], - true, ); $this->assertRequests([ [ - 'path' => '/1/indexes/cts_e2e_settings/settings', - 'method' => 'PUT', - 'body' => json_decode('{"paginationLimitedTo":10}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}'), ], ]); } - #[TestDox('boolean typoTolerance')] - public function testSetSettings1(): void + #[TestDox('override_retrievable_attributes')] + public function testSearchSingleIndex48(): void { $client = $this->getClient(); - $client->setSettings( - 'theIndexName', - ['typoTolerance' => true, + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'attributesToRetrieve' => [ + 'title', + + 'content', + ], ], - true, ); $this->assertRequests([ [ - 'path' => '/1/indexes/theIndexName/settings', - 'method' => 'PUT', - 'body' => json_decode('{"typoTolerance":true}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","attributesToRetrieve":["title","content"]}'), ], ]); } - #[TestDox('enum typoTolerance')] - public function testSetSettings2(): void + #[TestDox('restrict_searchable_attributes')] + public function testSearchSingleIndex49(): void { $client = $this->getClient(); - $client->setSettings( - 'theIndexName', - ['typoTolerance' => 'min', + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'restrictSearchableAttributes' => [ + 'title', + + 'author', + ], ], - true, ); $this->assertRequests([ [ - 'path' => '/1/indexes/theIndexName/settings', - 'method' => 'PUT', - 'body' => json_decode('{"typoTolerance":"min"}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","restrictSearchableAttributes":["title","author"]}'), + ], + ]); + } + + #[TestDox('override_default_relevancy')] + public function testSearchSingleIndex50(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'relevancyStrictness' => 70, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","relevancyStrictness":70}'), + ], + ]); + } + + #[TestDox('apply_filters')] + public function testSearchSingleIndex51(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'filters' => '(category:Book OR category:Ebook) AND _tags:published', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}'), + ], + ]); + } + + #[TestDox('apply_all_filters')] + public function testSearchSingleIndex52(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['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"', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"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""}'), + ], + ]); + } + + #[TestDox('escape_spaces')] + public function testSearchSingleIndex53(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'filters' => 'category:"Books and Comics"', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","filters":"category:"Books and Comics""}'), + ], + ]); + } + + #[TestDox('escape_keywords')] + public function testSearchSingleIndex54(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'filters' => 'keyword:"OR"', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","filters":"keyword:"OR""}'), + ], + ]); + } + + #[TestDox('escape_single_quotes')] + public function testSearchSingleIndex55(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'filters' => "content:\"It's a wonderful day\"", + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode("{\"query\":\"query\",\"filters\":\"content:\"It's a wonderful day\"\"}"), + ], + ]); + } + + #[TestDox('escape_double_quotes')] + public function testSearchSingleIndex56(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'filters' => 'content:"She said "Hello World"', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","filters":"content:"She said "Hello World""}'), + ], + ]); + } + + #[TestDox('apply_filters')] + public function testSearchSingleIndex57(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'optionalFilters' => [ + 'category:Book', + + 'author:John Doe', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","optionalFilters":["category:Book","author:John Doe"]}'), + ], + ]); + } + + #[TestDox('apply_negative_filters')] + public function testSearchSingleIndex58(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'optionalFilters' => [ + 'category:Book', + + 'author:-John Doe', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}'), + ], + ]); + } + + #[TestDox('apply_numeric_filters')] + public function testSearchSingleIndex59(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'numericFilters' => [ + 'price < 1000', + + [ + 'inStock = 1', + + 'deliveryDate < 1441755506', + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}'), + ], + ]); + } + + #[TestDox('apply_tag_filters')] + public function testSearchSingleIndex60(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'tagFilters' => [ + 'SciFi', + + [ + 'Book', + + 'Movie', + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}'), + ], + ]); + } + + #[TestDox('apply_filters')] + public function testSearchSingleIndex61(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'sumOrFiltersScores' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","sumOrFiltersScores":true}'), + ], + ]); + } + + #[TestDox('facets_all')] + public function testSearchSingleIndex62(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facets' => [ + '*', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facets":["*"]}'), + ], + ]); + } + + #[TestDox('retrieve_only_some_facets')] + public function testSearchSingleIndex63(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facets' => [ + 'category', + + 'author', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facets":["category","author"]}'), + ], + ]); + } + + #[TestDox('override_default_max_values_per_facet')] + public function testSearchSingleIndex64(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'maxValuesPerFacet' => 20, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","maxValuesPerFacet":20}'), + ], + ]); + } + + #[TestDox('enable_faceting_after_distinct')] + public function testSearchSingleIndex65(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'facetingAfterDistinct' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","facetingAfterDistinct":true}'), + ], + ]); + } + + #[TestDox('sort_facet_values_alphabetically')] + public function testSearchSingleIndex66(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'sortFacetValuesBy' => 'count', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","sortFacetValuesBy":"count"}'), + ], + ]); + } + + #[TestDox('override_attributes_to_snippet')] + public function testSearchSingleIndex67(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'attributesToSnippet' => [ + 'title', + + 'content:80', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","attributesToSnippet":["title","content:80"]}'), + ], + ]); + } + + #[TestDox('override_default_highlight_pre_tag')] + public function testSearchSingleIndex68(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'highlightPreTag' => '', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","highlightPreTag":""}'), + ], + ]); + } + + #[TestDox('override_default_highlight_post_tag')] + public function testSearchSingleIndex69(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'highlightPostTag' => '', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","highlightPostTag":""}'), + ], + ]); + } + + #[TestDox('override_default_snippet_ellipsis_text')] + public function testSearchSingleIndex70(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'snippetEllipsisText' => '', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","snippetEllipsisText":""}'), + ], + ]); + } + + #[TestDox('enable_restrict_highlight_and_snippet_arrays')] + public function testSearchSingleIndex71(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'restrictHighlightAndSnippetArrays' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","restrictHighlightAndSnippetArrays":false}'), + ], + ]); + } + + #[TestDox('access_page')] + public function testSearchSingleIndex72(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'page' => 0, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","page":0}'), + ], + ]); + } + + #[TestDox('override_default_hits_per_page')] + public function testSearchSingleIndex73(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'hitsPerPage' => 10, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","hitsPerPage":10}'), + ], + ]); + } + + #[TestDox('get_nth_hit')] + public function testSearchSingleIndex74(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'offset' => 4, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","offset":4}'), + ], + ]); + } + + #[TestDox('get_n_results')] + public function testSearchSingleIndex75(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'length' => 4, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","length":4}'), + ], + ]); + } + + #[TestDox('override_default_min_word_size_for_one_typo')] + public function testSearchSingleIndex76(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'minWordSizefor1Typo' => 2, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","minWordSizefor1Typo":2}'), + ], + ]); + } + + #[TestDox('override_default_min_word_size_for_two_typos')] + public function testSearchSingleIndex77(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'minWordSizefor2Typos' => 2, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","minWordSizefor2Typos":2}'), + ], + ]); + } + + #[TestDox('override_default_typo_tolerance_mode')] + public function testSearchSingleIndex78(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'typoTolerance' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","typoTolerance":false}'), + ], + ]); + } + + #[TestDox('disable_typos_on_numeric_tokens_at_search_time')] + public function testSearchSingleIndex79(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'allowTyposOnNumericTokens' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","allowTyposOnNumericTokens":false}'), + ], + ]); + } + + #[TestDox('search_around_a_position')] + public function testSearchSingleIndex80(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'aroundLatLng' => '40.71, -74.01', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundLatLng":"40.71, -74.01"}'), + ], + ]); + } + + #[TestDox('search_around_server_ip')] + public function testSearchSingleIndex81(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['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', + ], + ] + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundLatLngViaIP":true}'), + 'headers' => json_decode('{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}', true), + ], + ]); + } + + #[TestDox('set_around_radius')] + public function testSearchSingleIndex82(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'aroundRadius' => 1000, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundRadius":1000}'), + ], + ]); + } + + #[TestDox('disable_automatic_radius')] + public function testSearchSingleIndex83(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'aroundRadius' => 'all', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundRadius":"all"}'), + ], + ]); + } + + #[TestDox('set_geo_search_precision')] + public function testSearchSingleIndex84(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'aroundPrecision' => 100, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundPrecision":100}'), + ], + ]); + } + + #[TestDox('set_geo_search_precision_non_linear')] + public function testSearchSingleIndex85(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'aroundPrecision' => [ + ['from' => 0, + 'value' => 25, + ], + + ['from' => 2000, + 'value' => 1000, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}'), + ], + ]); + } + + #[TestDox('set_minimum_geo_search_radius')] + public function testSearchSingleIndex86(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'minimumAroundRadius' => 1000, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","minimumAroundRadius":1000}'), + ], + ]); + } + + #[TestDox('search_inside_rectangular_area')] + public function testSearchSingleIndex87(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'insideBoundingBox' => [ + [ + 46.650828100116044, + + 7.123046875, + + 45.17210966999772, + + 1.009765625, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}'), + ], + ]); + } + + #[TestDox('search_inside_multiple_rectangular_areas')] + public function testSearchSingleIndex88(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'insideBoundingBox' => [ + [ + 46.650828100116044, + + 7.123046875, + + 45.17210966999772, + + 1.009765625, + ], + + [ + 49.62625916704081, + + 4.6181640625, + + 47.715070300900194, + + 0.482421875, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}'), + ], + ]); + } + + #[TestDox('search_inside_polygon_area')] + public function testSearchSingleIndex89(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'insidePolygon' => [ + [ + 46.650828100116044, + + 7.123046875, + + 45.17210966999772, + + 1.009765625, + + 49.62625916704081, + + 4.6181640625, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}'), + ], + ]); + } + + #[TestDox('search_inside_multiple_polygon_areas')] + public function testSearchSingleIndex90(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['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, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"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]]}'), + ], + ]); + } + + #[TestDox('set_querylanguages_override')] + public function testSearchSingleIndex91(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'ignorePlurals' => [ + 'ca', + + 'es', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","ignorePlurals":["ca","es"]}'), + ], + ]); + } + + #[TestDox('set_querylanguages_override')] + public function testSearchSingleIndex92(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'removeStopWords' => [ + 'ca', + + 'es', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","removeStopWords":["ca","es"]}'), + ], + ]); + } + + #[TestDox('set_querylanguages_override')] + public function testSearchSingleIndex93(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'removeStopWords' => [ + 'ca', + + 'es', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","removeStopWords":["ca","es"]}'), + ], + ]); + } + + #[TestDox('set_querylanguages_with_japanese_query')] + public function testSearchSingleIndex94(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'queryLanguages' => [ + 'ja', + + 'en', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","queryLanguages":["ja","en"]}'), + ], + ]); + } + + #[TestDox('set_natural_languages')] + public function testSearchSingleIndex95(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => '', + 'naturalLanguages' => [ + 'fr', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"","naturalLanguages":["fr"]}'), + ], + ]); + } + + #[TestDox('override_natural_languages_with_query')] + public function testSearchSingleIndex96(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => '', + 'naturalLanguages' => [ + 'fr', + ], + 'removeWordsIfNoResults' => 'firstWords', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}'), + ], + ]); + } + + #[TestDox('enable_decompound_query_search_time')] + public function testSearchSingleIndex97(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'decompoundQuery' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","decompoundQuery":true}'), + ], + ]); + } + + #[TestDox('enable_rules_search_time')] + public function testSearchSingleIndex98(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enableRules' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enableRules":true}'), + ], + ]); + } + + #[TestDox('set_rule_contexts')] + public function testSearchSingleIndex99(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'ruleContexts' => [ + 'front_end', + + 'website2', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","ruleContexts":["front_end","website2"]}'), + ], + ]); + } + + #[TestDox('enable_personalization')] + public function testSearchSingleIndex100(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enablePersonalization' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enablePersonalization":true}'), + ], + ]); + } + + #[TestDox('enable_personalization_with_user_token')] + public function testSearchSingleIndex101(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enablePersonalization' => true, + 'userToken' => '123456', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enablePersonalization":true,"userToken":"123456"}'), + ], + ]); + } + + #[TestDox('personalization_impact')] + public function testSearchSingleIndex102(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'personalizationImpact' => 20, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","personalizationImpact":20}'), + ], + ]); + } + + #[TestDox('set_user_token')] + public function testSearchSingleIndex103(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'userToken' => '123456', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","userToken":"123456"}'), + ], + ]); + } + + #[TestDox('set_user_token_with_personalization')] + public function testSearchSingleIndex104(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enablePersonalization' => true, + 'userToken' => '123456', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enablePersonalization":true,"userToken":"123456"}'), + ], + ]); + } + + #[TestDox('override_default_query_type')] + public function testSearchSingleIndex105(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'queryType' => 'prefixAll', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","queryType":"prefixAll"}'), + ], + ]); + } + + #[TestDox('override_default_remove_words_if_no_results')] + public function testSearchSingleIndex106(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'removeWordsIfNoResults' => 'lastWords', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","removeWordsIfNoResults":"lastWords"}'), + ], + ]); + } + + #[TestDox('enable_advanced_syntax_search_time')] + public function testSearchSingleIndex107(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'advancedSyntax' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","advancedSyntax":true}'), + ], + ]); + } + + #[TestDox('overide_default_optional_words')] + public function testSearchSingleIndex108(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'optionalWords' => [ + 'toyota', + + '2020 2021', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","optionalWords":["toyota","2020 2021"]}'), + ], + ]); + } + + #[TestDox('disabling_exact_for_some_attributes_search_time')] + public function testSearchSingleIndex109(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'disableExactOnAttributes' => [ + 'description', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","disableExactOnAttributes":["description"]}'), + ], + ]); + } + + #[TestDox('override_default_exact_single_word_query')] + public function testSearchSingleIndex110(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'exactOnSingleWordQuery' => 'none', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","exactOnSingleWordQuery":"none"}'), + ], + ]); + } + + #[TestDox('override_default_aternative_as_exact')] + public function testSearchSingleIndex111(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'alternativesAsExact' => [ + 'multiWordsSynonym', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","alternativesAsExact":["multiWordsSynonym"]}'), + ], + ]); + } + + #[TestDox('enable_advanced_syntax_exact_phrase')] + public function testSearchSingleIndex112(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'exactPhrase', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}'), + ], + ]); + } + + #[TestDox('enable_advanced_syntax_exclude_words')] + public function testSearchSingleIndex113(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'excludeWords', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}'), + ], + ]); + } + + #[TestDox('override_distinct')] + public function testSearchSingleIndex114(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'distinct' => 0, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","distinct":0}'), + ], + ]); + } + + #[TestDox('get_ranking_info')] + public function testSearchSingleIndex115(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'getRankingInfo' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","getRankingInfo":true}'), + ], + ]); + } + + #[TestDox('disable_click_analytics')] + public function testSearchSingleIndex116(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'clickAnalytics' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","clickAnalytics":false}'), + ], + ]); + } + + #[TestDox('enable_click_analytics')] + public function testSearchSingleIndex117(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'clickAnalytics' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","clickAnalytics":true}'), + ], + ]); + } + + #[TestDox('disable_analytics')] + public function testSearchSingleIndex118(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'analytics' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","analytics":false}'), + ], + ]); + } + + #[TestDox('add_analytics_tags')] + public function testSearchSingleIndex119(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'analyticsTags' => [ + 'front_end', + + 'website2', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","analyticsTags":["front_end","website2"]}'), + ], + ]); + } + + #[TestDox('disable_synonyms')] + public function testSearchSingleIndex120(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'synonyms' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","synonyms":false}'), + ], + ]); + } + + #[TestDox('override_replace_synonyms_in_highlights')] + public function testSearchSingleIndex121(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'replaceSynonymsInHighlight' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","replaceSynonymsInHighlight":true}'), + ], + ]); + } + + #[TestDox('override_min_proximity')] + public function testSearchSingleIndex122(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'minProximity' => 2, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","minProximity":2}'), + ], + ]); + } + + #[TestDox('override_default_field')] + public function testSearchSingleIndex123(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'responseFields' => [ + 'hits', + + 'facets', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","responseFields":["hits","facets"]}'), + ], + ]); + } + + #[TestDox('override_percentile_computation')] + public function testSearchSingleIndex124(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'percentileComputation' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","percentileComputation":false}'), + ], + ]); + } + + #[TestDox('set_ab_test')] + public function testSearchSingleIndex125(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enableABTest' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enableABTest":false}'), + ], + ]); + } + + #[TestDox('set_enable_re_ranking')] + public function testSearchSingleIndex126(): void + { + $client = $this->getClient(); + $client->searchSingleIndex( + 'indexName', + ['query' => 'query', + 'enableReRanking' => false, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/query', + 'method' => 'POST', + 'body' => json_decode('{"query":"query","enableReRanking":false}'), + ], + ]); + } + + #[TestDox('searchSynonyms with minimal parameters')] + public function testSearchSynonyms(): void + { + $client = $this->getClient(); + $client->searchSynonyms( + 'indexName', + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/synonyms/search', + 'method' => 'POST', + 'body' => json_decode('{}'), + ], + ]); + } + + #[TestDox('searchSynonyms with all parameters')] + public function testSearchSynonyms1(): void + { + $client = $this->getClient(); + $client->searchSynonyms( + 'indexName', + ['query' => 'myQuery', + 'type' => 'altcorrection1', + 'page' => 10, + 'hitsPerPage' => 10, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/indexName/synonyms/search', + 'method' => 'POST', + 'body' => json_decode('{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}'), + ], + ]); + } + + #[TestDox('searchUserIds')] + public function testSearchUserIds(): void + { + $client = $this->getClient(); + $client->searchUserIds( + ['query' => 'test', + 'clusterName' => 'theClusterName', + 'page' => 5, + 'hitsPerPage' => 10, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/clusters/mapping/search', + 'method' => 'POST', + 'body' => json_decode('{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}'), + ], + ]); + } + + #[TestDox('get setDictionarySettings results with minimal parameters')] + public function testSetDictionarySettings(): void + { + $client = $this->getClient(); + $client->setDictionarySettings( + ['disableStandardEntries' => ['plurals' => ['fr' => false, + 'en' => false, + 'ru' => true, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/dictionaries/*/settings', + 'method' => 'PUT', + 'body' => json_decode('{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}'), + ], + ]); + } + + #[TestDox('get setDictionarySettings results with all parameters')] + public function testSetDictionarySettings1(): void + { + $client = $this->getClient(); + $client->setDictionarySettings( + ['disableStandardEntries' => ['plurals' => ['fr' => false, + 'en' => false, + 'ru' => true, + ], + 'stopwords' => ['fr' => false, + ], + 'compounds' => ['ru' => true, + ], + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/dictionaries/*/settings', + 'method' => 'PUT', + 'body' => json_decode('{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}'), + ], + ]); + } + + #[TestDox('minimal parameters')] + public function testSetSettings(): void + { + $client = $this->getClient(); + $client->setSettings( + 'cts_e2e_settings', + ['paginationLimitedTo' => 10, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/cts_e2e_settings/settings', + 'method' => 'PUT', + 'body' => json_decode('{"paginationLimitedTo":10}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('boolean typoTolerance')] + public function testSetSettings1(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['typoTolerance' => true, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"typoTolerance":true}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('enum typoTolerance')] + public function testSetSettings2(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['typoTolerance' => 'min', + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"typoTolerance":"min"}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), ], ]); } @@ -4552,138 +6558,1762 @@ public function testSetSettings3(): void $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['ignorePlurals' => true, + ['ignorePlurals' => true, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"ignorePlurals":true}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('list of string ignorePlurals')] + public function testSetSettings4(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['ignorePlurals' => [ + 'fr', + ], + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"ignorePlurals":["fr"]}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('removeStopWords boolean')] + public function testSetSettings5(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['removeStopWords' => true, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"removeStopWords":true}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('removeStopWords list of string')] + public function testSetSettings6(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['removeStopWords' => [ + 'fr', + ], + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"removeStopWords":["fr"]}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('boolean distinct')] + public function testSetSettings7(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['distinct' => true, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"distinct":true}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('integer distinct')] + public function testSetSettings8(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['distinct' => 1, + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"distinct":1}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('distinct company')] + public function testSetSettings9(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributeForDistinct' => 'company', + 'distinct' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributeForDistinct":"company","distinct":true}'), + ], + ]); + } + + #[TestDox('distinct design')] + public function testSetSettings10(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributeForDistinct' => 'design', + 'distinct' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributeForDistinct":"design","distinct":true}'), + ], + ]); + } + + #[TestDox('distinct true')] + public function testSetSettings11(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['distinct' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"distinct":true}'), + ], + ]); + } + + #[TestDox('distinct section')] + public function testSetSettings12(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributeForDistinct' => 'section', + 'distinct' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributeForDistinct":"section","distinct":true}'), + ], + ]); + } + + #[TestDox('attributesForFaceting allergens')] + public function testSetSettings13(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'allergens', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["allergens"]}'), + ], + ]); + } + + #[TestDox('api_attributes_for_faceting')] + public function testSetSettings14(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'genre', + + 'author', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["genre","author"]}'), + ], + ]); + } + + #[TestDox('api_attributes_for_faceting_searchable')] + public function testSetSettings15(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'genre', + + 'searchable(author)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["genre","searchable(author)"]}'), + ], + ]); + } + + #[TestDox('api_attributes_for_filter_only')] + public function testSetSettings16(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(genre)', + + 'author', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["filterOnly(genre)","author"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting categoryPageId')] + public function testSetSettings17(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'searchable(categoryPageId)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["searchable(categoryPageId)"]}'), + ], + ]); + } + + #[TestDox('unretrievableAttributes')] + public function testSetSettings18(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['unretrievableAttributes' => [ + 'visible_by', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"unretrievableAttributes":["visible_by"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting user restricted data')] + public function testSetSettings19(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(visible_by)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["filterOnly(visible_by)"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting optional filters')] + public function testSetSettings20(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'can_deliver_quickly', + + 'restaurant', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["can_deliver_quickly","restaurant"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting redirect index')] + public function testSetSettings21(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'query_terms', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["query_terms"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting multiple consequences')] + public function testSetSettings22(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'director', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["director"]}'), + ], + ]); + } + + #[TestDox('attributesForFaceting in-depth optional filters')] + public function testSetSettings23(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'filterOnly(brand)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["filterOnly(brand)"]}'), + ], + ]); + } + + #[TestDox('mode neuralSearch')] + public function testSetSettings24(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['mode' => 'neuralSearch', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"mode":"neuralSearch"}'), + ], + ]); + } + + #[TestDox('mode keywordSearch')] + public function testSetSettings25(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['mode' => 'keywordSearch', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"mode":"keywordSearch"}'), + ], + ]); + } + + #[TestDox('searchableAttributes same priority')] + public function testSetSettings26(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'title,comments', + + 'ingredients', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["title,comments","ingredients"]}'), + ], + ]); + } + + #[TestDox('searchableAttributes higher priority')] + public function testSetSettings27(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'title', + + 'ingredients', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["title","ingredients"]}'), + ], + ]); + } + + #[TestDox('customRanking retweets')] + public function testSetSettings28(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(retweets)', + + 'desc(likes)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(retweets)","desc(likes)"]}'), + ], + ]); + } + + #[TestDox('customRanking boosted')] + public function testSetSettings29(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(boosted)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(boosted)"]}'), + ], + ]); + } + + #[TestDox('customRanking pageviews')] + public function testSetSettings30(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(pageviews)', + + 'desc(comments)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(pageviews)","desc(comments)"]}'), + ], + ]); + } + + #[TestDox('customRanking applying search parameters for a specific query')] + public function testSetSettings31(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(nb_airline_liaisons)', + ], + 'attributesForFaceting' => [ + 'city, country', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}'), + ], + ]); + } + + #[TestDox('customRanking rounded pageviews')] + public function testSetSettings32(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(rounded_pageviews)', + + 'desc(comments)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}'), + ], + ]); + } + + #[TestDox('customRanking price')] + public function testSetSettings33(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(price)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(price)"]}'), + ], + ]); + } + + #[TestDox('ranking exhaustive')] + public function testSetSettings34(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['ranking' => [ + 'desc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), + ], + ]); + } + + #[TestDox('ranking standard replica')] + public function testSetSettings35(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['ranking' => [ + 'desc(post_date_timestamp)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"ranking":["desc(post_date_timestamp)"]}'), + ], + ]); + } + + #[TestDox('ranking virtual replica')] + public function testSetSettings36(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'desc(post_date_timestamp)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["desc(post_date_timestamp)"]}'), + ], + ]); + } + + #[TestDox('customRanking and ranking sort alphabetically')] + public function testSetSettings37(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'asc(textual_attribute)', + ], + 'ranking' => [ + 'custom', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}'), + ], + ]); + } + + #[TestDox('relevancyStrictness')] + public function testSetSettings38(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['customRanking' => [ + 'asc(textual_attribute)', + ], + 'relevancyStrictness' => 0, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}'), + ], + ]); + } + + #[TestDox('create replica index')] + public function testSetSettings39(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['replicas' => [ + 'products_price_desc', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"replicas":["products_price_desc"]}'), + ], + ]); + } + + #[TestDox('create replica index articles')] + public function testSetSettings40(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['replicas' => [ + 'articles_date_desc', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"replicas":["articles_date_desc"]}'), + ], + ]); + } + + #[TestDox('create virtual replica index')] + public function testSetSettings41(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['replicas' => [ + 'virtual(products_price_desc)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"replicas":["virtual(products_price_desc)"]}'), + ], + ]); + } + + #[TestDox('unlink replica index')] + public function testSetSettings42(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['replicas' => [ + '', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"replicas":[""]}'), + ], + ]); + } + + #[TestDox('forwardToReplicas')] + public function testSetSettings43(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'name', + + 'description', + ], + ], + true, + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["name","description"]}'), + 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + ], + ]); + } + + #[TestDox('maxValuesPerFacet')] + public function testSetSettings44(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['maxValuesPerFacet' => 1000, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"maxValuesPerFacet":1000}'), + ], + ]); + } + + #[TestDox('maxFacetHits')] + public function testSetSettings45(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['maxFacetHits' => 1000, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"maxFacetHits":1000}'), + ], + ]); + } + + #[TestDox('attributesForFaceting complex')] + public function testSetSettings46(): void + { + $client = $this->getClient(); + $client->setSettings( + '', + ['attributesForFaceting' => [ + 'actor', + + 'filterOnly(category)', + + 'searchable(publisher)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}'), + ], + ]); + } + + #[TestDox('ranking closest dates')] + public function testSetSettings47(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['ranking' => [ + 'asc(date_timestamp)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), + ], + ]); + } + + #[TestDox('searchableAttributes item variation')] + public function testSetSettings48(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'design', + + 'type', + + 'color', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["design","type","color"]}'), + ], + ]); + } + + #[TestDox('searchableAttributes around location')] + public function testSetSettings49(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'name', + + 'country', + + 'code', + + 'iata_code', + ], + 'customRanking' => [ + 'desc(links_count)', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}'), + ], + ]); + } + + #[TestDox('attributesToHighlight')] + public function testSetSettings50(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributesToHighlight' => [ + 'author', + + 'title', + + 'content', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesToHighlight":["author","title","content"]}'), + ], + ]); + } + + #[TestDox('attributesToHighlightStar')] + public function testSetSettings51(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributesToHighlight' => [ + '*', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesToHighlight":["*"]}'), + ], + ]); + } + + #[TestDox('everything')] + public function testSetSettings52(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['advancedSyntax' => true, + 'advancedSyntaxFeatures' => [ + 'exactPhrase', + ], + 'allowCompressionOfIntegerArray' => true, + 'allowTyposOnNumericTokens' => true, + 'alternativesAsExact' => [ + 'singleWordSynonym', + ], + 'attributeCriteriaComputedByMinProximity' => true, + 'attributeForDistinct' => 'test', + 'attributesForFaceting' => [ + 'algolia', + ], + 'attributesToHighlight' => [ + 'algolia', + ], + 'attributesToRetrieve' => [ + 'algolia', + ], + 'attributesToSnippet' => [ + 'algolia', + ], + 'attributesToTransliterate' => [ + 'algolia', + ], + 'camelCaseAttributes' => [ + 'algolia', + ], + 'customNormalization' => ['algolia' => ['aloglia' => 'aglolia', + ], + ], + 'customRanking' => [ + 'algolia', + ], + 'decompoundQuery' => false, + 'decompoundedAttributes' => ['algolia' => 'aloglia', + ], + 'disableExactOnAttributes' => [ + 'algolia', + ], + 'disablePrefixOnAttributes' => [ + 'algolia', + ], + 'disableTypoToleranceOnAttributes' => [ + 'algolia', + ], + 'disableTypoToleranceOnWords' => [ + 'algolia', + ], + 'distinct' => 3, + 'enablePersonalization' => true, + 'enableReRanking' => false, + 'enableRules' => true, + 'exactOnSingleWordQuery' => 'attribute', + 'highlightPreTag' => '', + 'highlightPostTag' => '', + 'hitsPerPage' => 10, + 'ignorePlurals' => false, + 'indexLanguages' => [ + 'fr', + ], + 'keepDiacriticsOnCharacters' => 'abc', + 'maxFacetHits' => 20, + 'maxValuesPerFacet' => 30, + 'minProximity' => 6, + 'minWordSizefor1Typo' => 5, + 'minWordSizefor2Typos' => 11, + 'mode' => 'neuralSearch', + 'numericAttributesForFiltering' => [ + 'algolia', + ], + 'optionalWords' => [ + 'myspace', + ], + 'paginationLimitedTo' => 0, + 'queryLanguages' => [ + 'fr', + ], + 'queryType' => 'prefixLast', + 'ranking' => [ + 'geo', + ], + 'reRankingApplyFilter' => 'mySearch:filters', + 'relevancyStrictness' => 10, + 'removeStopWords' => false, + 'removeWordsIfNoResults' => 'lastWords', + 'renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ + 'a', + + 'b', + ], + ], + 'values' => ['a' => ['order' => [ + 'b', + ], + 'sortRemainingBy' => 'count', + ], + ], + ], + ], + 'replaceSynonymsInHighlight' => true, + 'replicas' => [ + '', + ], + 'responseFields' => [ + 'algolia', + ], + 'restrictHighlightAndSnippetArrays' => true, + 'searchableAttributes' => [ + 'foo', + ], + 'semanticSearch' => ['eventSources' => [ + 'foo', + ], + ], + 'separatorsToIndex' => 'bar', + 'snippetEllipsisText' => '---', + 'sortFacetValuesBy' => 'date', + 'typoTolerance' => false, + 'unretrievableAttributes' => [ + 'foo', + ], + 'userData' => ['user' => 'data', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}'), + ], + ]); + } + + #[TestDox('searchableAttributesWithCustomRankingsAndAttributesForFaceting')] + public function testSetSettings53(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'brand', + + 'name', + + 'categories', + + 'unordered(description)', + ], + 'customRanking' => [ + 'desc(popularity)', + ], + 'attributesForFaceting' => [ + 'searchable(brand)', + + 'type', + + 'categories', + + 'price', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}'), + ], + ]); + } + + #[TestDox('searchableAttributesOrdering')] + public function testSetSettings54(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'unordered(title)', + + 'cast', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["unordered(title)","cast"]}'), + ], + ]); + } + + #[TestDox('searchableAttributesProductReferenceSuffixes')] + public function testSetSettings55(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'name', + + 'product_reference', + + 'product_reference_suffixes', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}'), + ], + ]); + } + + #[TestDox('queryLanguageAndIgnorePlurals')] + public function testSetSettings56(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['queryLanguages' => [ + 'en', + ], + 'ignorePlurals' => true, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"queryLanguages":["en"],"ignorePlurals":true}'), + ], + ]); + } + + #[TestDox('searchableAttributesInMovies')] + public function testSetSettings57(): void + { + $client = $this->getClient(); + $client->setSettings( + 'movies', + ['searchableAttributes' => [ + 'title_eng', + + 'title_fr', + + 'title_es', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/movies/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["title_eng","title_fr","title_es"]}'), + ], + ]); + } + + #[TestDox('disablePrefixOnAttributes')] + public function testSetSettings58(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['disablePrefixOnAttributes' => [ + 'serial_number', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"disablePrefixOnAttributes":["serial_number"]}'), + ], + ]); + } + + #[TestDox('disableTypoToleranceOnAttributes')] + public function testSetSettings59(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['disableTypoToleranceOnAttributes' => [ + 'serial_number', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"disableTypoToleranceOnAttributes":["serial_number"]}'), + ], + ]); + } + + #[TestDox('searchableAttributesSimpleExample')] + public function testSetSettings60(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'serial_number', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["serial_number"]}'), + ], + ]); + } + + #[TestDox('searchableAttributesSimpleExampleAlt')] + public function testSetSettings61(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'serial_number', + + 'serial_number_suffixes', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["serial_number","serial_number_suffixes"]}'), + ], + ]); + } + + #[TestDox('set_searchable_attributes')] + public function testSetSettings62(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['searchableAttributes' => [ + 'title,alternative_title', + + 'author', + + 'unordered(text)', + + 'emails.personal', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}'), + ], + ]); + } + + #[TestDox('set_searchable_attributes')] + public function testSetSettings63(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributesForFaceting' => [ + 'author', + + 'filterOnly(isbn)', + + 'searchable(edition)', + + 'afterDistinct(category)', + + 'afterDistinct(searchable(publisher))', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}'), + ], + ]); + } + + #[TestDox('unretrievable_attributes')] + public function testSetSettings64(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['unretrievableAttributes' => [ + 'total_number_of_sales', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"unretrievableAttributes":["total_number_of_sales"]}'), + ], + ]); + } + + #[TestDox('set_retrievable_attributes')] + public function testSetSettings65(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributesToRetrieve' => [ + 'author', + + 'title', + + 'content', + ], + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"attributesToRetrieve":["author","title","content"]}'), + ], + ]); + } + + #[TestDox('set_all_attributes_as_retrievable')] + public function testSetSettings66(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['attributesToRetrieve' => [ + '*', + ], ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"ignorePlurals":true}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"attributesToRetrieve":["*"]}'), ], ]); } - #[TestDox('list of string ignorePlurals')] - public function testSetSettings4(): void + #[TestDox('specify_attributes_not_to_retrieve')] + public function testSetSettings67(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['ignorePlurals' => [ - 'fr', + ['attributesToRetrieve' => [ + '*', + + '-SKU', + + '-internal_desc', ], ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"ignorePlurals":["fr"]}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"attributesToRetrieve":["*","-SKU","-internal_desc"]}'), ], ]); } - #[TestDox('removeStopWords boolean')] - public function testSetSettings5(): void + #[TestDox('neural_search')] + public function testSetSettings68(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['removeStopWords' => true, + ['mode' => 'neuralSearch', ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"removeStopWords":true}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"mode":"neuralSearch"}'), ], ]); } - #[TestDox('removeStopWords list of string')] - public function testSetSettings6(): void + #[TestDox('keyword_search')] + public function testSetSettings69(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['removeStopWords' => [ - 'fr', - ], + ['mode' => 'keywordSearch', ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"removeStopWords":["fr"]}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"mode":"keywordSearch"}'), ], ]); } - #[TestDox('boolean distinct')] - public function testSetSettings7(): void + #[TestDox('set_default_ranking')] + public function testSetSettings70(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['distinct' => true, + ['ranking' => [ + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'attribute', + + 'proximity', + + 'exact', + + 'custom', + ], ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"distinct":true}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}'), ], ]); } - #[TestDox('integer distinct')] - public function testSetSettings8(): void + #[TestDox('set_ranking_by_attribute_asc')] + public function testSetSettings71(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['distinct' => 1, + ['ranking' => [ + 'asc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"distinct":1}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), ], ]); } - #[TestDox('distinct company')] - public function testSetSettings9(): void + #[TestDox('set_ranking_by_attribute_desc')] + public function testSetSettings72(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['attributeForDistinct' => 'company', - 'distinct' => true, + ['ranking' => [ + 'desc(price)', + + 'typo', + + 'geo', + + 'words', + + 'filters', + + 'proximity', + + 'attribute', + + 'exact', + + 'custom', + ], ], ); @@ -4691,19 +8321,22 @@ public function testSetSettings9(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributeForDistinct":"company","distinct":true}'), + 'body' => json_decode('{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), ], ]); } - #[TestDox('distinct design')] - public function testSetSettings10(): void + #[TestDox('restrict_searchable_attributes')] + public function testSetSettings73(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['attributeForDistinct' => 'design', - 'distinct' => true, + ['customRanking' => [ + 'desc(popularity)', + + 'asc(price)', + ], ], ); @@ -4711,18 +8344,18 @@ public function testSetSettings10(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributeForDistinct":"design","distinct":true}'), + 'body' => json_decode('{"customRanking":["desc(popularity)","asc(price)"]}'), ], ]); } - #[TestDox('distinct true')] - public function testSetSettings11(): void + #[TestDox('set_default_relevancy')] + public function testSetSettings74(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['distinct' => true, + ['relevancyStrictness' => 90, ], ); @@ -4730,19 +8363,22 @@ public function testSetSettings11(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"distinct":true}'), + 'body' => json_decode('{"relevancyStrictness":90}'), ], ]); } - #[TestDox('distinct section')] - public function testSetSettings12(): void + #[TestDox('set_replicas')] + public function testSetSettings75(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['attributeForDistinct' => 'section', - 'distinct' => true, + ['replicas' => [ + 'name_of_replica_index1', + + 'name_of_replica_index2', + ], ], ); @@ -4750,188 +8386,271 @@ public function testSetSettings12(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributeForDistinct":"section","distinct":true}'), + 'body' => json_decode('{"replicas":["name_of_replica_index1","name_of_replica_index2"]}'), ], ]); } - #[TestDox('attributesForFaceting allergens')] - public function testSetSettings13(): void + #[TestDox('set_default_max_values_per_facet')] + public function testSetSettings76(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'allergens', + 'theIndexName', + ['maxValuesPerFacet' => 100, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"maxValuesPerFacet":100}'), ], + ]); + } + + #[TestDox('set_default_sort_facet_values_by')] + public function testSetSettings77(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['sortFacetValuesBy' => 'alpha', ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["allergens"]}'), + 'body' => json_decode('{"sortFacetValuesBy":"alpha"}'), ], ]); } - #[TestDox('attributesForFaceting categoryPageId')] - public function testSetSettings14(): void + #[TestDox('set_attributes_to_snippet')] + public function testSetSettings78(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'searchable(categoryPageId)', + 'theIndexName', + ['attributesToSnippet' => [ + 'content:80', + + 'description', ], ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["searchable(categoryPageId)"]}'), + 'body' => json_decode('{"attributesToSnippet":["content:80","description"]}'), ], ]); } - #[TestDox('unretrievableAttributes')] - public function testSetSettings15(): void + #[TestDox('set_all_attributes_to_snippet')] + public function testSetSettings79(): void { $client = $this->getClient(); $client->setSettings( - '', - ['unretrievableAttributes' => [ - 'visible_by', + 'theIndexName', + ['attributesToSnippet' => [ + '*:80', ], ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"unretrievableAttributes":["visible_by"]}'), + 'body' => json_decode('{"attributesToSnippet":["*:80"]}'), ], ]); } - #[TestDox('attributesForFaceting user restricted data')] - public function testSetSettings16(): void + #[TestDox('set_default_highlight_pre_tag')] + public function testSetSettings80(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'filterOnly(visible_by)', + 'theIndexName', + ['highlightPreTag' => '', + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"highlightPreTag":""}'), ], + ]); + } + + #[TestDox('set_default_highlight_post_tag')] + public function testSetSettings81(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['highlightPostTag' => '', ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["filterOnly(visible_by)"]}'), + 'body' => json_decode('{"highlightPostTag":""}'), ], ]); } - #[TestDox('attributesForFaceting optional filters')] - public function testSetSettings17(): void + #[TestDox('set_default_snippet_ellipsis_text')] + public function testSetSettings82(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'can_deliver_quickly', + 'theIndexName', + ['snippetEllipsisText' => '…', + ], + ); - 'restaurant', + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"snippetEllipsisText":"…"}'), ], + ]); + } + + #[TestDox('enable_restrict_highlight_and_snippet_arrays_by_default')] + public function testSetSettings83(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['restrictHighlightAndSnippetArrays' => true, ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["can_deliver_quickly","restaurant"]}'), + 'body' => json_decode('{"restrictHighlightAndSnippetArrays":true}'), ], ]); } - #[TestDox('attributesForFaceting redirect index')] - public function testSetSettings18(): void + #[TestDox('set_default_hits_per_page')] + public function testSetSettings84(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['hitsPerPage' => 20, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"hitsPerPage":20}'), + ], + ]); + } + + #[TestDox('set_pagination_limit')] + public function testSetSettings85(): void + { + $client = $this->getClient(); + $client->setSettings( + 'theIndexName', + ['paginationLimitedTo' => 1000, + ], + ); + + $this->assertRequests([ + [ + 'path' => '/1/indexes/theIndexName/settings', + 'method' => 'PUT', + 'body' => json_decode('{"paginationLimitedTo":1000}'), + ], + ]); + } + + #[TestDox('set_default_min_word_size_for_one_typo')] + public function testSetSettings86(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'query_terms', - ], + 'theIndexName', + ['minWordSizefor1Typo' => 4, ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["query_terms"]}'), + 'body' => json_decode('{"minWordSizefor1Typo":4}'), ], ]); } - #[TestDox('attributesForFaceting multiple consequences')] - public function testSetSettings19(): void + #[TestDox('set_default_min_word_size_for_two_typos')] + public function testSetSettings87(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'director', - ], + 'theIndexName', + ['minWordSizefor2Typos' => 4, ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["director"]}'), + 'body' => json_decode('{"minWordSizefor2Typos":4}'), ], ]); } - #[TestDox('attributesForFaceting in-depth optional filters')] - public function testSetSettings20(): void + #[TestDox('set_default_typo_tolerance_mode')] + public function testSetSettings88(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'filterOnly(brand)', - ], + 'theIndexName', + ['typoTolerance' => true, ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["filterOnly(brand)"]}'), + 'body' => json_decode('{"typoTolerance":true}'), ], ]); } - #[TestDox('mode neuralSearch')] - public function testSetSettings21(): void + #[TestDox('disable_typos_on_numeric_tokens_by_default')] + public function testSetSettings89(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['mode' => 'neuralSearch', + ['allowTyposOnNumericTokens' => false, ], ); @@ -4939,18 +8658,22 @@ public function testSetSettings21(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"mode":"neuralSearch"}'), + 'body' => json_decode('{"allowTyposOnNumericTokens":false}'), ], ]); } - #[TestDox('mode keywordSearch')] - public function testSetSettings22(): void + #[TestDox('disable_typo_tolerance_for_words')] + public function testSetSettings90(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['mode' => 'keywordSearch', + ['disableTypoToleranceOnWords' => [ + 'wheel', + + '1X2BCD', + ], ], ); @@ -4958,22 +8681,18 @@ public function testSetSettings22(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"mode":"keywordSearch"}'), + 'body' => json_decode('{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}'), ], ]); } - #[TestDox('searchableAttributes same priority')] - public function testSetSettings23(): void + #[TestDox('set_separators_to_index')] + public function testSetSettings91(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'title,comments', - - 'ingredients', - ], + ['separatorsToIndex' => '+#', ], ); @@ -4981,22 +8700,21 @@ public function testSetSettings23(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["title,comments","ingredients"]}'), + 'body' => json_decode('{"separatorsToIndex":"+#"}'), ], ]); } - #[TestDox('searchableAttributes higher priority')] - public function testSetSettings24(): void + #[TestDox('set_languages_using_querylanguages')] + public function testSetSettings92(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'title', - - 'ingredients', + ['queryLanguages' => [ + 'es', ], + 'ignorePlurals' => true, ], ); @@ -5004,22 +8722,25 @@ public function testSetSettings24(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["title","ingredients"]}'), + 'body' => json_decode('{"queryLanguages":["es"],"ignorePlurals":true}'), ], ]); } - #[TestDox('customRanking retweets')] - public function testSetSettings25(): void + #[TestDox('set_attributes_to_transliterate')] + public function testSetSettings93(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(retweets)', - - 'desc(likes)', + ['indexLanguages' => [ + 'ja', ], + 'attributesToTransliterate' => [ + 'name', + + 'description', + ], ], ); @@ -5027,20 +8748,21 @@ public function testSetSettings25(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(retweets)","desc(likes)"]}'), + 'body' => json_decode('{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}'), ], ]); } - #[TestDox('customRanking boosted')] - public function testSetSettings26(): void + #[TestDox('set_languages_using_querylanguages')] + public function testSetSettings94(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(boosted)', + ['queryLanguages' => [ + 'es', ], + 'removeStopWords' => true, ], ); @@ -5048,21 +8770,19 @@ public function testSetSettings26(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(boosted)"]}'), + 'body' => json_decode('{"queryLanguages":["es"],"removeStopWords":true}'), ], ]); } - #[TestDox('customRanking pageviews')] - public function testSetSettings27(): void + #[TestDox('set_camel_case_attributes')] + public function testSetSettings95(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(pageviews)', - - 'desc(comments)', + ['camelCaseAttributes' => [ + 'description', ], ], ); @@ -5071,23 +8791,21 @@ public function testSetSettings27(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(pageviews)","desc(comments)"]}'), + 'body' => json_decode('{"camelCaseAttributes":["description"]}'), ], ]); } - #[TestDox('customRanking applying search parameters for a specific query')] - public function testSetSettings28(): void + #[TestDox('set_decompounded_attributes')] + public function testSetSettings96(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(nb_airline_liaisons)', + ['decompoundedAttributes' => ['de' => [ + 'name', + ], ], - 'attributesForFaceting' => [ - 'city, country', - ], ], ); @@ -5095,21 +8813,27 @@ public function testSetSettings28(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}'), + 'body' => json_decode('{"decompoundedAttributes":{"de":["name"]}}'), ], ]); } - #[TestDox('customRanking rounded pageviews')] - public function testSetSettings29(): void + #[TestDox('set_decompounded_multiple_attributes')] + public function testSetSettings97(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(rounded_pageviews)', + ['decompoundedAttributes' => ['de' => [ + 'name_de', - 'desc(comments)', + 'description_de', + ], + 'fi' => [ + 'name_fi', + + 'description_fi', + ], ], ], ); @@ -5118,20 +8842,18 @@ public function testSetSettings29(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}'), + 'body' => json_decode('{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}'), ], ]); } - #[TestDox('customRanking price')] - public function testSetSettings30(): void + #[TestDox('set_keep_diacritics_on_characters')] + public function testSetSettings98(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(price)', - ], + ['keepDiacriticsOnCharacters' => 'øé', ], ); @@ -5139,35 +8861,19 @@ public function testSetSettings30(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(price)"]}'), + 'body' => json_decode('{"keepDiacriticsOnCharacters":"øé"}'), ], ]); } - #[TestDox('ranking exhaustive')] - public function testSetSettings31(): void + #[TestDox('set_custom_normalization')] + public function testSetSettings99(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['ranking' => [ - 'desc(price)', - - 'typo', - - 'geo', - - 'words', - - 'filters', - - 'proximity', - - 'attribute', - - 'exact', - - 'custom', + ['customNormalization' => ['default' => ['ä' => 'ae', + ], ], ], ); @@ -5176,20 +8882,22 @@ public function testSetSettings31(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), + 'body' => json_decode('{"customNormalization":{"default":{"ä":"ae"}}}'), ], ]); } - #[TestDox('ranking standard replica')] - public function testSetSettings32(): void + #[TestDox('set_languages_using_querylanguages')] + public function testSetSettings100(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['ranking' => [ - 'desc(post_date_timestamp)', + ['queryLanguages' => [ + 'es', ], + 'removeStopWords' => true, + 'ignorePlurals' => true, ], ); @@ -5197,19 +8905,19 @@ public function testSetSettings32(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"ranking":["desc(post_date_timestamp)"]}'), + 'body' => json_decode('{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}'), ], ]); } - #[TestDox('ranking virtual replica')] - public function testSetSettings33(): void + #[TestDox('set_indexlanguages')] + public function testSetSettings101(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'desc(post_date_timestamp)', + ['indexLanguages' => [ + 'ja', ], ], ); @@ -5218,37 +8926,18 @@ public function testSetSettings33(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["desc(post_date_timestamp)"]}'), + 'body' => json_decode('{"indexLanguages":["ja"]}'), ], ]); } - #[TestDox('customRanking and ranking sort alphabetically')] - public function testSetSettings34(): void + #[TestDox('enable_decompound_query_by_default')] + public function testSetSettings102(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'asc(textual_attribute)', - ], - 'ranking' => [ - 'custom', - - 'typo', - - 'geo', - - 'words', - - 'filters', - - 'proximity', - - 'attribute', - - 'exact', - ], + ['decompoundQuery' => true, ], ); @@ -5256,21 +8945,18 @@ public function testSetSettings34(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}'), + 'body' => json_decode('{"decompoundQuery":true}'), ], ]); } - #[TestDox('relevancyStrictness')] - public function testSetSettings35(): void + #[TestDox('enable_rules_syntax_by_default')] + public function testSetSettings103(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['customRanking' => [ - 'asc(textual_attribute)', - ], - 'relevancyStrictness' => 0, + ['enableRules' => true, ], ); @@ -5278,20 +8964,18 @@ public function testSetSettings35(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}'), + 'body' => json_decode('{"enableRules":true}'), ], ]); } - #[TestDox('create replica index')] - public function testSetSettings36(): void + #[TestDox('enable_personalization_settings')] + public function testSetSettings104(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['replicas' => [ - 'products_price_desc', - ], + ['enablePersonalization' => true, ], ); @@ -5299,20 +8983,18 @@ public function testSetSettings36(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"replicas":["products_price_desc"]}'), + 'body' => json_decode('{"enablePersonalization":true}'), ], ]); } - #[TestDox('create virtual replica index')] - public function testSetSettings37(): void + #[TestDox('set_default_query_type')] + public function testSetSettings105(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['replicas' => [ - 'virtual(products_price_desc)', - ], + ['queryType' => 'prefixLast', ], ); @@ -5320,20 +9002,18 @@ public function testSetSettings37(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"replicas":["virtual(products_price_desc)"]}'), + 'body' => json_decode('{"queryType":"prefixLast"}'), ], ]); } - #[TestDox('unlink replica index')] - public function testSetSettings38(): void + #[TestDox('set_default_remove_words_if_no_result')] + public function testSetSettings106(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['replicas' => [ - '', - ], + ['removeWordsIfNoResults' => 'none', ], ); @@ -5341,43 +9021,41 @@ public function testSetSettings38(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"replicas":[""]}'), + 'body' => json_decode('{"removeWordsIfNoResults":"none"}'), ], ]); } - #[TestDox('forwardToReplicas')] - public function testSetSettings39(): void + #[TestDox('enable_advanced_syntax_by_default')] + public function testSetSettings107(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'name', - - 'description', - ], + ['advancedSyntax' => true, ], - true, ); $this->assertRequests([ [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["name","description"]}'), - 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), + 'body' => json_decode('{"advancedSyntax":true}'), ], ]); } - #[TestDox('maxValuesPerFacet')] - public function testSetSettings40(): void + #[TestDox('set_default_optional_words')] + public function testSetSettings108(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['maxValuesPerFacet' => 1000, + ['optionalWords' => [ + 'blue', + + 'iphone case', + ], ], ); @@ -5385,18 +9063,20 @@ public function testSetSettings40(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"maxValuesPerFacet":1000}'), + 'body' => json_decode('{"optionalWords":["blue","iphone case"]}'), ], ]); } - #[TestDox('maxFacetHits')] - public function testSetSettings41(): void + #[TestDox('disabling_prefix_search_for_some_attributes_by_default')] + public function testSetSettings109(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['maxFacetHits' => 1000, + ['disablePrefixOnAttributes' => [ + 'sku', + ], ], ); @@ -5404,61 +9084,39 @@ public function testSetSettings41(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"maxFacetHits":1000}'), + 'body' => json_decode('{"disablePrefixOnAttributes":["sku"]}'), ], ]); } - #[TestDox('attributesForFaceting complex')] - public function testSetSettings42(): void + #[TestDox('disabling_exact_for_some_attributes_by_default')] + public function testSetSettings110(): void { $client = $this->getClient(); $client->setSettings( - '', - ['attributesForFaceting' => [ - 'actor', - - 'filterOnly(category)', - - 'searchable(publisher)', + 'theIndexName', + ['disableExactOnAttributes' => [ + 'description', ], ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/%3CYOUR_INDEX_NAME%3E/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}'), + 'body' => json_decode('{"disableExactOnAttributes":["description"]}'), ], ]); } - #[TestDox('ranking closest dates')] - public function testSetSettings43(): void + #[TestDox('set_default_exact_single_word_query')] + public function testSetSettings111(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['ranking' => [ - 'asc(date_timestamp)', - - 'typo', - - 'geo', - - 'words', - - 'filters', - - 'proximity', - - 'attribute', - - 'exact', - - 'custom', - ], + ['exactOnSingleWordQuery' => 'attribute', ], ); @@ -5466,23 +9124,21 @@ public function testSetSettings43(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}'), + 'body' => json_decode('{"exactOnSingleWordQuery":"attribute"}'), ], ]); } - #[TestDox('searchableAttributes item variation')] - public function testSetSettings44(): void + #[TestDox('set_default_aternative_as_exact')] + public function testSetSettings112(): void { $client = $this->getClient(); $client->setSettings( - 'theIndexName', - ['searchableAttributes' => [ - 'design', - - 'type', + 'theIndexName', + ['alternativesAsExact' => [ + 'ignorePlurals', - 'color', + 'singleWordSynonym', ], ], ); @@ -5491,29 +9147,18 @@ public function testSetSettings44(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["design","type","color"]}'), + 'body' => json_decode('{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}'), ], ]); } - #[TestDox('searchableAttributes around location')] - public function testSetSettings45(): void + #[TestDox('enable_advanced_syntax_by_default')] + public function testSetSettings113(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'name', - - 'country', - - 'code', - - 'iata_code', - ], - 'customRanking' => [ - 'desc(links_count)', - ], + ['advancedSyntax' => true, ], ); @@ -5521,29 +9166,22 @@ public function testSetSettings45(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}'), + 'body' => json_decode('{"advancedSyntax":true}'), ], ]); } - #[TestDox('searchableAttributes around location')] - public function testSetSettings46(): void + #[TestDox('set_numeric_attributes_for_filtering')] + public function testSetSettings114(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'name', - - 'country', - - 'code', + ['numericAttributesForFiltering' => [ + 'quantity', - 'iata_code', + 'popularity', ], - 'customRanking' => [ - 'desc(links_count)', - ], ], ); @@ -5551,20 +9189,18 @@ public function testSetSettings46(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}'), + 'body' => json_decode('{"numericAttributesForFiltering":["quantity","popularity"]}'), ], ]); } - #[TestDox('disableTypoToleranceOnAttributes')] - public function testSetSettings47(): void + #[TestDox('enable_compression_of_integer_array')] + public function testSetSettings115(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['disableTypoToleranceOnAttributes' => [ - 'serial_number', - ], + ['allowCompressionOfIntegerArray' => true, ], ); @@ -5572,142 +9208,18 @@ public function testSetSettings47(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"disableTypoToleranceOnAttributes":["serial_number"]}'), + 'body' => json_decode('{"allowCompressionOfIntegerArray":true}'), ], ]); } - #[TestDox('everything')] - public function testSetSettings48(): void + #[TestDox('set_attributes_for_distinct')] + public function testSetSettings116(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['advancedSyntax' => true, - 'advancedSyntaxFeatures' => [ - 'exactPhrase', - ], - 'allowCompressionOfIntegerArray' => true, - 'allowTyposOnNumericTokens' => true, - 'alternativesAsExact' => [ - 'singleWordSynonym', - ], - 'attributeCriteriaComputedByMinProximity' => true, - 'attributeForDistinct' => 'test', - 'attributesForFaceting' => [ - 'algolia', - ], - 'attributesToHighlight' => [ - 'algolia', - ], - 'attributesToRetrieve' => [ - 'algolia', - ], - 'attributesToSnippet' => [ - 'algolia', - ], - 'attributesToTransliterate' => [ - 'algolia', - ], - 'camelCaseAttributes' => [ - 'algolia', - ], - 'customNormalization' => ['algolia' => ['aloglia' => 'aglolia', - ], - ], - 'customRanking' => [ - 'algolia', - ], - 'decompoundQuery' => false, - 'decompoundedAttributes' => ['algolia' => 'aloglia', - ], - 'disableExactOnAttributes' => [ - 'algolia', - ], - 'disablePrefixOnAttributes' => [ - 'algolia', - ], - 'disableTypoToleranceOnAttributes' => [ - 'algolia', - ], - 'disableTypoToleranceOnWords' => [ - 'algolia', - ], - 'distinct' => 3, - 'enablePersonalization' => true, - 'enableReRanking' => false, - 'enableRules' => true, - 'exactOnSingleWordQuery' => 'attribute', - 'highlightPreTag' => '', - 'highlightPostTag' => '', - 'hitsPerPage' => 10, - 'ignorePlurals' => false, - 'indexLanguages' => [ - 'fr', - ], - 'keepDiacriticsOnCharacters' => 'abc', - 'maxFacetHits' => 20, - 'maxValuesPerFacet' => 30, - 'minProximity' => 6, - 'minWordSizefor1Typo' => 5, - 'minWordSizefor2Typos' => 11, - 'mode' => 'neuralSearch', - 'numericAttributesForFiltering' => [ - 'algolia', - ], - 'optionalWords' => [ - 'myspace', - ], - 'paginationLimitedTo' => 0, - 'queryLanguages' => [ - 'fr', - ], - 'queryType' => 'prefixLast', - 'ranking' => [ - 'geo', - ], - 'reRankingApplyFilter' => 'mySearch:filters', - 'relevancyStrictness' => 10, - 'removeStopWords' => false, - 'removeWordsIfNoResults' => 'lastWords', - 'renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ - 'a', - - 'b', - ], - ], - 'values' => ['a' => ['order' => [ - 'b', - ], - 'sortRemainingBy' => 'count', - ], - ], - ], - ], - 'replaceSynonymsInHighlight' => true, - 'replicas' => [ - '', - ], - 'responseFields' => [ - 'algolia', - ], - 'restrictHighlightAndSnippetArrays' => true, - 'searchableAttributes' => [ - 'foo', - ], - 'semanticSearch' => ['eventSources' => [ - 'foo', - ], - ], - 'separatorsToIndex' => 'bar', - 'snippetEllipsisText' => '---', - 'sortFacetValuesBy' => 'date', - 'typoTolerance' => false, - 'unretrievableAttributes' => [ - 'foo', - ], - 'userData' => ['user' => 'data', - ], + ['attributeForDistinct' => 'url', ], ); @@ -5715,38 +9227,19 @@ public function testSetSettings48(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}'), + 'body' => json_decode('{"attributeForDistinct":"url"}'), ], ]); } - #[TestDox('searchableAttributesWithCustomRankingsAndAttributesForFaceting')] - public function testSetSettings49(): void + #[TestDox('set_distinct')] + public function testSetSettings117(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'brand', - - 'name', - - 'categories', - - 'unordered(description)', - ], - 'customRanking' => [ - 'desc(popularity)', - ], - 'attributesForFaceting' => [ - 'searchable(brand)', - - 'type', - - 'categories', - - 'price', - ], + ['distinct' => 1, + 'attributeForDistinct' => 'url', ], ); @@ -5754,24 +9247,18 @@ public function testSetSettings49(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}'), + 'body' => json_decode('{"distinct":1,"attributeForDistinct":"url"}'), ], ]); } - #[TestDox('searchableAttributesProductReferenceSuffixes')] - public function testSetSettings50(): void + #[TestDox('set_replace_synonyms_in_highlights')] + public function testSetSettings118(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'name', - - 'product_reference', - - 'product_reference_suffixes', - ], + ['replaceSynonymsInHighlight' => false, ], ); @@ -5779,21 +9266,18 @@ public function testSetSettings50(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}'), + 'body' => json_decode('{"replaceSynonymsInHighlight":false}'), ], ]); } - #[TestDox('queryLanguageAndIgnorePlurals')] - public function testSetSettings51(): void + #[TestDox('set_min_proximity')] + public function testSetSettings119(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['queryLanguages' => [ - 'en', - ], - 'ignorePlurals' => true, + ['minProximity' => 1, ], ); @@ -5801,45 +9285,45 @@ public function testSetSettings51(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"queryLanguages":["en"],"ignorePlurals":true}'), + 'body' => json_decode('{"minProximity":1}'), ], ]); } - #[TestDox('searchableAttributesInMovies')] - public function testSetSettings52(): void + #[TestDox('set_default_field')] + public function testSetSettings120(): void { $client = $this->getClient(); $client->setSettings( - 'movies', - ['searchableAttributes' => [ - 'title_eng', + 'theIndexName', + ['responseFields' => [ + 'hits', - 'title_fr', + 'hitsPerPage', - 'title_es', + 'nbPages', + + 'page', ], ], ); $this->assertRequests([ [ - 'path' => '/1/indexes/movies/settings', + 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["title_eng","title_fr","title_es"]}'), + 'body' => json_decode('{"responseFields":["hits","hitsPerPage","nbPages","page"]}'), ], ]); } - #[TestDox('disablePrefixOnAttributes')] - public function testSetSettings53(): void + #[TestDox('set_max_facet_hits')] + public function testSetSettings121(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['disablePrefixOnAttributes' => [ - 'serial_number', - ], + ['maxFacetHits' => 10, ], ); @@ -5847,20 +9331,18 @@ public function testSetSettings53(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"disablePrefixOnAttributes":["serial_number"]}'), + 'body' => json_decode('{"maxFacetHits":10}'), ], ]); } - #[TestDox('disableTypoToleranceOnAttributes')] - public function testSetSettings54(): void + #[TestDox('set_attribute_criteria_computed_by_min_proximity')] + public function testSetSettings122(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['disableTypoToleranceOnAttributes' => [ - 'serial_number', - ], + ['attributeCriteriaComputedByMinProximity' => true, ], ); @@ -5868,19 +9350,18 @@ public function testSetSettings54(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"disableTypoToleranceOnAttributes":["serial_number"]}'), + 'body' => json_decode('{"attributeCriteriaComputedByMinProximity":true}'), ], ]); } - #[TestDox('searchableAttributesSimpleExample')] - public function testSetSettings55(): void + #[TestDox('set_user_data')] + public function testSetSettings123(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'serial_number', + ['userData' => ['extraData' => 'This is the custom data that you want to store in your index', ], ], ); @@ -5889,21 +9370,42 @@ public function testSetSettings55(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["serial_number"]}'), + 'body' => json_decode('{"userData":{"extraData":"This is the custom data that you want to store in your index"}}'), ], ]); } - #[TestDox('searchableAttributesSimpleExampleAlt')] - public function testSetSettings56(): void + #[TestDox('set_rendering_content')] + public function testSetSettings124(): void { $client = $this->getClient(); $client->setSettings( 'theIndexName', - ['searchableAttributes' => [ - 'serial_number', + ['renderingContent' => ['facetOrdering' => ['facets' => ['order' => [ + 'size', - 'serial_number_suffixes', + 'brand', + ], + ], + 'values' => ['brand' => ['order' => [ + 'uniqlo', + ], + 'hide' => [ + 'muji', + ], + 'sortRemainingBy' => 'count', + ], + 'size' => ['order' => [ + 'S', + + 'M', + + 'L', + ], + 'sortRemainingBy' => 'hidden', + ], + ], + ], ], ], ); @@ -5912,7 +9414,7 @@ public function testSetSettings56(): void [ 'path' => '/1/indexes/theIndexName/settings', 'method' => 'PUT', - 'body' => json_decode('{"searchableAttributes":["serial_number","serial_number_suffixes"]}'), + 'body' => json_decode('{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}'), ], ]); } diff --git a/tests/output/python/tests/requests/search_test.py b/tests/output/python/tests/requests/search_test.py index 1dc9b6d591..a7c5a95663 100644 --- a/tests/output/python/tests/requests/search_test.py +++ b/tests/output/python/tests/requests/search_test.py @@ -3742,6 +3742,102 @@ async def test_search_single_index_13(self): ) async def test_search_single_index_14(self): + """ + facetFiltersBook + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["category:Book"]}""" + ) + + async def test_search_single_index_15(self): + """ + facetFiltersAND + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + "author:John Doe", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["category:Book","author:John Doe"]}""" + ) + + async def test_search_single_index_16(self): + """ + facetFiltersOR + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + [ + "category:Book", + "author:John Doe", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}""" + ) + + async def test_search_single_index_17(self): + """ + facetFiltersCombined + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "author:John Doe", + [ + "category:Book", + "category:Movie", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}""" + ) + + async def test_search_single_index_18(self): """ facetFiltersNeg """ @@ -3758,7 +3854,7 @@ async def test_search_single_index_14(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"facetFilters":"category:-Ebook"}""") - async def test_search_single_index_15(self): + async def test_search_single_index_19(self): """ filtersAndFacetFilters """ @@ -3780,7 +3876,7 @@ async def test_search_single_index_15(self): """{"filters":"(author:\\"Stephen King\\" OR genre:\\"Horror\\")","facetFilters":["publisher:Penguin"]}""" ) - async def test_search_single_index_16(self): + async def test_search_single_index_20(self): """ facet author genre """ @@ -3800,7 +3896,7 @@ async def test_search_single_index_16(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"facets":["author","genre"]}""") - async def test_search_single_index_17(self): + async def test_search_single_index_21(self): """ facet wildcard """ @@ -3819,7 +3915,7 @@ async def test_search_single_index_17(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"facets":["*"]}""") - async def test_search_single_index_18(self): + async def test_search_single_index_22(self): """ maxValuesPerFacet """ @@ -3836,7 +3932,7 @@ async def test_search_single_index_18(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") - async def test_search_single_index_19(self): + async def test_search_single_index_23(self): """ aroundLatLng """ @@ -3853,7 +3949,7 @@ async def test_search_single_index_19(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"aroundLatLng":"40.71, -74.01"}""") - async def test_search_single_index_20(self): + async def test_search_single_index_24(self): """ aroundLatLngViaIP """ @@ -3870,7 +3966,7 @@ async def test_search_single_index_20(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"aroundLatLngViaIP":true}""") - async def test_search_single_index_21(self): + async def test_search_single_index_25(self): """ aroundRadius """ @@ -3890,7 +3986,7 @@ async def test_search_single_index_21(self): """{"aroundLatLng":"40.71, -74.01","aroundRadius":1000000}""" ) - async def test_search_single_index_22(self): + async def test_search_single_index_26(self): """ insideBoundingBox """ @@ -3916,7 +4012,7 @@ async def test_search_single_index_22(self): """{"insideBoundingBox":[[49.067996905313834,65.73828125,25.905859247243498,128.8046875]]}""" ) - async def test_search_single_index_23(self): + async def test_search_single_index_27(self): """ insidePolygon """ @@ -3950,7 +4046,7 @@ async def test_search_single_index_23(self): """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" ) - async def test_search_single_index_24(self): + async def test_search_single_index_28(self): """ insidePolygon """ @@ -3984,7 +4080,7 @@ async def test_search_single_index_24(self): """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" ) - async def test_search_single_index_25(self): + async def test_search_single_index_29(self): """ optionalFilters """ @@ -4005,7 +4101,7 @@ async def test_search_single_index_25(self): """{"optionalFilters":["can_deliver_quickly:true"]}""" ) - async def test_search_single_index_26(self): + async def test_search_single_index_30(self): """ optionalFiltersMany """ @@ -4028,7 +4124,7 @@ async def test_search_single_index_26(self): """{"optionalFilters":["brand:Apple","brand:Samsung","brand:-Huawei"]}""" ) - async def test_search_single_index_27(self): + async def test_search_single_index_31(self): """ optionalFiltersSimple """ @@ -4050,7 +4146,7 @@ async def test_search_single_index_27(self): """{"optionalFilters":["brand:Apple","type:tablet"]}""" ) - async def test_search_single_index_28(self): + async def test_search_single_index_32(self): """ restrictSearchableAttributes """ @@ -4071,7 +4167,7 @@ async def test_search_single_index_28(self): """{"restrictSearchableAttributes":["title_fr"]}""" ) - async def test_search_single_index_29(self): + async def test_search_single_index_33(self): """ getRankingInfo """ @@ -4088,7 +4184,7 @@ async def test_search_single_index_29(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"getRankingInfo":true}""") - async def test_search_single_index_30(self): + async def test_search_single_index_34(self): """ clickAnalytics """ @@ -4105,7 +4201,7 @@ async def test_search_single_index_30(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"clickAnalytics":true}""") - async def test_search_single_index_31(self): + async def test_search_single_index_35(self): """ clickAnalyticsUserToken """ @@ -4125,7 +4221,7 @@ async def test_search_single_index_31(self): """{"clickAnalytics":true,"userToken":"user-1"}""" ) - async def test_search_single_index_32(self): + async def test_search_single_index_36(self): """ enablePersonalization """ @@ -4145,7 +4241,7 @@ async def test_search_single_index_32(self): """{"enablePersonalization":true,"userToken":"user-1"}""" ) - async def test_search_single_index_33(self): + async def test_search_single_index_37(self): """ userToken """ @@ -4162,7 +4258,27 @@ async def test_search_single_index_33(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"userToken":"user-1"}""") - async def test_search_single_index_34(self): + async def test_search_single_index_38(self): + """ + userToken1234 + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "userToken": "user-1234", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","userToken":"user-1234"}""" + ) + + async def test_search_single_index_39(self): """ analyticsTag """ @@ -4181,7 +4297,7 @@ async def test_search_single_index_34(self): assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"analyticsTags":["YOUR_ANALYTICS_TAG"]}""") - async def test_search_single_index_35(self): + async def test_search_single_index_40(self): """ facetFiltersUsers """ @@ -4203,7 +4319,7 @@ async def test_search_single_index_35(self): """{"facetFilters":["user:user42","user:public"]}""" ) - async def test_search_single_index_36(self): + async def test_search_single_index_41(self): """ buildTheQuery """ @@ -4226,4673 +4342,7847 @@ async def test_search_single_index_36(self): """{"filters":"categoryPageId: Men's Clothing","hitsPerPage":50,"analyticsTags":["mens-clothing"]}""" ) - async def test_search_synonyms_(self): + async def test_search_single_index_42(self): """ - searchSynonyms with minimal parameters + attributesToHighlightOverride """ - _req = await self._client.search_synonyms_with_http_info( + _req = await self._client.search_single_index_with_http_info( index_name="indexName", + search_params={ + "query": "query", + "attributesToHighlight": [ + "title", + "content", + ], + }, ) - assert _req.path == "/1/indexes/indexName/synonyms/search" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads( + """{"query":"query","attributesToHighlight":["title","content"]}""" + ) - async def test_search_synonyms_1(self): + async def test_search_single_index_43(self): """ - searchSynonyms with all parameters + disableTypoToleranceOnAttributes """ - _req = await self._client.search_synonyms_with_http_info( + _req = await self._client.search_single_index_with_http_info( index_name="indexName", - search_synonyms_params={ - "query": "myQuery", - "type": "altcorrection1", - "page": 10, - "hitsPerPage": 10, + search_params={ + "query": "query", + "disableTypoToleranceOnAttributes": [ + "serial_number", + ], }, ) - assert _req.path == "/1/indexes/indexName/synonyms/search" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""" + """{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}""" ) - async def test_search_user_ids_(self): + async def test_search_single_index_44(self): """ - searchUserIds + search_a_query """ - _req = await self._client.search_user_ids_with_http_info( - search_user_ids_params={ - "query": "test", - "clusterName": "theClusterName", - "page": 5, - "hitsPerPage": 10, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "shirt", }, ) - assert _req.path == "/1/clusters/mapping/search" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""" - ) + assert loads(_req.data) == loads("""{"query":"shirt"}""") - async def test_set_dictionary_settings_(self): + async def test_search_single_index_45(self): """ - get setDictionarySettings results with minimal parameters + search_everything """ - _req = await self._client.set_dictionary_settings_with_http_info( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - }, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", }, ) - assert _req.path == "/1/dictionaries/*/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""" - ) + assert loads(_req.data) == loads("""{"query":""}""") - async def test_set_dictionary_settings_1(self): + async def test_search_single_index_46(self): """ - get setDictionarySettings results with all parameters + api_filtering_range_example """ - _req = await self._client.set_dictionary_settings_with_http_info( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - "stopwords": { - "fr": False, - }, - "compounds": { - "ru": True, - }, - }, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "books", + "filters": "price:10 TO 20", }, ) - assert _req.path == "/1/dictionaries/*/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" + """{"query":"books","filters":"price:10 TO 20"}""" ) - async def test_set_settings_(self): + async def test_search_single_index_47(self): """ - minimal parameters + search_a_query """ - _req = await self._client.set_settings_with_http_info( - index_name="cts_e2e_settings", - index_settings={ - "paginationLimitedTo": 10, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "similarQuery": "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + "filters": "year:1991 TO 2001", }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/cts_e2e_settings/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"paginationLimitedTo":10}""") + assert loads(_req.data) == loads( + """{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}""" + ) - async def test_set_settings_1(self): + async def test_search_single_index_48(self): """ - boolean typoTolerance + override_retrievable_attributes """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "typoTolerance": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "attributesToRetrieve": [ + "title", + "content", + ], }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"typoTolerance":true}""") + assert loads(_req.data) == loads( + """{"query":"query","attributesToRetrieve":["title","content"]}""" + ) - async def test_set_settings_2(self): + async def test_search_single_index_49(self): """ - enum typoTolerance + restrict_searchable_attributes """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "typoTolerance": "min", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "restrictSearchableAttributes": [ + "title", + "author", + ], }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"typoTolerance":"min"}""") + assert loads(_req.data) == loads( + """{"query":"query","restrictSearchableAttributes":["title","author"]}""" + ) - async def test_set_settings_3(self): + async def test_search_single_index_50(self): """ - ignorePlurals + override_default_relevancy """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "ignorePlurals": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "relevancyStrictness": 70, }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"ignorePlurals":true}""") + assert loads(_req.data) == loads( + """{"query":"query","relevancyStrictness":70}""" + ) - async def test_set_settings_4(self): + async def test_search_single_index_51(self): """ - list of string ignorePlurals + apply_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "ignorePlurals": [ - "fr", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": "(category:Book OR category:Ebook) AND _tags:published", }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"ignorePlurals":["fr"]}""") + assert loads(_req.data) == loads( + """{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}""" + ) - async def test_set_settings_5(self): + async def test_search_single_index_52(self): """ - removeStopWords boolean + apply_all_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "removeStopWords": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "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"', }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"removeStopWords":true}""") + assert loads(_req.data) == loads( + """{"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\\""}""" + ) - async def test_set_settings_6(self): + async def test_search_single_index_53(self): """ - removeStopWords list of string + escape_spaces """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "removeStopWords": [ - "fr", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'category:"Books and Comics"', }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"removeStopWords":["fr"]}""") + assert loads(_req.data) == loads( + """{"query":"query","filters":"category:\\"Books and Comics\\""}""" + ) - async def test_set_settings_7(self): + async def test_search_single_index_54(self): """ - boolean distinct + escape_keywords """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "distinct": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'keyword:"OR"', }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":true}""") + assert loads(_req.data) == loads( + """{"query":"query","filters":"keyword:\\"OR\\""}""" + ) - async def test_set_settings_8(self): + async def test_search_single_index_55(self): """ - integer distinct + escape_single_quotes """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "distinct": 1, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'content:"It\'s a wonderful day"', }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":1}""") + assert loads(_req.data) == loads( + """{"query":"query","filters":"content:\\"It's a wonderful day\\""}""" + ) - async def test_set_settings_9(self): + async def test_search_single_index_56(self): """ - distinct company + escape_double_quotes """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "attributeForDistinct": "company", - "distinct": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'content:"She said "Hello World"', }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributeForDistinct":"company","distinct":true}""" + """{"query":"query","filters":"content:\\"She said \\"Hello World\\""}""" ) - async def test_set_settings_10(self): + async def test_search_single_index_57(self): """ - distinct design + apply_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "attributeForDistinct": "design", - "distinct": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:John Doe", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributeForDistinct":"design","distinct":true}""" + """{"query":"query","optionalFilters":["category:Book","author:John Doe"]}""" ) - async def test_set_settings_11(self): + async def test_search_single_index_58(self): """ - distinct true + apply_negative_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "distinct": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:-John Doe", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":true}""") + assert loads(_req.data) == loads( + """{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}""" + ) - async def test_set_settings_12(self): + async def test_search_single_index_59(self): """ - distinct section + apply_numeric_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "attributeForDistinct": "section", - "distinct": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "numericFilters": [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506", + ], + ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributeForDistinct":"section","distinct":true}""" + """{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}""" ) - async def test_set_settings_13(self): + async def test_search_single_index_60(self): """ - attributesForFaceting allergens + apply_tag_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "allergens", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "tagFilters": [ + "SciFi", + [ + "Book", + "Movie", + ], ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributesForFaceting":["allergens"]}""") + assert loads(_req.data) == loads( + """{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}""" + ) - async def test_set_settings_14(self): + async def test_search_single_index_61(self): """ - attributesForFaceting categoryPageId + apply_filters """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "searchable(categoryPageId)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "sumOrFiltersScores": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["searchable(categoryPageId)"]}""" + """{"query":"query","sumOrFiltersScores":true}""" ) - async def test_set_settings_15(self): + async def test_search_single_index_62(self): """ - unretrievableAttributes + facets_all """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "unretrievableAttributes": [ - "visible_by", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facets": [ + "*", ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"unretrievableAttributes":["visible_by"]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","facets":["*"]}""") - async def test_set_settings_16(self): + async def test_search_single_index_63(self): """ - attributesForFaceting user restricted data + retrieve_only_some_facets """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "filterOnly(visible_by)", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facets": [ + "category", + "author", ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["filterOnly(visible_by)"]}""" + """{"query":"query","facets":["category","author"]}""" ) - async def test_set_settings_17(self): + async def test_search_single_index_64(self): """ - attributesForFaceting optional filters + override_default_max_values_per_facet """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "can_deliver_quickly", - "restaurant", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "maxValuesPerFacet": 20, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","maxValuesPerFacet":20}""") - async def test_set_settings_18(self): + async def test_search_single_index_65(self): """ - attributesForFaceting redirect index + enable_faceting_after_distinct """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "query_terms", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetingAfterDistinct": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["query_terms"]}""" + """{"query":"query","facetingAfterDistinct":true}""" ) - async def test_set_settings_19(self): + async def test_search_single_index_66(self): """ - attributesForFaceting multiple consequences + sort_facet_values_alphabetically """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "director", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "sortFacetValuesBy": "count", }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributesForFaceting":["director"]}""") + assert loads(_req.data) == loads( + """{"query":"query","sortFacetValuesBy":"count"}""" + ) - async def test_set_settings_20(self): + async def test_search_single_index_67(self): """ - attributesForFaceting in-depth optional filters + override_attributes_to_snippet """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "filterOnly(brand)", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "attributesToSnippet": [ + "title", + "content:80", ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["filterOnly(brand)"]}""" + """{"query":"query","attributesToSnippet":["title","content:80"]}""" ) - async def test_set_settings_21(self): + async def test_search_single_index_68(self): """ - mode neuralSearch + override_default_highlight_pre_tag """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "mode": "neuralSearch", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "highlightPreTag": "", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") + assert loads(_req.data) == loads( + """{"query":"query","highlightPreTag":""}""" + ) - async def test_set_settings_22(self): + async def test_search_single_index_69(self): """ - mode keywordSearch + override_default_highlight_post_tag """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "mode": "keywordSearch", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "highlightPostTag": "", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") + assert loads(_req.data) == loads( + """{"query":"query","highlightPostTag":""}""" + ) - async def test_set_settings_23(self): + async def test_search_single_index_70(self): """ - searchableAttributes same priority + override_default_snippet_ellipsis_text """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "title,comments", - "ingredients", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "snippetEllipsisText": "", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["title,comments","ingredients"]}""" + """{"query":"query","snippetEllipsisText":""}""" ) - async def test_set_settings_24(self): + async def test_search_single_index_71(self): """ - searchableAttributes higher priority + enable_restrict_highlight_and_snippet_arrays """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "title", - "ingredients", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "restrictHighlightAndSnippetArrays": False, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["title","ingredients"]}""" + """{"query":"query","restrictHighlightAndSnippetArrays":false}""" ) - async def test_set_settings_25(self): + async def test_search_single_index_72(self): """ - customRanking retweets + access_page """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(retweets)", - "desc(likes)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "page": 0, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["desc(retweets)","desc(likes)"]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","page":0}""") - async def test_set_settings_26(self): + async def test_search_single_index_73(self): """ - customRanking boosted + override_default_hits_per_page """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(boosted)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "hitsPerPage": 10, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"customRanking":["desc(boosted)"]}""") + assert loads(_req.data) == loads("""{"query":"query","hitsPerPage":10}""") - async def test_set_settings_27(self): + async def test_search_single_index_74(self): """ - customRanking pageviews + get_nth_hit """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(pageviews)", - "desc(comments)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "offset": 4, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["desc(pageviews)","desc(comments)"]}""" + assert loads(_req.data) == loads("""{"query":"query","offset":4}""") + + async def test_search_single_index_75(self): + """ + get_n_results + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "length": 4, + }, ) - async def test_set_settings_28(self): + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","length":4}""") + + async def test_search_single_index_76(self): """ - customRanking applying search parameters for a specific query + override_default_min_word_size_for_one_typo """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(nb_airline_liaisons)", - ], - "attributesForFaceting": [ - "city, country", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minWordSizefor1Typo": 2, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""" + """{"query":"query","minWordSizefor1Typo":2}""" ) - async def test_set_settings_29(self): + async def test_search_single_index_77(self): """ - customRanking rounded pageviews + override_default_min_word_size_for_two_typos """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(rounded_pageviews)", - "desc(comments)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minWordSizefor2Typos": 2, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""" + """{"query":"query","minWordSizefor2Typos":2}""" ) - async def test_set_settings_30(self): + async def test_search_single_index_78(self): """ - customRanking price + override_default_typo_tolerance_mode """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(price)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "typoTolerance": False, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"customRanking":["desc(price)"]}""") + assert loads(_req.data) == loads("""{"query":"query","typoTolerance":false}""") - async def test_set_settings_31(self): + async def test_search_single_index_79(self): """ - ranking exhaustive + disable_typos_on_numeric_tokens_at_search_time """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "ranking": [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "allowTyposOnNumericTokens": False, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + """{"query":"query","allowTyposOnNumericTokens":false}""" ) - async def test_set_settings_32(self): + async def test_search_single_index_80(self): """ - ranking standard replica + search_around_a_position """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "ranking": [ - "desc(post_date_timestamp)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundLatLng": "40.71, -74.01", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"ranking":["desc(post_date_timestamp)"]}""" + """{"query":"query","aroundLatLng":"40.71, -74.01"}""" ) - async def test_set_settings_33(self): + async def test_search_single_index_81(self): """ - ranking virtual replica + search_around_server_ip """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "desc(post_date_timestamp)", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundLatLngViaIP": True, + }, + request_options={ + "headers": loads( + """{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}""" + ), }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() + assert ( + _req.headers.items() + >= { + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around" + }.items() + ) assert loads(_req.data) == loads( - """{"customRanking":["desc(post_date_timestamp)"]}""" + """{"query":"query","aroundLatLngViaIP":true}""" ) - async def test_set_settings_34(self): + async def test_search_single_index_82(self): """ - customRanking and ranking sort alphabetically + set_around_radius """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "ranking": [ - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundRadius": 1000, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","aroundRadius":1000}""") - async def test_set_settings_35(self): + async def test_search_single_index_83(self): """ - relevancyStrictness + disable_automatic_radius """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "relevancyStrictness": 0, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundRadius": "all", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""" - ) + assert loads(_req.data) == loads("""{"query":"query","aroundRadius":"all"}""") - async def test_set_settings_36(self): + async def test_search_single_index_84(self): """ - create replica index + set_geo_search_precision """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "replicas": [ - "products_price_desc", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundPrecision": 100, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"replicas":["products_price_desc"]}""") + assert loads(_req.data) == loads("""{"query":"query","aroundPrecision":100}""") - async def test_set_settings_37(self): + async def test_search_single_index_85(self): """ - create virtual replica index + set_geo_search_precision_non_linear """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "replicas": [ - "virtual(products_price_desc)", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundPrecision": [ + { + "from": 0, + "value": 25, + }, + { + "from": 2000, + "value": 1000, + }, ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"replicas":["virtual(products_price_desc)"]}""" + """{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}""" ) - async def test_set_settings_38(self): + async def test_search_single_index_86(self): """ - unlink replica index + set_minimum_geo_search_radius """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "replicas": [ - "", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minimumAroundRadius": 1000, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"replicas":[""]}""") + assert loads(_req.data) == loads( + """{"query":"query","minimumAroundRadius":1000}""" + ) - async def test_set_settings_39(self): + async def test_search_single_index_87(self): """ - forwardToReplicas + search_inside_rectangular_area """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "name", - "description", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], ], }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["name","description"]}""" + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}""" ) - async def test_set_settings_40(self): + async def test_search_single_index_88(self): """ - maxValuesPerFacet + search_inside_multiple_rectangular_areas """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "maxValuesPerFacet": 1000, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + ], + ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") + assert loads(_req.data) == loads( + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}""" + ) - async def test_set_settings_41(self): + async def test_search_single_index_89(self): """ - maxFacetHits + search_inside_polygon_area """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "maxFacetHits": 1000, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ], + ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"maxFacetHits":1000}""") + assert loads(_req.data) == loads( + """{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}""" + ) - async def test_set_settings_42(self): + async def test_search_single_index_90(self): """ - attributesForFaceting complex + search_inside_multiple_polygon_areas """ - _req = await self._client.set_settings_with_http_info( - index_name="", - index_settings={ - "attributesForFaceting": [ - "actor", - "filterOnly(category)", - "searchable(publisher)", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "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, + ], ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""" + """{"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]]}""" ) - async def test_set_settings_43(self): + async def test_search_single_index_91(self): """ - ranking closest dates + set_querylanguages_override """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "ranking": [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "ignorePlurals": [ + "ca", + "es", ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + """{"query":"query","ignorePlurals":["ca","es"]}""" ) - async def test_set_settings_44(self): + async def test_search_single_index_92(self): """ - searchableAttributes item variation + set_querylanguages_override """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "design", - "type", - "color", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["design","type","color"]}""" + """{"query":"query","removeStopWords":["ca","es"]}""" ) - async def test_set_settings_45(self): + async def test_search_single_index_93(self): """ - searchableAttributes around location + set_querylanguages_override """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", ], - "customRanking": [ - "desc(links_count)", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","removeStopWords":["ca","es"]}""" + ) + + async def test_search_single_index_94(self): + """ + set_querylanguages_with_japanese_query + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "queryLanguages": [ + "ja", + "en", ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" + """{"query":"query","queryLanguages":["ja","en"]}""" ) - async def test_set_settings_46(self): + async def test_search_single_index_95(self): """ - searchableAttributes around location + set_natural_languages """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", ], - "customRanking": [ - "desc(links_count)", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"","naturalLanguages":["fr"]}""") + + async def test_search_single_index_96(self): + """ + override_natural_languages_with_query + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", ], + "removeWordsIfNoResults": "firstWords", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" + """{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}""" ) - async def test_set_settings_47(self): + async def test_search_single_index_97(self): """ - disableTypoToleranceOnAttributes + enable_decompound_query_search_time """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "decompoundQuery": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","decompoundQuery":true}""") + + async def test_search_single_index_98(self): + """ + enable_rules_search_time + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableRules": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","enableRules":true}""") + + async def test_search_single_index_99(self): + """ + set_rule_contexts + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "ruleContexts": [ + "front_end", + "website2", ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableTypoToleranceOnAttributes":["serial_number"]}""" + """{"query":"query","ruleContexts":["front_end","website2"]}""" ) - async def test_set_settings_48(self): + async def test_search_single_index_100(self): """ - everything + enable_personalization """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "advancedSyntax": True, - "advancedSyntaxFeatures": [ - "exactPhrase", - ], - "allowCompressionOfIntegerArray": True, - "allowTyposOnNumericTokens": True, - "alternativesAsExact": [ - "singleWordSynonym", - ], - "attributeCriteriaComputedByMinProximity": True, - "attributeForDistinct": "test", - "attributesForFaceting": [ - "algolia", - ], - "attributesToHighlight": [ - "algolia", - ], - "attributesToRetrieve": [ - "algolia", - ], - "attributesToSnippet": [ - "algolia", - ], - "attributesToTransliterate": [ - "algolia", - ], - "camelCaseAttributes": [ - "algolia", - ], - "customNormalization": { - "algolia": { - "aloglia": "aglolia", - }, - }, - "customRanking": [ - "algolia", - ], - "decompoundQuery": False, - "decompoundedAttributes": { - "algolia": "aloglia", - }, - "disableExactOnAttributes": [ - "algolia", - ], - "disablePrefixOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnWords": [ - "algolia", - ], - "distinct": 3, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", "enablePersonalization": True, - "enableReRanking": False, - "enableRules": True, - "exactOnSingleWordQuery": "attribute", - "highlightPreTag": "", - "highlightPostTag": "", - "hitsPerPage": 10, - "ignorePlurals": False, - "indexLanguages": [ - "fr", - ], - "keepDiacriticsOnCharacters": "abc", - "maxFacetHits": 20, - "maxValuesPerFacet": 30, - "minProximity": 6, - "minWordSizefor1Typo": 5, - "minWordSizefor2Typos": 11, - "mode": "neuralSearch", - "numericAttributesForFiltering": [ - "algolia", - ], - "optionalWords": [ - "myspace", - ], - "paginationLimitedTo": 0, - "queryLanguages": [ - "fr", - ], - "queryType": "prefixLast", - "ranking": [ - "geo", - ], - "reRankingApplyFilter": "mySearch:filters", - "relevancyStrictness": 10, - "removeStopWords": False, - "removeWordsIfNoResults": "lastWords", - "renderingContent": { - "facetOrdering": { - "facets": { - "order": [ - "a", - "b", - ], - }, - "values": { - "a": { - "order": [ - "b", - ], - "sortRemainingBy": "count", - }, - }, - }, - }, - "replaceSynonymsInHighlight": True, - "replicas": [ - "", - ], - "responseFields": [ - "algolia", - ], - "restrictHighlightAndSnippetArrays": True, - "searchableAttributes": [ - "foo", - ], - "semanticSearch": { - "eventSources": [ - "foo", - ], - }, - "separatorsToIndex": "bar", - "snippetEllipsisText": "---", - "sortFacetValuesBy": "date", - "typoTolerance": False, - "unretrievableAttributes": [ - "foo", - ], - "userData": { - "user": "data", - }, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" + """{"query":"query","enablePersonalization":true}""" ) - async def test_set_settings_49(self): + async def test_search_single_index_101(self): """ - searchableAttributesWithCustomRankingsAndAttributesForFaceting + enable_personalization_with_user_token """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "brand", - "name", - "categories", - "unordered(description)", - ], - "customRanking": [ - "desc(popularity)", - ], - "attributesForFaceting": [ - "searchable(brand)", - "type", - "categories", - "price", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" + """{"query":"query","enablePersonalization":true,"userToken":"123456"}""" ) - async def test_set_settings_50(self): + async def test_search_single_index_102(self): """ - searchableAttributesProductReferenceSuffixes + personalization_impact """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "name", - "product_reference", - "product_reference_suffixes", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "personalizationImpact": 20, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""" + """{"query":"query","personalizationImpact":20}""" ) - async def test_set_settings_51(self): + async def test_search_single_index_103(self): """ - queryLanguageAndIgnorePlurals + set_user_token """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "queryLanguages": [ - "en", - ], - "ignorePlurals": True, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "userToken": "123456", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"queryLanguages":["en"],"ignorePlurals":true}""" - ) + assert loads(_req.data) == loads("""{"query":"query","userToken":"123456"}""") - async def test_set_settings_52(self): + async def test_search_single_index_104(self): """ - searchableAttributesInMovies + set_user_token_with_personalization """ - _req = await self._client.set_settings_with_http_info( - index_name="movies", - index_settings={ - "searchableAttributes": [ - "title_eng", - "title_fr", - "title_es", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", }, ) - assert _req.path == "/1/indexes/movies/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["title_eng","title_fr","title_es"]}""" + """{"query":"query","enablePersonalization":true,"userToken":"123456"}""" ) - async def test_set_settings_53(self): + async def test_search_single_index_105(self): """ - disablePrefixOnAttributes + override_default_query_type """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "disablePrefixOnAttributes": [ - "serial_number", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "queryType": "prefixAll", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disablePrefixOnAttributes":["serial_number"]}""" + """{"query":"query","queryType":"prefixAll"}""" ) - async def test_set_settings_54(self): + async def test_search_single_index_106(self): """ - disableTypoToleranceOnAttributes + override_default_remove_words_if_no_results """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeWordsIfNoResults": "lastWords", }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableTypoToleranceOnAttributes":["serial_number"]}""" + """{"query":"query","removeWordsIfNoResults":"lastWords"}""" ) - async def test_set_settings_55(self): + async def test_search_single_index_107(self): """ - searchableAttributesSimpleExample + enable_advanced_syntax_search_time """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "serial_number", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"searchableAttributes":["serial_number"]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","advancedSyntax":true}""") - async def test_set_settings_56(self): + async def test_search_single_index_108(self): """ - searchableAttributesSimpleExampleAlt + overide_default_optional_words """ - _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", - index_settings={ - "searchableAttributes": [ - "serial_number", - "serial_number_suffixes", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalWords": [ + "toyota", + "2020 2021", ], }, ) - assert _req.path == "/1/indexes/theIndexName/settings" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["serial_number","serial_number_suffixes"]}""" + """{"query":"query","optionalWords":["toyota","2020 2021"]}""" ) - async def test_update_api_key_(self): + async def test_search_single_index_109(self): """ - updateApiKey + disabling_exact_for_some_attributes_search_time """ - _req = await self._client.update_api_key_with_http_info( - key="ALGOLIA_API_KEY", - api_key={ - "acl": [ - "search", - "addObject", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "disableExactOnAttributes": [ + "description", ], - "validity": 300, - "maxQueriesPerIPPerHour": 100, - "maxHitsPerQuery": 20, }, ) - assert _req.path == "/1/keys/ALGOLIA_API_KEY" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"acl":["search","addObject"],"validity":300,"maxQueriesPerIPPerHour":100,"maxHitsPerQuery":20}""" + """{"query":"query","disableExactOnAttributes":["description"]}""" ) - -class TestSearchClientSync: - _config = SearchConfig("test_app_id", "test_api_key") - _client = SearchClientSync.create_with_config( - config=_config, transporter=EchoTransporterSync(_config) - ) - - def test_add_api_key_(self): + async def test_search_single_index_110(self): """ - addApiKey + override_default_exact_single_word_query """ - _req = self._client.add_api_key_with_http_info( - api_key={ - "acl": [ - "search", - "addObject", - ], - "description": "my new api key", - "validity": 300, - "maxQueriesPerIPPerHour": 100, - "maxHitsPerQuery": 20, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "exactOnSingleWordQuery": "none", }, ) - assert _req.path == "/1/keys" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"acl":["search","addObject"],"description":"my new api key","validity":300,"maxQueriesPerIPPerHour":100,"maxHitsPerQuery":20}""" + """{"query":"query","exactOnSingleWordQuery":"none"}""" ) - def test_add_or_update_object_(self): + async def test_search_single_index_111(self): """ - addOrUpdateObject + override_default_aternative_as_exact """ - _req = self._client.add_or_update_object_with_http_info( + _req = await self._client.search_single_index_with_http_info( index_name="indexName", - object_id="uniqueID", - body={ - "key": "value", + search_params={ + "query": "query", + "alternativesAsExact": [ + "multiWordsSynonym", + ], }, ) - assert _req.path == "/1/indexes/indexName/uniqueID" - assert _req.verb == "PUT" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"key":"value"}""") + assert loads(_req.data) == loads( + """{"query":"query","alternativesAsExact":["multiWordsSynonym"]}""" + ) - def test_append_source_(self): + async def test_search_single_index_112(self): """ - appendSource + enable_advanced_syntax_exact_phrase """ - _req = self._client.append_source_with_http_info( - source={ - "source": "theSource", - "description": "theDescription", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], }, ) - assert _req.path == "/1/security/sources/append" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"source":"theSource","description":"theDescription"}""" + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}""" ) - def test_assign_user_id_(self): + async def test_search_single_index_113(self): """ - simple + enable_advanced_syntax_exclude_words """ - _req = self._client.assign_user_id_with_http_info( - x_algolia_user_id="user42", - assign_user_id_params={ - "cluster": "d4242-eu", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "excludeWords", + ], }, ) - assert _req.path == "/1/clusters/mapping" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {"x-algolia-user-id": "user42"}.items() - assert loads(_req.data) == loads("""{"cluster":"d4242-eu"}""") + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}""" + ) - def test_assign_user_id_1(self): + async def test_search_single_index_114(self): """ - it should not encode the userID + override_distinct """ - _req = self._client.assign_user_id_with_http_info( - x_algolia_user_id="user id with spaces", - assign_user_id_params={ - "cluster": "cluster with spaces", + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "distinct": 0, }, ) - assert _req.path == "/1/clusters/mapping" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() - assert ( - _req.headers.items() >= {"x-algolia-user-id": "user id with spaces"}.items() - ) - assert loads(_req.data) == loads("""{"cluster":"cluster with spaces"}""") + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","distinct":0}""") - def test_batch_(self): + async def test_search_single_index_115(self): """ - addObject + get_ranking_info """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "addObject", - "body": { - "key": "bar", - "foo": "1", - }, - }, - { - "action": "addObject", - "body": { - "key": "baz", - "foo": "2", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "getRankingInfo": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"action":"addObject","body":{"key":"bar","foo":"1"}},{"action":"addObject","body":{"key":"baz","foo":"2"}}]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","getRankingInfo":true}""") - def test_batch_1(self): + async def test_search_single_index_116(self): """ - clear + disable_click_analytics """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "clear", - "body": { - "key": "value", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "clickAnalytics": False, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"action":"clear","body":{"key":"value"}}]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","clickAnalytics":false}""") - def test_batch_2(self): + async def test_search_single_index_117(self): """ - delete + enable_click_analytics """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "delete", - "body": { - "key": "value", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "clickAnalytics": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"action":"delete","body":{"key":"value"}}]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","clickAnalytics":true}""") - def test_batch_3(self): + async def test_search_single_index_118(self): """ - deleteObject + disable_analytics """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "deleteObject", - "body": { - "key": "value", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "analytics": False, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"action":"deleteObject","body":{"key":"value"}}]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","analytics":false}""") - def test_batch_4(self): + async def test_search_single_index_119(self): """ - partialUpdateObject + add_analytics_tags """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "partialUpdateObject", - "body": { - "key": "value", - }, - }, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "analyticsTags": [ + "front_end", + "website2", ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"action":"partialUpdateObject","body":{"key":"value"}}]}""" + """{"query":"query","analyticsTags":["front_end","website2"]}""" ) - def test_batch_5(self): + async def test_search_single_index_120(self): """ - partialUpdateObjectNoCreate + disable_synonyms """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "partialUpdateObjectNoCreate", - "body": { - "key": "value", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "synonyms": False, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"action":"partialUpdateObjectNoCreate","body":{"key":"value"}}]}""" - ) + assert loads(_req.data) == loads("""{"query":"query","synonyms":false}""") - def test_batch_6(self): + async def test_search_single_index_121(self): """ - updateObject + override_replace_synonyms_in_highlights """ - _req = self._client.batch_with_http_info( - index_name="", - batch_write_params={ - "requests": [ - { - "action": "updateObject", - "body": { - "key": "value", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "replaceSynonymsInHighlight": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"action":"updateObject","body":{"key":"value"}}]}""" + """{"query":"query","replaceSynonymsInHighlight":true}""" ) - def test_batch_assign_user_ids_(self): + async def test_search_single_index_122(self): """ - batchAssignUserIds + override_min_proximity """ - _req = self._client.batch_assign_user_ids_with_http_info( - x_algolia_user_id="userID", - batch_assign_user_ids_params={ - "cluster": "theCluster", - "users": [ - "user1", - "user2", - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minProximity": 2, }, ) - assert _req.path == "/1/clusters/mapping/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {"x-algolia-user-id": "userID"}.items() - assert loads(_req.data) == loads( - """{"cluster":"theCluster","users":["user1","user2"]}""" - ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","minProximity":2}""") - def test_batch_dictionary_entries_(self): + async def test_search_single_index_123(self): """ - replace + override_default_field """ - _req = self._client.batch_dictionary_entries_with_http_info( - dictionary_name="plurals", - batch_dictionary_entries_params={ - "clearExistingDictionaryEntries": True, - "requests": [ - { - "action": "addEntry", - "body": { - "objectID": "1", - "language": "en", - "word": "fancy", - "words": [ - "believe", - "algolia", - ], - "decomposition": [ - "trust", - "algolia", - ], - "state": "enabled", - }, - }, + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "responseFields": [ + "hits", + "facets", ], }, ) - assert _req.path == "/1/dictionaries/plurals/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"clearExistingDictionaryEntries":true,"requests":[{"action":"addEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}""" + """{"query":"query","responseFields":["hits","facets"]}""" ) - def test_batch_dictionary_entries_1(self): + async def test_search_single_index_124(self): """ - delete + override_percentile_computation """ - _req = self._client.batch_dictionary_entries_with_http_info( - dictionary_name="plurals", - batch_dictionary_entries_params={ - "clearExistingDictionaryEntries": True, - "requests": [ - { - "action": "deleteEntry", - "body": { - "objectID": "1", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "percentileComputation": False, }, ) - assert _req.path == "/1/dictionaries/plurals/batch" + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}""" + """{"query":"query","percentileComputation":false}""" ) - def test_batch_dictionary_entries_2(self): + async def test_search_single_index_125(self): """ - append + set_ab_test """ - _req = self._client.batch_dictionary_entries_with_http_info( - dictionary_name="stopwords", - batch_dictionary_entries_params={ - "requests": [ - { - "action": "addEntry", - "body": { - "objectID": "1", - "language": "en", - "additional": "try me", - }, - }, - ], + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableABTest": False, }, ) - assert _req.path == "/1/dictionaries/stopwords/batch" + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","enableABTest":false}""") + + async def test_search_single_index_126(self): + """ + set_enable_re_ranking + """ + _req = await self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableReRanking": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"action":"addEntry","body":{"objectID":"1","language":"en","additional":"try me"}}]}""" + """{"query":"query","enableReRanking":false}""" ) - def test_browse_(self): + async def test_search_synonyms_(self): """ - browse with minimal parameters + searchSynonyms with minimal parameters """ - _req = self._client.browse_with_http_info( - index_name="cts_e2e_browse", + _req = await self._client.search_synonyms_with_http_info( + index_name="indexName", ) - assert _req.path == "/1/indexes/cts_e2e_browse/browse" + assert _req.path == "/1/indexes/indexName/synonyms/search" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{}""") - def test_browse_1(self): + async def test_search_synonyms_1(self): """ - browse with search parameters + searchSynonyms with all parameters """ - _req = self._client.browse_with_http_info( + _req = await self._client.search_synonyms_with_http_info( index_name="indexName", - browse_params={ + search_synonyms_params={ "query": "myQuery", - "facetFilters": [ - "tags:algolia", - ], + "type": "altcorrection1", + "page": 10, + "hitsPerPage": 10, }, ) - assert _req.path == "/1/indexes/indexName/browse" + assert _req.path == "/1/indexes/indexName/synonyms/search" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"myQuery","facetFilters":["tags:algolia"]}""" + """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""" ) - def test_browse_2(self): + async def test_search_user_ids_(self): """ - browse allow a cursor in parameters + searchUserIds """ - _req = self._client.browse_with_http_info( - index_name="indexName", - browse_params={ - "cursor": "test", + _req = await self._client.search_user_ids_with_http_info( + search_user_ids_params={ + "query": "test", + "clusterName": "theClusterName", + "page": 5, + "hitsPerPage": 10, }, ) - assert _req.path == "/1/indexes/indexName/browse" + assert _req.path == "/1/clusters/mapping/search" assert _req.verb == "POST" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"cursor":"test"}""") + assert loads(_req.data) == loads( + """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""" + ) - def test_clear_objects_(self): + async def test_set_dictionary_settings_(self): """ - clearObjects + get setDictionarySettings results with minimal parameters """ - _req = self._client.clear_objects_with_http_info( - index_name="theIndexName", + _req = await self._client.set_dictionary_settings_with_http_info( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + }, + }, ) - assert _req.path == "/1/indexes/theIndexName/clear" - assert _req.verb == "POST" + assert _req.path == "/1/dictionaries/*/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""" + ) - def test_clear_rules_(self): + async def test_set_dictionary_settings_1(self): """ - clearRules + get setDictionarySettings results with all parameters """ - _req = self._client.clear_rules_with_http_info( - index_name="indexName", + _req = await self._client.set_dictionary_settings_with_http_info( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + "stopwords": { + "fr": False, + }, + "compounds": { + "ru": True, + }, + }, + }, ) - assert _req.path == "/1/indexes/indexName/rules/clear" - assert _req.verb == "POST" + assert _req.path == "/1/dictionaries/*/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" + ) - def test_clear_synonyms_(self): + async def test_set_settings_(self): """ - clearSynonyms + minimal parameters """ - _req = self._client.clear_synonyms_with_http_info( - index_name="indexName", + _req = await self._client.set_settings_with_http_info( + index_name="cts_e2e_settings", + index_settings={ + "paginationLimitedTo": 10, + }, + forward_to_replicas=True, ) - assert _req.path == "/1/indexes/indexName/synonyms/clear" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/cts_e2e_settings/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"paginationLimitedTo":10}""") - def test_custom_delete_(self): + async def test_set_settings_1(self): """ - allow del method for a custom path with minimal parameters + boolean typoTolerance """ - _req = self._client.custom_delete_with_http_info( - path="test/minimal", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "typoTolerance": True, + }, + forward_to_replicas=True, ) - assert _req.path == "/test/minimal" - assert _req.verb == "DELETE" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"typoTolerance":true}""") - def test_custom_delete_1(self): + async def test_set_settings_2(self): """ - allow del method for a custom path with all parameters + enum typoTolerance """ - _req = self._client.custom_delete_with_http_info( - path="test/all", - parameters={ - "query": "parameters", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "typoTolerance": "min", }, + forward_to_replicas=True, ) - assert _req.path == "/test/all" - assert _req.verb == "DELETE" - assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"typoTolerance":"min"}""") - def test_custom_get_(self): + async def test_set_settings_3(self): """ - allow get method for a custom path with minimal parameters + ignorePlurals """ - _req = self._client.custom_get_with_http_info( - path="test/minimal", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ignorePlurals": True, + }, + forward_to_replicas=True, ) - assert _req.path == "/test/minimal" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"ignorePlurals":true}""") - def test_custom_get_1(self): + async def test_set_settings_4(self): """ - allow get method for a custom path with all parameters + list of string ignorePlurals """ - _req = self._client.custom_get_with_http_info( - path="test/all", - parameters={ - "query": "parameters with space", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ignorePlurals": [ + "fr", + ], }, + forward_to_replicas=True, ) - assert _req.path == "/test/all" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() - == {"query": "parameters%20with%20space"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"ignorePlurals":["fr"]}""") - def test_custom_get_2(self): + async def test_set_settings_5(self): """ - requestOptions should be escaped too + removeStopWords boolean """ - _req = self._client.custom_get_with_http_info( - path="test/all", - parameters={ - "query": "to be overriden", - }, - request_options={ - "headers": loads("""{"x-header-1":"spaces are left alone"}"""), - "query_parameters": loads( - """{"query":"parameters with space","and an array":["array","with spaces"]}""" - ), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "removeStopWords": True, }, + forward_to_replicas=True, ) - assert _req.path == "/test/all" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() - == { - "query": "parameters%20with%20space", - "and%20an%20array": "array%2Cwith%20spaces", - }.items() - ) - assert _req.headers.items() >= {"x-header-1": "spaces are left alone"}.items() - assert _req.data is None + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"removeStopWords":true}""") - def test_custom_post_(self): + async def test_set_settings_6(self): """ - allow post method for a custom path with minimal parameters + removeStopWords list of string """ - _req = self._client.custom_post_with_http_info( - path="test/minimal", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "removeStopWords": [ + "fr", + ], + }, + forward_to_replicas=True, ) - assert _req.path == "/test/minimal" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads("""{"removeStopWords":["fr"]}""") - def test_custom_post_1(self): + async def test_set_settings_7(self): """ - allow post method for a custom path with all parameters + boolean distinct """ - _req = self._client.custom_post_with_http_info( - path="test/all", - parameters={ - "query": "parameters", - }, - body={ - "body": "parameters", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": True, }, + forward_to_replicas=True, ) - assert _req.path == "/test/all" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"body":"parameters"}""") + assert loads(_req.data) == loads("""{"distinct":true}""") - def test_custom_post_2(self): + async def test_set_settings_8(self): """ - requestOptions can override default query parameters + integer distinct """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"query":"myQueryParameter"}"""), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": 1, }, + forward_to_replicas=True, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {"query": "myQueryParameter"}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads("""{"distinct":1}""") - def test_custom_post_3(self): + async def test_set_settings_9(self): """ - requestOptions merges query parameters with default ones + distinct company """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"query2":"myQueryParameter"}"""), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "company", + "distinct": True, }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "query2": "myQueryParameter"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads( + """{"attributeForDistinct":"company","distinct":true}""" + ) - def test_custom_post_4(self): + async def test_set_settings_10(self): """ - requestOptions can override default headers + distinct design """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "headers": loads("""{"x-algolia-api-key":"ALGOLIA_API_KEY"}"""), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "design", + "distinct": True, }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {"query": "parameters"}.items() - assert _req.headers.items() >= {"x-algolia-api-key": "ALGOLIA_API_KEY"}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributeForDistinct":"design","distinct":true}""" + ) - def test_custom_post_5(self): + async def test_set_settings_11(self): """ - requestOptions merges headers with default ones + distinct true """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "headers": loads("""{"x-algolia-api-key":"ALGOLIA_API_KEY"}"""), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": True, }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {"query": "parameters"}.items() - assert _req.headers.items() >= {"x-algolia-api-key": "ALGOLIA_API_KEY"}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"distinct":true}""") - def test_custom_post_6(self): + async def test_set_settings_12(self): """ - requestOptions queryParameters accepts booleans + distinct section """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"isItWorking":true}"""), + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "section", + "distinct": True, }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "isItWorking": "true"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads( + """{"attributeForDistinct":"section","distinct":true}""" + ) - def test_custom_post_7(self): + async def test_set_settings_13(self): """ - requestOptions queryParameters accepts integers + attributesForFaceting allergens """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"myParam":2}"""), + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "allergens", + ], }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "myParam": "2"}.items() - ) + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads("""{"attributesForFaceting":["allergens"]}""") - def test_custom_post_8(self): + async def test_set_settings_14(self): """ - requestOptions queryParameters accepts list of string + api_attributes_for_faceting """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"myParam":["b and c","d"]}"""), + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "author", + ], }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "myParam": "b%20and%20c%2Cd"}.items() - ) + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["genre","author"]}""" + ) - def test_custom_post_9(self): + async def test_set_settings_15(self): """ - requestOptions queryParameters accepts list of booleans + api_attributes_for_faceting_searchable """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"myParam":[true,true,false]}"""), + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "searchable(author)", + ], }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "myParam": "true%2Ctrue%2Cfalse"}.items() - ) + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["genre","searchable(author)"]}""" + ) - def test_custom_post_10(self): + async def test_set_settings_16(self): """ - requestOptions queryParameters accepts list of integers + api_attributes_for_filter_only """ - _req = self._client.custom_post_with_http_info( - path="test/requestOptions", - parameters={ - "query": "parameters", - }, - body={ - "facet": "filters", - }, - request_options={ - "query_parameters": loads("""{"myParam":[1,2]}"""), + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(genre)", + "author", + ], }, ) - assert _req.path == "/test/requestOptions" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"query": "parameters", "myParam": "1%2C2"}.items() - ) + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facet":"filters"}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["filterOnly(genre)","author"]}""" + ) - def test_custom_put_(self): + async def test_set_settings_17(self): """ - allow put method for a custom path with minimal parameters + attributesForFaceting categoryPageId """ - _req = self._client.custom_put_with_http_info( - path="test/minimal", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "searchable(categoryPageId)", + ], + }, ) - assert _req.path == "/test/minimal" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["searchable(categoryPageId)"]}""" + ) - def test_custom_put_1(self): + async def test_set_settings_18(self): """ - allow put method for a custom path with all parameters + unretrievableAttributes """ - _req = self._client.custom_put_with_http_info( - path="test/all", - parameters={ - "query": "parameters", - }, - body={ - "body": "parameters", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "unretrievableAttributes": [ + "visible_by", + ], }, ) - assert _req.path == "/test/all" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"body":"parameters"}""") + assert loads(_req.data) == loads( + """{"unretrievableAttributes":["visible_by"]}""" + ) - def test_delete_api_key_(self): + async def test_set_settings_19(self): """ - deleteApiKey + attributesForFaceting user restricted data """ - _req = self._client.delete_api_key_with_http_info( - key="myTestApiKey", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(visible_by)", + ], + }, ) - assert _req.path == "/1/keys/myTestApiKey" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"attributesForFaceting":["filterOnly(visible_by)"]}""" + ) - def test_delete_by_(self): + async def test_set_settings_20(self): """ - deleteBy + attributesForFaceting optional filters """ - _req = self._client.delete_by_with_http_info( - index_name="theIndexName", - delete_by_params={ - "filters": "brand:brandName", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "can_deliver_quickly", + "restaurant", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/deleteByQuery" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"filters":"brand:brandName"}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""" + ) - def test_delete_index_(self): + async def test_set_settings_21(self): """ - deleteIndex + attributesForFaceting redirect index """ - _req = self._client.delete_index_with_http_info( - index_name="theIndexName", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "query_terms", + ], + }, ) - assert _req.path == "/1/indexes/theIndexName" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"attributesForFaceting":["query_terms"]}""" + ) - def test_delete_object_(self): + async def test_set_settings_22(self): """ - deleteObject + attributesForFaceting multiple consequences """ - _req = self._client.delete_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="", - object_id="uniqueID", + index_settings={ + "attributesForFaceting": [ + "director", + ], + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/uniqueID" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"attributesForFaceting":["director"]}""") - def test_delete_rule_(self): + async def test_set_settings_23(self): """ - delete rule simple case + attributesForFaceting in-depth optional filters """ - _req = self._client.delete_rule_with_http_info( - index_name="indexName", - object_id="id1", + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(brand)", + ], + }, ) - assert _req.path == "/1/indexes/indexName/rules/id1" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"attributesForFaceting":["filterOnly(brand)"]}""" + ) - def test_delete_rule_1(self): + async def test_set_settings_24(self): """ - delete rule with simple characters to encode in objectID + mode neuralSearch """ - _req = self._client.delete_rule_with_http_info( - index_name="indexName", - object_id="test/with/slash", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "neuralSearch", + }, ) - assert _req.path == "/1/indexes/indexName/rules/test%2Fwith%2Fslash" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") - def test_delete_source_(self): + async def test_set_settings_25(self): """ - deleteSource + mode keywordSearch """ - _req = self._client.delete_source_with_http_info( - source="theSource", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "keywordSearch", + }, ) - assert _req.path == "/1/security/sources/theSource" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") - def test_delete_synonym_(self): + async def test_set_settings_26(self): """ - deleteSynonym + searchableAttributes same priority """ - _req = self._client.delete_synonym_with_http_info( - index_name="indexName", - object_id="id1", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title,comments", + "ingredients", + ], + }, ) - assert _req.path == "/1/indexes/indexName/synonyms/id1" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"searchableAttributes":["title,comments","ingredients"]}""" + ) - def test_get_api_key_(self): + async def test_set_settings_27(self): """ - getApiKey + searchableAttributes higher priority """ - _req = self._client.get_api_key_with_http_info( - key="myTestApiKey", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title", + "ingredients", + ], + }, ) - assert _req.path == "/1/keys/myTestApiKey" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"searchableAttributes":["title","ingredients"]}""" + ) - def test_get_app_task_(self): + async def test_set_settings_28(self): """ - getAppTask + customRanking retweets """ - _req = self._client.get_app_task_with_http_info( - task_id=123, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(retweets)", + "desc(likes)", + ], + }, ) - assert _req.path == "/1/task/123" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["desc(retweets)","desc(likes)"]}""" + ) - def test_get_dictionary_languages_(self): + async def test_set_settings_29(self): """ - get getDictionaryLanguages + customRanking boosted """ - _req = self._client.get_dictionary_languages_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(boosted)", + ], + }, + ) - assert _req.path == "/1/dictionaries/*/languages" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"customRanking":["desc(boosted)"]}""") - def test_get_dictionary_settings_(self): + async def test_set_settings_30(self): """ - get getDictionarySettings results + customRanking pageviews """ - _req = self._client.get_dictionary_settings_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(pageviews)", + "desc(comments)", + ], + }, + ) - assert _req.path == "/1/dictionaries/*/settings" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["desc(pageviews)","desc(comments)"]}""" + ) - def test_get_logs_(self): + async def test_set_settings_31(self): """ - getLogs with minimal parameters + customRanking applying search parameters for a specific query """ - _req = self._client.get_logs_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(nb_airline_liaisons)", + ], + "attributesForFaceting": [ + "city, country", + ], + }, + ) - assert _req.path == "/1/logs" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""" + ) - def test_get_logs_1(self): + async def test_set_settings_32(self): """ - getLogs with parameters + customRanking rounded pageviews """ - _req = self._client.get_logs_with_http_info( - offset=5, - length=10, + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - type="all", + index_settings={ + "customRanking": [ + "desc(rounded_pageviews)", + "desc(comments)", + ], + }, ) - assert _req.path == "/1/logs" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() - == { - "offset": "5", - "length": "10", - "indexName": "theIndexName", - "type": "all", - }.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""" + ) - def test_get_object_(self): + async def test_set_settings_33(self): """ - getObject + customRanking price """ - _req = self._client.get_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_retrieve=[ - "attr1", - "attr2", - ], + index_settings={ + "customRanking": [ + "desc(price)", + ], + }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() - == {"attributesToRetrieve": "attr1%2Cattr2"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"customRanking":["desc(price)"]}""") - def test_get_object_1(self): + async def test_set_settings_34(self): """ - search with a real object + ranking exhaustive """ - _req = self._client.get_object_with_http_info( - index_name="cts_e2e_browse", - object_id="Batman and Robin", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], + }, ) - assert _req.path == "/1/indexes/cts_e2e_browse/Batman%20and%20Robin" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + ) - def test_get_objects_(self): + async def test_set_settings_35(self): """ - getObjects + ranking standard replica """ - _req = self._client.get_objects_with_http_info( - get_objects_params={ - "requests": [ - { - "attributesToRetrieve": [ - "attr1", - "attr2", - ], - "objectID": "uniqueID", - "indexName": "theIndexName", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "desc(post_date_timestamp)", ], }, ) - assert _req.path == "/1/indexes/*/objects" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"attributesToRetrieve":["attr1","attr2"],"objectID":"uniqueID","indexName":"theIndexName"}]}""" + """{"ranking":["desc(post_date_timestamp)"]}""" ) - def test_get_rule_(self): + async def test_set_settings_36(self): """ - getRule + ranking virtual replica """ - _req = self._client.get_rule_with_http_info( - index_name="cts_e2e_browse", - object_id="qr-1725004648916", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(post_date_timestamp)", + ], + }, ) - assert _req.path == "/1/indexes/cts_e2e_browse/rules/qr-1725004648916" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["desc(post_date_timestamp)"]}""" + ) - def test_get_settings_(self): + async def test_set_settings_37(self): """ - getSettings + customRanking and ranking sort alphabetically """ - _req = self._client.get_settings_with_http_info( - index_name="cts_e2e_settings", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "ranking": [ + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + ], + }, ) - assert _req.path == "/1/indexes/cts_e2e_settings/settings" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" + ) - def test_get_sources_(self): + async def test_set_settings_38(self): """ - getSources + relevancyStrictness """ - _req = self._client.get_sources_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "relevancyStrictness": 0, + }, + ) - assert _req.path == "/1/security/sources" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""" + ) - def test_get_synonym_(self): + async def test_set_settings_39(self): """ - getSynonym + create replica index """ - _req = self._client.get_synonym_with_http_info( - index_name="indexName", - object_id="id1", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "products_price_desc", + ], + }, ) - assert _req.path == "/1/indexes/indexName/synonyms/id1" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"replicas":["products_price_desc"]}""") - def test_get_task_(self): + async def test_set_settings_40(self): """ - getTask + create replica index articles """ - _req = self._client.get_task_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - task_id=123, + index_settings={ + "replicas": [ + "articles_date_desc", + ], + }, ) - assert _req.path == "/1/indexes/theIndexName/task/123" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"replicas":["articles_date_desc"]}""") - def test_get_top_user_ids_(self): + async def test_set_settings_41(self): """ - getTopUserIds + create virtual replica index """ - _req = self._client.get_top_user_ids_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "virtual(products_price_desc)", + ], + }, + ) - assert _req.path == "/1/clusters/mapping/top" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"replicas":["virtual(products_price_desc)"]}""" + ) - def test_get_user_id_(self): + async def test_set_settings_42(self): """ - getUserId + unlink replica index """ - _req = self._client.get_user_id_with_http_info( - user_id="uniqueID", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "", + ], + }, ) - assert _req.path == "/1/clusters/mapping/uniqueID" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"replicas":[""]}""") - def test_has_pending_mappings_(self): + async def test_set_settings_43(self): """ - hasPendingMappings with minimal parameters + forwardToReplicas """ - _req = self._client.has_pending_mappings_with_http_info() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "description", + ], + }, + forward_to_replicas=True, + ) - assert _req.path == "/1/clusters/mapping/pending" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"searchableAttributes":["name","description"]}""" + ) - def test_has_pending_mappings_1(self): + async def test_set_settings_44(self): """ - hasPendingMappings with parameters + maxValuesPerFacet """ - _req = self._client.has_pending_mappings_with_http_info( - get_clusters=True, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "maxValuesPerFacet": 1000, + }, ) - assert _req.path == "/1/clusters/mapping/pending" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {"getClusters": "true"}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") - def test_list_api_keys_(self): - """ - listApiKeys - """ - _req = self._client.list_api_keys_with_http_info() - - assert _req.path == "/1/keys" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert _req.data is None - - def test_list_clusters_(self): - """ - listClusters - """ - _req = self._client.list_clusters_with_http_info() - - assert _req.path == "/1/clusters" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert _req.data is None - - def test_list_indices_(self): - """ - listIndices with minimal parameters - """ - _req = self._client.list_indices_with_http_info() - - assert _req.path == "/1/indexes" - assert _req.verb == "GET" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert _req.data is None - - def test_list_indices_1(self): + async def test_set_settings_45(self): """ - listIndices with parameters + maxFacetHits """ - _req = self._client.list_indices_with_http_info( - page=8, - hits_per_page=3, - ) - - assert _req.path == "/1/indexes" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() == {"page": "8", "hitsPerPage": "3"}.items() + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "maxFacetHits": 1000, + }, ) - assert _req.headers.items() >= {}.items() - assert _req.data is None - - def test_list_user_ids_(self): - """ - listUserIds with minimal parameters - """ - _req = self._client.list_user_ids_with_http_info() - assert _req.path == "/1/clusters/mapping" - assert _req.verb == "GET" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None - - def test_list_user_ids_1(self): - """ - listUserIds with parameters - """ - _req = self._client.list_user_ids_with_http_info( - page=8, - hits_per_page=100, - ) - - assert _req.path == "/1/clusters/mapping" - assert _req.verb == "GET" - assert ( - _req.query_parameters.items() == {"page": "8", "hitsPerPage": "100"}.items() - ) - assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads("""{"maxFacetHits":1000}""") - def test_multiple_batch_(self): + async def test_set_settings_46(self): """ - multipleBatch + attributesForFaceting complex """ - _req = self._client.multiple_batch_with_http_info( - batch_params={ - "requests": [ - { - "action": "addObject", - "body": { - "key": "value", - }, - "indexName": "theIndexName", - }, + _req = await self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "actor", + "filterOnly(category)", + "searchable(publisher)", ], }, ) - assert _req.path == "/1/indexes/*/batch" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"action":"addObject","body":{"key":"value"},"indexName":"theIndexName"}]}""" + """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""" ) - def test_operation_index_(self): + async def test_set_settings_47(self): """ - scopes + ranking closest dates """ - _req = self._client.operation_index_with_http_info( - index_name="", - operation_index_params={ - "operation": "move", - "destination": "", - "scope": [ - "rules", - "settings", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", ], }, ) - assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"operation":"move","destination":"","scope":["rules","settings"]}""" + """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" ) - def test_operation_index_1(self): + async def test_set_settings_48(self): """ - copy + searchableAttributes item variation """ - _req = self._client.operation_index_with_http_info( - index_name="", - operation_index_params={ - "operation": "copy", - "destination": "", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "design", + "type", + "color", + ], }, ) - assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"operation":"copy","destination":""}""" + """{"searchableAttributes":["design","type","color"]}""" ) - def test_operation_index_2(self): + async def test_set_settings_49(self): """ - move + searchableAttributes around location """ - _req = self._client.operation_index_with_http_info( - index_name="", - operation_index_params={ - "operation": "move", - "destination": "", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "country", + "code", + "iata_code", + ], + "customRanking": [ + "desc(links_count)", + ], }, ) - assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"operation":"move","destination":""}""" + """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" ) - def test_partial_update_object_(self): + async def test_set_settings_50(self): """ - Partial update with a new value for a string attribute + attributesToHighlight """ - _req = self._client.partial_update_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "attributeId": "new value", + index_settings={ + "attributesToHighlight": [ + "author", + "title", + "content", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributeId":"new value"}""") - - def test_partial_update_object_1(self): - """ - Partial update with a new value for an integer attribute - """ - _req = self._client.partial_update_object_with_http_info( - index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "attributeId": 1, - }, + assert loads(_req.data) == loads( + """{"attributesToHighlight":["author","title","content"]}""" ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributeId":1}""") - - def test_partial_update_object_2(self): + async def test_set_settings_51(self): """ - Partial update with a new value for a boolean attribute + attributesToHighlightStar """ - _req = self._client.partial_update_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "attributeId": True, + index_settings={ + "attributesToHighlight": [ + "*", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributeId":true}""") + assert loads(_req.data) == loads("""{"attributesToHighlight":["*"]}""") - def test_partial_update_object_3(self): + async def test_set_settings_52(self): """ - Partial update with a new value for an array attribute + everything """ - _req = self._client.partial_update_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "attributeId": [ - "one", - "two", - "three", + index_settings={ + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], + "allowCompressionOfIntegerArray": True, + "allowTyposOnNumericTokens": True, + "alternativesAsExact": [ + "singleWordSynonym", + ], + "attributeCriteriaComputedByMinProximity": True, + "attributeForDistinct": "test", + "attributesForFaceting": [ + "algolia", + ], + "attributesToHighlight": [ + "algolia", + ], + "attributesToRetrieve": [ + "algolia", + ], + "attributesToSnippet": [ + "algolia", + ], + "attributesToTransliterate": [ + "algolia", + ], + "camelCaseAttributes": [ + "algolia", + ], + "customNormalization": { + "algolia": { + "aloglia": "aglolia", + }, + }, + "customRanking": [ + "algolia", + ], + "decompoundQuery": False, + "decompoundedAttributes": { + "algolia": "aloglia", + }, + "disableExactOnAttributes": [ + "algolia", + ], + "disablePrefixOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnWords": [ + "algolia", + ], + "distinct": 3, + "enablePersonalization": True, + "enableReRanking": False, + "enableRules": True, + "exactOnSingleWordQuery": "attribute", + "highlightPreTag": "", + "highlightPostTag": "", + "hitsPerPage": 10, + "ignorePlurals": False, + "indexLanguages": [ + "fr", + ], + "keepDiacriticsOnCharacters": "abc", + "maxFacetHits": 20, + "maxValuesPerFacet": 30, + "minProximity": 6, + "minWordSizefor1Typo": 5, + "minWordSizefor2Typos": 11, + "mode": "neuralSearch", + "numericAttributesForFiltering": [ + "algolia", + ], + "optionalWords": [ + "myspace", + ], + "paginationLimitedTo": 0, + "queryLanguages": [ + "fr", + ], + "queryType": "prefixLast", + "ranking": [ + "geo", + ], + "reRankingApplyFilter": "mySearch:filters", + "relevancyStrictness": 10, + "removeStopWords": False, + "removeWordsIfNoResults": "lastWords", + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "a", + "b", + ], + }, + "values": { + "a": { + "order": [ + "b", + ], + "sortRemainingBy": "count", + }, + }, + }, + }, + "replaceSynonymsInHighlight": True, + "replicas": [ + "", + ], + "responseFields": [ + "algolia", + ], + "restrictHighlightAndSnippetArrays": True, + "searchableAttributes": [ + "foo", + ], + "semanticSearch": { + "eventSources": [ + "foo", + ], + }, + "separatorsToIndex": "bar", + "snippetEllipsisText": "---", + "sortFacetValuesBy": "date", + "typoTolerance": False, + "unretrievableAttributes": [ + "foo", ], + "userData": { + "user": "data", + }, }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributeId":["one","two","three"]}""") + assert loads(_req.data) == loads( + """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" + ) - def test_partial_update_object_4(self): + async def test_set_settings_53(self): """ - Partial update with a new value for an object attribute + searchableAttributesWithCustomRankingsAndAttributesForFaceting """ - _req = self._client.partial_update_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "attributeId": { - "nested": "value", - }, + index_settings={ + "searchableAttributes": [ + "brand", + "name", + "categories", + "unordered(description)", + ], + "customRanking": [ + "desc(popularity)", + ], + "attributesForFaceting": [ + "searchable(brand)", + "type", + "categories", + "price", + ], }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributeId":{"nested":"value"}}""") + assert loads(_req.data) == loads( + """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" + ) - def test_partial_update_object_5(self): + async def test_set_settings_54(self): """ - with visible_by filter + searchableAttributesOrdering """ - _req = self._client.partial_update_object_with_http_info( + _req = await self._client.set_settings_with_http_info( index_name="theIndexName", - object_id="uniqueID", - attributes_to_update={ - "visible_by": [ - "Angela", - "group/Finance", - "group/Shareholders", + index_settings={ + "searchableAttributes": [ + "unordered(title)", + "cast", ], }, ) - assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"visible_by":["Angela","group/Finance","group/Shareholders"]}""" + """{"searchableAttributes":["unordered(title)","cast"]}""" ) - def test_remove_user_id_(self): + async def test_set_settings_55(self): """ - removeUserId + searchableAttributesProductReferenceSuffixes """ - _req = self._client.remove_user_id_with_http_info( - user_id="uniqueID", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "product_reference", + "product_reference_suffixes", + ], + }, ) - assert _req.path == "/1/clusters/mapping/uniqueID" - assert _req.verb == "DELETE" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert _req.data is None + assert loads(_req.data) == loads( + """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""" + ) - def test_replace_sources_(self): + async def test_set_settings_56(self): """ - replaceSources + queryLanguageAndIgnorePlurals """ - _req = self._client.replace_sources_with_http_info( - source=[ - { - "source": "theSource", - "description": "theDescription", - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryLanguages": [ + "en", + ], + "ignorePlurals": True, + }, ) - assert _req.path == "/1/security/sources" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """[{"source":"theSource","description":"theDescription"}]""" + """{"queryLanguages":["en"],"ignorePlurals":true}""" ) - def test_restore_api_key_(self): + async def test_set_settings_57(self): """ - restoreApiKey + searchableAttributesInMovies """ - _req = self._client.restore_api_key_with_http_info( - key="ALGOLIA_API_KEY", + _req = await self._client.set_settings_with_http_info( + index_name="movies", + index_settings={ + "searchableAttributes": [ + "title_eng", + "title_fr", + "title_es", + ], + }, ) - assert _req.path == "/1/keys/ALGOLIA_API_KEY/restore" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/movies/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"searchableAttributes":["title_eng","title_fr","title_es"]}""" + ) - def test_save_object_(self): + async def test_set_settings_58(self): """ - saveObject + disablePrefixOnAttributes """ - _req = self._client.save_object_with_http_info( - index_name="", - body={ - "objectID": "id", - "test": "val", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disablePrefixOnAttributes": [ + "serial_number", + ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"objectID":"id","test":"val"}""") + assert loads(_req.data) == loads( + """{"disablePrefixOnAttributes":["serial_number"]}""" + ) - def test_save_rule_(self): + async def test_set_settings_59(self): """ - saveRule with minimal parameters + disableTypoToleranceOnAttributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="id1", - rule={ - "objectID": "id1", - "conditions": [ - { - "pattern": "apple", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disableTypoToleranceOnAttributes": [ + "serial_number", ], - "consequence": { - "params": { - "filters": "brand:xiaomi", - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/id1" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:xiaomi"}}}""" + """{"disableTypoToleranceOnAttributes":["serial_number"]}""" ) - def test_save_rule_1(self): + async def test_set_settings_60(self): """ - saveRule with all parameters + searchableAttributesSimpleExample """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="id1", - rule={ - "objectID": "id1", - "conditions": [ - { - "pattern": "apple", - "anchoring": "contains", - "alternatives": False, - "context": "search", - }, - ], - "consequence": { - "params": { - "filters": "brand:apple", - "query": { - "remove": [ - "algolia", - ], - "edits": [ - { - "type": "remove", - "delete": "abc", - "insert": "cde", - }, - { - "type": "replace", - "delete": "abc", - "insert": "cde", - }, - ], - }, - }, - "hide": [ - { - "objectID": "321", - }, - ], - "filterPromotes": False, - "userData": { - "algolia": "aloglia", - }, - "promote": [ - { - "objectID": "abc", - "position": 3, - }, - { - "objectIDs": [ - "abc", - "def", - ], - "position": 1, - }, - ], - }, - "description": "test", - "enabled": True, - "validity": [ - { - "from": 1656670273, - "until": 1656670277, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "serial_number", ], }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/indexName/rules/id1" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains","alternatives":false,"context":"search"}],"consequence":{"params":{"filters":"brand:apple","query":{"remove":["algolia"],"edits":[{"type":"remove","delete":"abc","insert":"cde"},{"type":"replace","delete":"abc","insert":"cde"}]}},"hide":[{"objectID":"321"}],"filterPromotes":false,"userData":{"algolia":"aloglia"},"promote":[{"objectID":"abc","position":3},{"objectIDs":["abc","def"],"position":1}]},"description":"test","enabled":true,"validity":[{"from":1656670273,"until":1656670277}]}""" + """{"searchableAttributes":["serial_number"]}""" ) - def test_save_rule_2(self): + async def test_set_settings_61(self): """ - b2b catalog + searchableAttributesSimpleExampleAlt """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="article-rule", - rule={ - "objectID": "article-rule", - "conditions": [ - { - "pattern": "article", - "anchoring": "startsWith", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "serial_number", + "serial_number_suffixes", ], - "consequence": { - "params": { - "query": { - "edits": [ - { - "type": "remove", - "delete": "article", - }, - ], - }, - "restrictSearchableAttributes": [ - "title", - "book_id", - ], - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/article-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"article-rule","conditions":[{"pattern":"article","anchoring":"startsWith"}],"consequence":{"params":{"query":{"edits":[{"type":"remove","delete":"article"}]},"restrictSearchableAttributes":["title","book_id"]}}}""" + """{"searchableAttributes":["serial_number","serial_number_suffixes"]}""" ) - def test_save_rule_3(self): + async def test_set_settings_62(self): """ - merchandising and promoting + set_searchable_attributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="director-rule", - rule={ - "objectID": "director-rule", - "conditions": [ - { - "pattern": "{facet:director} director", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", ], - "consequence": { - "params": { - "restrictSearchableAttributes": [ - "title", - "book_id", - ], - "automaticFacetFilters": [ - { - "facet": "director", - }, - ], - "query": { - "edits": [ - { - "type": "remove", - "delete": "director", - }, - ], - }, - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/director-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"director-rule","conditions":[{"pattern":"{facet:director} director","anchoring":"contains"}],"consequence":{"params":{"restrictSearchableAttributes":["title","book_id"],"automaticFacetFilters":[{"facet":"director"}],"query":{"edits":[{"type":"remove","delete":"director"}]}}}}""" + """{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}""" ) - def test_save_rule_4(self): + async def test_set_settings_63(self): """ - harry potter + set_searchable_attributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="harry-potter-rule", - rule={ - "objectID": "harry-potter-rule", - "conditions": [ - { - "pattern": "harry potter", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesForFaceting": [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", ], - "consequence": { - "userData": { - "promo_content": "20% OFF on all Harry Potter books!", - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/harry-potter-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"harry-potter-rule","conditions":[{"pattern":"harry potter","anchoring":"contains"}],"consequence":{"userData":{"promo_content":"20% OFF on all Harry Potter books!"}}}""" + """{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}""" ) - def test_save_rule_5(self): + async def test_set_settings_64(self): """ - merchandising empty query + unretrievable_attributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="clearance-category-filter", - rule={ - "objectID": "clearance-category-filter", - "conditions": [ - { - "pattern": "", - "anchoring": "is", - "context": "landing", - }, - ], - "consequence": { - "params": { - "optionalFilters": "clearance:true", - }, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "unretrievableAttributes": [ + "total_number_of_sales", + ], }, ) - assert _req.path == "/1/indexes/indexName/rules/clearance-category-filter" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"clearance-category-filter","conditions":[{"pattern":"","anchoring":"is","context":"landing"}],"consequence":{"params":{"optionalFilters":"clearance:true"}}}""" + """{"unretrievableAttributes":["total_number_of_sales"]}""" ) - def test_save_rule_6(self): + async def test_set_settings_65(self): """ - redirect + set_retrievable_attributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="redirect-help-rule", - rule={ - "objectID": "redirect-help-rule", - "conditions": [ - { - "pattern": "help", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "author", + "title", + "content", ], - "consequence": { - "userData": { - "redirect": "https://www.algolia.com/support", - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/redirect-help-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"redirect-help-rule","conditions":[{"pattern":"help","anchoring":"contains"}],"consequence":{"userData":{"redirect":"https://www.algolia.com/support"}}}""" + """{"attributesToRetrieve":["author","title","content"]}""" ) - def test_save_rule_7(self): + async def test_set_settings_66(self): """ - promote some results over others + set_all_attributes_as_retrievable """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="tomato-fruit", - rule={ - "objectID": "tomato-fruit", - "conditions": [ - { - "pattern": "tomato", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "*", ], - "consequence": { - "params": { - "optionalFilters": "food_group:fruit", - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/tomato-fruit" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"tomato-fruit","conditions":[{"pattern":"tomato","anchoring":"contains"}],"consequence":{"params":{"optionalFilters":"food_group:fruit"}}}""" - ) + assert loads(_req.data) == loads("""{"attributesToRetrieve":["*"]}""") - def test_save_rule_8(self): + async def test_set_settings_67(self): """ - promote several hits + specify_attributes_not_to_retrieve """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="Promote-Apple-Newest", - rule={ - "objectID": "Promote-Apple-Newest", - "conditions": [ - { - "pattern": "apple", - "anchoring": "is", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "*", + "-SKU", + "-internal_desc", ], - "consequence": { - "promote": [ - { - "objectIDs": [ - "iPhone-12345", - "watch-123", - ], - "position": 0, - }, - ], - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/Promote-Apple-Newest" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"Promote-Apple-Newest","conditions":[{"pattern":"apple","anchoring":"is"}],"consequence":{"promote":[{"objectIDs":["iPhone-12345","watch-123"],"position":0}]}}""" + """{"attributesToRetrieve":["*","-SKU","-internal_desc"]}""" ) - def test_save_rule_9(self): + async def test_set_settings_68(self): """ - promote newest release + neural_search """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="Promote-iPhone-X", - rule={ - "objectID": "Promote-iPhone-X", - "conditions": [ - { - "pattern": "iPhone", - "anchoring": "contains", - }, - ], - "consequence": { - "promote": [ - { - "objectID": "iPhone-12345", - "position": 0, - }, - ], - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "neuralSearch", }, ) - assert _req.path == "/1/indexes/indexName/rules/Promote-iPhone-X" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"Promote-iPhone-X","conditions":[{"pattern":"iPhone","anchoring":"contains"}],"consequence":{"promote":[{"objectID":"iPhone-12345","position":0}]}}""" - ) + assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") - def test_save_rule_10(self): + async def test_set_settings_69(self): """ - promote single item + keyword_search """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="promote-harry-potter-box-set", - rule={ - "objectID": "promote-harry-potter-box-set", - "conditions": [ - { - "pattern": "Harry Potter", - "anchoring": "contains", - }, - ], - "consequence": { - "promote": [ - { - "objectID": "HP-12345", - "position": 0, - }, - ], - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "keywordSearch", }, ) - assert _req.path == "/1/indexes/indexName/rules/promote-harry-potter-box-set" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"promote-harry-potter-box-set","conditions":[{"pattern":"Harry Potter","anchoring":"contains"}],"consequence":{"promote":[{"objectID":"HP-12345","position":0}]}}""" - ) + assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") - def test_save_rule_11(self): + async def test_set_settings_70(self): """ - limit search results + set_default_ranking """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="article-rule", - rule={ - "objectID": "article-rule", - "conditions": [ - { - "pattern": "article", - "anchoring": "startsWith", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", ], - "consequence": { - "params": { - "query": { - "edits": [ - { - "type": "remove", - "delete": "article", - }, - ], - }, - "restrictSearchableAttributes": [ - "title", - "book_id", - ], - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/article-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"article-rule","conditions":[{"pattern":"article","anchoring":"startsWith"}],"consequence":{"params":{"query":{"edits":[{"type":"remove","delete":"article"}]},"restrictSearchableAttributes":["title","book_id"]}}}""" + """{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}""" ) - def test_save_rule_12(self): + async def test_set_settings_71(self): """ - query match + set_ranking_by_attribute_asc """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="tagged-brand-rule", - rule={ - "conditions": [ - { - "pattern": "brand: {facet:brand}", - "anchoring": "contains", - "alternatives": False, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", ], - "consequence": { - "params": { - "automaticFacetFilters": [ - { - "facet": "brand", - }, - ], - "query": { - "remove": [ - "brand:", - "{facet:brand}", - ], - }, - }, - }, - "description": "filter on brand: {brand}", - "objectID": "tagged-brand-rule", }, ) - assert _req.path == "/1/indexes/indexName/rules/tagged-brand-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"conditions":[{"pattern":"brand: {facet:brand}","anchoring":"contains","alternatives":false}],"consequence":{"params":{"automaticFacetFilters":[{"facet":"brand"}],"query":{"remove":["brand:","{facet:brand}"]}}},"description":"filter on brand: {brand}","objectID":"tagged-brand-rule"}""" + """{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" ) - def test_save_rule_13(self): + async def test_set_settings_72(self): """ - dynamic filtering + set_ranking_by_attribute_desc """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="color-facets", - rule={ - "objectID": "color-facets", - "conditions": [ - { - "pattern": "{facet:color}", - }, - ], - "consequence": { - "params": { - "automaticFacetFilters": [ - { - "facet": "color", - }, - ], - }, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], }, ) - assert _req.path == "/1/indexes/indexName/rules/color-facets" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"color-facets","conditions":[{"pattern":"{facet:color}"}],"consequence":{"params":{"automaticFacetFilters":[{"facet":"color"}]}}}""" + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" ) - def test_save_rule_14(self): + async def test_set_settings_73(self): """ - hide hits + restrict_searchable_attributes """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="hide-12345", - rule={ - "objectID": "hide-12345", - "conditions": [ - { - "pattern": "cheap", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(popularity)", + "asc(price)", ], - "consequence": { - "hide": [ - { - "objectID": "to-hide-12345", - }, - ], - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/hide-12345" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"hide-12345","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"hide":[{"objectID":"to-hide-12345"}]}}""" + """{"customRanking":["desc(popularity)","asc(price)"]}""" ) - def test_save_rule_15(self): + async def test_set_settings_74(self): """ - one rule per facet + set_default_relevancy """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="red-color", - rule={ - "objectID": "red-color", - "conditions": [ - { - "pattern": "red", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "relevancyStrictness": 90, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"relevancyStrictness":90}""") + + async def test_set_settings_75(self): + """ + set_replicas + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "name_of_replica_index1", + "name_of_replica_index2", ], - "consequence": { - "params": { - "query": { - "remove": [ - "red", - ], - }, - "filters": "color:red", - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/red-color" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"red-color","conditions":[{"pattern":"red","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["red"]},"filters":"color:red"}}}""" + """{"replicas":["name_of_replica_index1","name_of_replica_index2"]}""" ) - def test_save_rule_16(self): + async def test_set_settings_76(self): """ - numerical filters + set_default_max_values_per_facet """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="cheap", - rule={ - "objectID": "cheap", - "conditions": [ - { - "pattern": "cheap", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "query": { - "remove": [ - "cheap", - ], - }, - "filters": "price < 10", - }, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "maxValuesPerFacet": 100, }, ) - assert _req.path == "/1/indexes/indexName/rules/cheap" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"cheap","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["cheap"]},"filters":"price < 10"}}}""" + assert loads(_req.data) == loads("""{"maxValuesPerFacet":100}""") + + async def test_set_settings_77(self): + """ + set_default_sort_facet_values_by + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "sortFacetValuesBy": "alpha", + }, ) - def test_save_rule_17(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"sortFacetValuesBy":"alpha"}""") + + async def test_set_settings_78(self): """ - negative filters + set_attributes_to_snippet """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="gluten-free-rule", - rule={ - "objectID": "gluten-free-rule", - "conditions": [ - { - "pattern": "gluten-free", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToSnippet": [ + "content:80", + "description", ], - "consequence": { - "params": { - "filters": "NOT allergens:gluten", - "query": { - "edits": [ - { - "type": "remove", - "delete": "gluten-free", - }, - ], - }, - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/gluten-free-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"objectID":"gluten-free-rule","conditions":[{"pattern":"gluten-free","anchoring":"contains"}],"consequence":{"params":{"filters":"NOT allergens:gluten","query":{"edits":[{"type":"remove","delete":"gluten-free"}]}}}}""" + """{"attributesToSnippet":["content:80","description"]}""" ) - def test_save_rule_18(self): + async def test_set_settings_79(self): """ - positive filters + set_all_attributes_to_snippet """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="diet-rule", - rule={ - "objectID": "diet-rule", - "conditions": [ - { - "pattern": "diet", - "anchoring": "contains", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToSnippet": [ + "*:80", ], - "consequence": { - "params": { - "filters": "'low-carb' OR 'low-fat'", - "query": { - "edits": [ - { - "type": "remove", - "delete": "diet", - }, - ], - }, - }, - }, }, ) - assert _req.path == "/1/indexes/indexName/rules/diet-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"diet-rule","conditions":[{"pattern":"diet","anchoring":"contains"}],"consequence":{"params":{"filters":"'low-carb' OR 'low-fat'","query":{"edits":[{"type":"remove","delete":"diet"}]}}}}""" - ) + assert loads(_req.data) == loads("""{"attributesToSnippet":["*:80"]}""") - def test_save_rule_19(self): + async def test_set_settings_80(self): """ - conditionless + set_default_highlight_pre_tag """ - _req = self._client.save_rule_with_http_info( - index_name="indexName", - object_id="diet-rule", - rule={ - "objectID": "diet-rule", - "consequence": { - "params": { - "filters": "'low-carb' OR 'low-fat'", - "query": { - "edits": [ - { - "type": "remove", - "delete": "diet", - }, - ], - }, - }, - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "highlightPreTag": "", }, ) - assert _req.path == "/1/indexes/indexName/rules/diet-rule" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"diet-rule","consequence":{"params":{"filters":"'low-carb' OR 'low-fat'","query":{"edits":[{"type":"remove","delete":"diet"}]}}}}""" + assert loads(_req.data) == loads("""{"highlightPreTag":""}""") + + async def test_set_settings_81(self): + """ + set_default_highlight_post_tag + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "highlightPostTag": "", + }, ) - def test_save_rules_(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"highlightPostTag":""}""") + + async def test_set_settings_82(self): """ - saveRules with minimal parameters + set_default_snippet_ellipsis_text """ - _req = self._client.save_rules_with_http_info( - index_name="", - rules=[ - { - "objectID": "a-rule-id", - "conditions": [ - { - "pattern": "smartphone", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "filters": "brand:apple", - }, - }, - }, - { - "objectID": "a-second-rule-id", - "conditions": [ - { - "pattern": "apple", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "filters": "brand:samsung", - }, - }, - }, - ], - forward_to_replicas=False, - clear_existing_rules=True, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "snippetEllipsisText": "…", + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"forwardToReplicas": "false", "clearExistingRules": "true"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """[{"objectID":"a-rule-id","conditions":[{"pattern":"smartphone","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:apple"}}},{"objectID":"a-second-rule-id","conditions":[{"pattern":"apple","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:samsung"}}}]""" - ) + assert loads(_req.data) == loads("""{"snippetEllipsisText":"…"}""") - def test_save_rules_1(self): + async def test_set_settings_83(self): """ - saveRules with all parameters + enable_restrict_highlight_and_snippet_arrays_by_default """ - _req = self._client.save_rules_with_http_info( - index_name="", - rules=[ - { - "objectID": "id1", - "conditions": [ - { - "pattern": "apple", - "anchoring": "contains", - "alternatives": False, - "context": "search", - }, - ], - "consequence": { - "params": { - "filters": "brand:apple", - "query": { - "remove": [ - "algolia", - ], - "edits": [ - { - "type": "remove", - "delete": "abc", - "insert": "cde", - }, - { - "type": "replace", - "delete": "abc", - "insert": "cde", - }, - ], - }, - }, - "hide": [ - { - "objectID": "321", - }, - ], - "filterPromotes": False, - "userData": { - "algolia": "aloglia", - }, - "promote": [ - { - "objectID": "abc", - "position": 3, - }, - { - "objectIDs": [ - "abc", - "def", - ], - "position": 1, - }, - ], - }, - "description": "test", - "enabled": True, - "validity": [ - { - "from": 1656670273, - "until": 1656670277, - }, - ], - }, - ], - forward_to_replicas=True, - clear_existing_rules=True, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "restrictHighlightAndSnippetArrays": True, + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"forwardToReplicas": "true", "clearExistingRules": "true"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """[{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains","alternatives":false,"context":"search"}],"consequence":{"params":{"filters":"brand:apple","query":{"remove":["algolia"],"edits":[{"type":"remove","delete":"abc","insert":"cde"},{"type":"replace","delete":"abc","insert":"cde"}]}},"hide":[{"objectID":"321"}],"filterPromotes":false,"userData":{"algolia":"aloglia"},"promote":[{"objectID":"abc","position":3},{"objectIDs":["abc","def"],"position":1}]},"description":"test","enabled":true,"validity":[{"from":1656670273,"until":1656670277}]}]""" + """{"restrictHighlightAndSnippetArrays":true}""" ) - def test_save_rules_2(self): + async def test_set_settings_84(self): """ - dynamic filtering + set_default_hits_per_page """ - _req = self._client.save_rules_with_http_info( - index_name="", - rules=[ - { - "objectID": "toaster", - "conditions": [ - { - "pattern": "toaster", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "query": { - "remove": [ - "toaster", - ], - }, - "filters": "product_type:toaster", - }, - }, - }, - { - "objectID": "cheap", - "conditions": [ - { - "pattern": "cheap", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "query": { - "remove": [ - "cheap", - ], - }, - "filters": "price < 15", - }, - }, - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "hitsPerPage": 20, + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """[{"objectID":"toaster","conditions":[{"pattern":"toaster","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["toaster"]},"filters":"product_type:toaster"}}},{"objectID":"cheap","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["cheap"]},"filters":"price < 15"}}}]""" - ) + assert loads(_req.data) == loads("""{"hitsPerPage":20}""") - def test_save_rules_3(self): + async def test_set_settings_85(self): """ - enhance search results + set_pagination_limit """ - _req = self._client.save_rules_with_http_info( - index_name="", - rules=[ - { - "objectID": "country", - "conditions": [ - { - "pattern": "{facet:country}", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "aroundLatLngViaIP": False, - }, - }, - }, - { - "objectID": "city", - "conditions": [ - { - "pattern": "{facet:city}", - "anchoring": "contains", - }, - ], - "consequence": { - "params": { - "aroundLatLngViaIP": False, - }, - }, - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "paginationLimitedTo": 1000, + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """[{"objectID":"country","conditions":[{"pattern":"{facet:country}","anchoring":"contains"}],"consequence":{"params":{"aroundLatLngViaIP":false}}},{"objectID":"city","conditions":[{"pattern":"{facet:city}","anchoring":"contains"}],"consequence":{"params":{"aroundLatLngViaIP":false}}}]""" - ) + assert loads(_req.data) == loads("""{"paginationLimitedTo":1000}""") - def test_save_synonym_(self): + async def test_set_settings_86(self): """ - saveSynonym + set_default_min_word_size_for_one_typo """ - _req = self._client.save_synonym_with_http_info( - index_name="indexName", - object_id="id1", - synonym_hit={ - "objectID": "id1", - "type": "synonym", - "synonyms": [ - "car", - "vehicule", - "auto", - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "minWordSizefor1Typo": 4, }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/indexName/synonyms/id1" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"objectID":"id1","type":"synonym","synonyms":["car","vehicule","auto"]}""" - ) + assert loads(_req.data) == loads("""{"minWordSizefor1Typo":4}""") - def test_save_synonyms_(self): + async def test_set_settings_87(self): """ - saveSynonyms + set_default_min_word_size_for_two_typos """ - _req = self._client.save_synonyms_with_http_info( - index_name="", - synonym_hit=[ - { - "objectID": "id1", - "type": "synonym", - "synonyms": [ - "car", - "vehicule", - "auto", - ], - }, - { - "objectID": "id2", - "type": "onewaysynonym", - "input": "iphone", - "synonyms": [ - "ephone", - "aphone", - "yphone", - ], - }, - ], - forward_to_replicas=True, - replace_existing_synonyms=True, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "minWordSizefor2Typos": 4, + }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/synonyms/batch" - assert _req.verb == "POST" - assert ( - _req.query_parameters.items() - == {"forwardToReplicas": "true", "replaceExistingSynonyms": "true"}.items() - ) + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """[{"objectID":"id1","type":"synonym","synonyms":["car","vehicule","auto"]},{"objectID":"id2","type":"onewaysynonym","input":"iphone","synonyms":["ephone","aphone","yphone"]}]""" - ) + assert loads(_req.data) == loads("""{"minWordSizefor2Typos":4}""") - def test_search_(self): + async def test_set_settings_88(self): """ - withHitsPerPage + set_default_typo_tolerance_mode """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "hitsPerPage": 50, - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "typoTolerance": True, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","hitsPerPage":50}]}""" + assert loads(_req.data) == loads("""{"typoTolerance":true}""") + + async def test_set_settings_89(self): + """ + disable_typos_on_numeric_tokens_by_default + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "allowTyposOnNumericTokens": False, + }, ) - def test_search_1(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"allowTyposOnNumericTokens":false}""") + + async def test_set_settings_90(self): """ - filterOnly + disable_typo_tolerance_for_words """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "filters": "actor:Scarlett Johansson", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disableTypoToleranceOnWords": [ + "wheel", + "1X2BCD", ], }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","filters":"actor:Scarlett Johansson"}]}""" + """{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}""" ) - def test_search_2(self): + async def test_set_settings_91(self): """ - filterOr + set_separators_to_index """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "filters": "actor:Tom Cruise OR actor:Scarlett Johansson", - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "separatorsToIndex": "+#", }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","filters":"actor:Tom Cruise OR actor:Scarlett Johansson"}]}""" - ) + assert loads(_req.data) == loads("""{"separatorsToIndex":"+#"}""") - def test_search_3(self): + async def test_set_settings_92(self): """ - filterNot + set_languages_using_querylanguages """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "filters": "NOT actor:Nicolas Cage", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryLanguages": [ + "es", ], + "ignorePlurals": True, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","filters":"NOT actor:Nicolas Cage"}]}""" + """{"queryLanguages":["es"],"ignorePlurals":true}""" ) - def test_search_4(self): + async def test_set_settings_93(self): """ - search for a single hits request with minimal parameters + set_attributes_to_transliterate """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "cts_e2e_search_empty_index", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "indexLanguages": [ + "ja", + ], + "attributesToTransliterate": [ + "name", + "description", ], }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"cts_e2e_search_empty_index"}]}""" + """{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}""" ) - def test_search_5(self): + async def test_set_settings_94(self): """ - search with highlight and snippet results + set_languages_using_querylanguages """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "cts_e2e_highlight_snippet_results", - "query": "vim", - "attributesToSnippet": [ - "*:20", - ], - "attributesToHighlight": [ - "*", - ], - "attributesToRetrieve": [ - "*", - ], - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryLanguages": [ + "es", ], + "removeStopWords": True, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"cts_e2e_highlight_snippet_results","query":"vim","attributesToSnippet":["*:20"],"attributesToHighlight":["*"],"attributesToRetrieve":["*"]}]}""" + """{"queryLanguages":["es"],"removeStopWords":true}""" ) - def test_search_6(self): + async def test_set_settings_95(self): """ - retrieveFacets + set_camel_case_attributes """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "facets": [ - "author", - "genre", - ], - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "camelCaseAttributes": [ + "description", ], }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","facets":["author","genre"]}]}""" - ) + assert loads(_req.data) == loads("""{"camelCaseAttributes":["description"]}""") - def test_search_7(self): + async def test_set_settings_96(self): """ - retrieveFacetsWildcard + set_decompounded_attributes """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "", - "query": "", - "facets": [ - "*", - ], - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "decompoundedAttributes": { + "de": [ + "name", + ], + }, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"","query":"","facets":["*"]}]}""" + """{"decompoundedAttributes":{"de":["name"]}}""" ) - def test_search_8(self): + async def test_set_settings_97(self): """ - search for a single facet request with minimal parameters + set_decompounded_multiple_attributes """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "cts_e2e_search_facet", - "type": "facet", - "facet": "editor", - }, - ], - "strategy": "stopIfEnoughMatches", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "decompoundedAttributes": { + "de": [ + "name_de", + "description_de", + ], + "fi": [ + "name_fi", + "description_fi", + ], + }, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"cts_e2e_search_facet","type":"facet","facet":"editor"}],"strategy":"stopIfEnoughMatches"}""" + """{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}""" ) - def test_search_9(self): + async def test_set_settings_98(self): """ - search for a single hits request with all parameters + set_keep_diacritics_on_characters """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "theIndexName", - "query": "myQuery", - "hitsPerPage": 50, - "type": "default", - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "keepDiacriticsOnCharacters": "øé", }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"theIndexName","query":"myQuery","hitsPerPage":50,"type":"default"}]}""" - ) + assert loads(_req.data) == loads("""{"keepDiacriticsOnCharacters":"øé"}""") - def test_search_10(self): + async def test_set_settings_99(self): """ - search for a single facet request with all parameters + set_custom_normalization """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "theIndexName", - "type": "facet", - "facet": "theFacet", - "facetQuery": "theFacetQuery", - "query": "theQuery", - "maxFacetHits": 50, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customNormalization": { + "default": { + "ä": "ae", }, - ], - "strategy": "stopIfEnoughMatches", + }, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"theIndexName","type":"facet","facet":"theFacet","facetQuery":"theFacetQuery","query":"theQuery","maxFacetHits":50}],"strategy":"stopIfEnoughMatches"}""" + """{"customNormalization":{"default":{"ä":"ae"}}}""" ) - def test_search_11(self): + async def test_set_settings_100(self): """ - search for multiple mixed requests in multiple indices with minimal parameters + set_languages_using_querylanguages """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "theIndexName", - }, - { - "indexName": "theIndexName2", - "type": "facet", - "facet": "theFacet", - }, - { - "indexName": "theIndexName", - "type": "default", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryLanguages": [ + "es", ], - "strategy": "stopIfEnoughMatches", + "removeStopWords": True, + "ignorePlurals": True, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"indexName":"theIndexName"},{"indexName":"theIndexName2","type":"facet","facet":"theFacet"},{"indexName":"theIndexName","type":"default"}],"strategy":"stopIfEnoughMatches"}""" + """{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}""" ) - def test_search_12(self): + async def test_set_settings_101(self): """ - search for multiple mixed requests in multiple indices with all parameters + set_indexlanguages """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "theIndexName", - "type": "facet", - "facet": "theFacet", - "facetQuery": "theFacetQuery", - "query": "theQuery", - "maxFacetHits": 50, - }, - { - "indexName": "theIndexName", - "query": "myQuery", - "hitsPerPage": 50, - "type": "default", - }, + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "indexLanguages": [ + "ja", ], - "strategy": "stopIfEnoughMatches", }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"theIndexName","type":"facet","facet":"theFacet","facetQuery":"theFacetQuery","query":"theQuery","maxFacetHits":50},{"indexName":"theIndexName","query":"myQuery","hitsPerPage":50,"type":"default"}],"strategy":"stopIfEnoughMatches"}""" + assert loads(_req.data) == loads("""{"indexLanguages":["ja"]}""") + + async def test_set_settings_102(self): + """ + enable_decompound_query_by_default + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "decompoundQuery": True, + }, ) - def test_search_13(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"decompoundQuery":true}""") + + async def test_set_settings_103(self): """ - search filters accept all of the possible shapes + enable_rules_syntax_by_default """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "theIndexName", - "facetFilters": "mySearch:filters", - "reRankingApplyFilter": "mySearch:filters", - "tagFilters": "mySearch:filters", - "numericFilters": "mySearch:filters", - "optionalFilters": "mySearch:filters", - }, - { - "indexName": "theIndexName", - "facetFilters": [ - "mySearch:filters", - [ - "mySearch:filters", - [ - "mySearch:filters", - ], - ], - ], - "reRankingApplyFilter": [ - "mySearch:filters", - [ - "mySearch:filters", - ], - ], - "tagFilters": [ - "mySearch:filters", - [ - "mySearch:filters", - ], - ], - "numericFilters": [ - "mySearch:filters", - [ - "mySearch:filters", - ], - ], - "optionalFilters": [ - "mySearch:filters", - [ - "mySearch:filters", - ], - ], - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "enableRules": True, }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"theIndexName","facetFilters":"mySearch:filters","reRankingApplyFilter":"mySearch:filters","tagFilters":"mySearch:filters","numericFilters":"mySearch:filters","optionalFilters":"mySearch:filters"},{"indexName":"theIndexName","facetFilters":["mySearch:filters",["mySearch:filters",["mySearch:filters"]]],"reRankingApplyFilter":["mySearch:filters",["mySearch:filters"]],"tagFilters":["mySearch:filters",["mySearch:filters"]],"numericFilters":["mySearch:filters",["mySearch:filters"]],"optionalFilters":["mySearch:filters",["mySearch:filters"]]}]}""" + assert loads(_req.data) == loads("""{"enableRules":true}""") + + async def test_set_settings_104(self): + """ + enable_personalization_settings + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "enablePersonalization": True, + }, ) - def test_search_14(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"enablePersonalization":true}""") + + async def test_set_settings_105(self): """ - search filters end to end + set_default_query_type """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "indexName": "cts_e2e_search_facet", - "filters": "editor:'visual studio' OR editor:neovim", - }, - { - "indexName": "cts_e2e_search_facet", - "facetFilters": [ - "editor:'visual studio'", - "editor:neovim", - ], - }, - { - "indexName": "cts_e2e_search_facet", - "facetFilters": [ - "editor:'visual studio'", - [ - "editor:neovim", - ], - ], - }, - { - "indexName": "cts_e2e_search_facet", - "facetFilters": [ - "editor:'visual studio'", - [ - "editor:neovim", - [ - "editor:goland", - ], - ], - ], - }, - ], + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryType": "prefixLast", }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"requests":[{"indexName":"cts_e2e_search_facet","filters":"editor:'visual studio' OR editor:neovim"},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'","editor:neovim"]},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'",["editor:neovim"]]},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'",["editor:neovim",["editor:goland"]]]}]}""" + assert loads(_req.data) == loads("""{"queryType":"prefixLast"}""") + + async def test_set_settings_106(self): + """ + set_default_remove_words_if_no_result + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "removeWordsIfNoResults": "none", + }, ) - def test_search_15(self): + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"removeWordsIfNoResults":"none"}""") + + async def test_set_settings_107(self): """ - search with all search parameters + enable_advanced_syntax_by_default """ - _req = self._client.search_with_http_info( - search_method_params={ - "requests": [ - { - "advancedSyntax": True, - "advancedSyntaxFeatures": [ - "exactPhrase", + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "advancedSyntax": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"advancedSyntax":true}""") + + async def test_set_settings_108(self): + """ + set_default_optional_words + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "optionalWords": [ + "blue", + "iphone case", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"optionalWords":["blue","iphone case"]}""") + + async def test_set_settings_109(self): + """ + disabling_prefix_search_for_some_attributes_by_default + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disablePrefixOnAttributes": [ + "sku", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"disablePrefixOnAttributes":["sku"]}""") + + async def test_set_settings_110(self): + """ + disabling_exact_for_some_attributes_by_default + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disableExactOnAttributes": [ + "description", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"disableExactOnAttributes":["description"]}""" + ) + + async def test_set_settings_111(self): + """ + set_default_exact_single_word_query + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "exactOnSingleWordQuery": "attribute", + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"exactOnSingleWordQuery":"attribute"}""") + + async def test_set_settings_112(self): + """ + set_default_aternative_as_exact + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "alternativesAsExact": [ + "ignorePlurals", + "singleWordSynonym", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}""" + ) + + async def test_set_settings_113(self): + """ + enable_advanced_syntax_by_default + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "advancedSyntax": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"advancedSyntax":true}""") + + async def test_set_settings_114(self): + """ + set_numeric_attributes_for_filtering + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "numericAttributesForFiltering": [ + "quantity", + "popularity", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"numericAttributesForFiltering":["quantity","popularity"]}""" + ) + + async def test_set_settings_115(self): + """ + enable_compression_of_integer_array + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "allowCompressionOfIntegerArray": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"allowCompressionOfIntegerArray":true}""") + + async def test_set_settings_116(self): + """ + set_attributes_for_distinct + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "url", + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeForDistinct":"url"}""") + + async def test_set_settings_117(self): + """ + set_distinct + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": 1, + "attributeForDistinct": "url", + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"distinct":1,"attributeForDistinct":"url"}""" + ) + + async def test_set_settings_118(self): + """ + set_replace_synonyms_in_highlights + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replaceSynonymsInHighlight": False, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"replaceSynonymsInHighlight":false}""") + + async def test_set_settings_119(self): + """ + set_min_proximity + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "minProximity": 1, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"minProximity":1}""") + + async def test_set_settings_120(self): + """ + set_default_field + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "responseFields": [ + "hits", + "hitsPerPage", + "nbPages", + "page", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"responseFields":["hits","hitsPerPage","nbPages","page"]}""" + ) + + async def test_set_settings_121(self): + """ + set_max_facet_hits + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "maxFacetHits": 10, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"maxFacetHits":10}""") + + async def test_set_settings_122(self): + """ + set_attribute_criteria_computed_by_min_proximity + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeCriteriaComputedByMinProximity": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributeCriteriaComputedByMinProximity":true}""" + ) + + async def test_set_settings_123(self): + """ + set_user_data + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "userData": { + "extraData": "This is the custom data that you want to store in your index", + }, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"userData":{"extraData":"This is the custom data that you want to store in your index"}}""" + ) + + async def test_set_settings_124(self): + """ + set_rendering_content + """ + _req = await self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "size", + "brand", + ], + }, + "values": { + "brand": { + "order": [ + "uniqlo", + ], + "hide": [ + "muji", + ], + "sortRemainingBy": "count", + }, + "size": { + "order": [ + "S", + "M", + "L", + ], + "sortRemainingBy": "hidden", + }, + }, + }, + }, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}""" + ) + + async def test_update_api_key_(self): + """ + updateApiKey + """ + _req = await self._client.update_api_key_with_http_info( + key="ALGOLIA_API_KEY", + api_key={ + "acl": [ + "search", + "addObject", + ], + "validity": 300, + "maxQueriesPerIPPerHour": 100, + "maxHitsPerQuery": 20, + }, + ) + + assert _req.path == "/1/keys/ALGOLIA_API_KEY" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"acl":["search","addObject"],"validity":300,"maxQueriesPerIPPerHour":100,"maxHitsPerQuery":20}""" + ) + + +class TestSearchClientSync: + _config = SearchConfig("test_app_id", "test_api_key") + _client = SearchClientSync.create_with_config( + config=_config, transporter=EchoTransporterSync(_config) + ) + + def test_add_api_key_(self): + """ + addApiKey + """ + _req = self._client.add_api_key_with_http_info( + api_key={ + "acl": [ + "search", + "addObject", + ], + "description": "my new api key", + "validity": 300, + "maxQueriesPerIPPerHour": 100, + "maxHitsPerQuery": 20, + }, + ) + + assert _req.path == "/1/keys" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"acl":["search","addObject"],"description":"my new api key","validity":300,"maxQueriesPerIPPerHour":100,"maxHitsPerQuery":20}""" + ) + + def test_add_or_update_object_(self): + """ + addOrUpdateObject + """ + _req = self._client.add_or_update_object_with_http_info( + index_name="indexName", + object_id="uniqueID", + body={ + "key": "value", + }, + ) + + assert _req.path == "/1/indexes/indexName/uniqueID" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"key":"value"}""") + + def test_append_source_(self): + """ + appendSource + """ + _req = self._client.append_source_with_http_info( + source={ + "source": "theSource", + "description": "theDescription", + }, + ) + + assert _req.path == "/1/security/sources/append" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"source":"theSource","description":"theDescription"}""" + ) + + def test_assign_user_id_(self): + """ + simple + """ + _req = self._client.assign_user_id_with_http_info( + x_algolia_user_id="user42", + assign_user_id_params={ + "cluster": "d4242-eu", + }, + ) + + assert _req.path == "/1/clusters/mapping" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {"x-algolia-user-id": "user42"}.items() + assert loads(_req.data) == loads("""{"cluster":"d4242-eu"}""") + + def test_assign_user_id_1(self): + """ + it should not encode the userID + """ + _req = self._client.assign_user_id_with_http_info( + x_algolia_user_id="user id with spaces", + assign_user_id_params={ + "cluster": "cluster with spaces", + }, + ) + + assert _req.path == "/1/clusters/mapping" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert ( + _req.headers.items() >= {"x-algolia-user-id": "user id with spaces"}.items() + ) + assert loads(_req.data) == loads("""{"cluster":"cluster with spaces"}""") + + def test_batch_(self): + """ + addObject + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "addObject", + "body": { + "key": "bar", + "foo": "1", + }, + }, + { + "action": "addObject", + "body": { + "key": "baz", + "foo": "2", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"addObject","body":{"key":"bar","foo":"1"}},{"action":"addObject","body":{"key":"baz","foo":"2"}}]}""" + ) + + def test_batch_1(self): + """ + clear + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "clear", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"clear","body":{"key":"value"}}]}""" + ) + + def test_batch_2(self): + """ + delete + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "delete", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"delete","body":{"key":"value"}}]}""" + ) + + def test_batch_3(self): + """ + deleteObject + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "deleteObject", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"deleteObject","body":{"key":"value"}}]}""" + ) + + def test_batch_4(self): + """ + partialUpdateObject + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "partialUpdateObject", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"partialUpdateObject","body":{"key":"value"}}]}""" + ) + + def test_batch_5(self): + """ + partialUpdateObjectNoCreate + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "partialUpdateObjectNoCreate", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"partialUpdateObjectNoCreate","body":{"key":"value"}}]}""" + ) + + def test_batch_6(self): + """ + updateObject + """ + _req = self._client.batch_with_http_info( + index_name="", + batch_write_params={ + "requests": [ + { + "action": "updateObject", + "body": { + "key": "value", + }, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"updateObject","body":{"key":"value"}}]}""" + ) + + def test_batch_assign_user_ids_(self): + """ + batchAssignUserIds + """ + _req = self._client.batch_assign_user_ids_with_http_info( + x_algolia_user_id="userID", + batch_assign_user_ids_params={ + "cluster": "theCluster", + "users": [ + "user1", + "user2", + ], + }, + ) + + assert _req.path == "/1/clusters/mapping/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {"x-algolia-user-id": "userID"}.items() + assert loads(_req.data) == loads( + """{"cluster":"theCluster","users":["user1","user2"]}""" + ) + + def test_batch_dictionary_entries_(self): + """ + replace + """ + _req = self._client.batch_dictionary_entries_with_http_info( + dictionary_name="plurals", + batch_dictionary_entries_params={ + "clearExistingDictionaryEntries": True, + "requests": [ + { + "action": "addEntry", + "body": { + "objectID": "1", + "language": "en", + "word": "fancy", + "words": [ + "believe", + "algolia", + ], + "decomposition": [ + "trust", + "algolia", + ], + "state": "enabled", + }, + }, + ], + }, + ) + + assert _req.path == "/1/dictionaries/plurals/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"clearExistingDictionaryEntries":true,"requests":[{"action":"addEntry","body":{"objectID":"1","language":"en","word":"fancy","words":["believe","algolia"],"decomposition":["trust","algolia"],"state":"enabled"}}]}""" + ) + + def test_batch_dictionary_entries_1(self): + """ + delete + """ + _req = self._client.batch_dictionary_entries_with_http_info( + dictionary_name="plurals", + batch_dictionary_entries_params={ + "clearExistingDictionaryEntries": True, + "requests": [ + { + "action": "deleteEntry", + "body": { + "objectID": "1", + }, + }, + ], + }, + ) + + assert _req.path == "/1/dictionaries/plurals/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"clearExistingDictionaryEntries":true,"requests":[{"action":"deleteEntry","body":{"objectID":"1"}}]}""" + ) + + def test_batch_dictionary_entries_2(self): + """ + append + """ + _req = self._client.batch_dictionary_entries_with_http_info( + dictionary_name="stopwords", + batch_dictionary_entries_params={ + "requests": [ + { + "action": "addEntry", + "body": { + "objectID": "1", + "language": "en", + "additional": "try me", + }, + }, + ], + }, + ) + + assert _req.path == "/1/dictionaries/stopwords/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"addEntry","body":{"objectID":"1","language":"en","additional":"try me"}}]}""" + ) + + def test_browse_(self): + """ + browse with minimal parameters + """ + _req = self._client.browse_with_http_info( + index_name="cts_e2e_browse", + ) + + assert _req.path == "/1/indexes/cts_e2e_browse/browse" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_browse_1(self): + """ + browse with search parameters + """ + _req = self._client.browse_with_http_info( + index_name="indexName", + browse_params={ + "query": "myQuery", + "facetFilters": [ + "tags:algolia", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/browse" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"myQuery","facetFilters":["tags:algolia"]}""" + ) + + def test_browse_2(self): + """ + browse allow a cursor in parameters + """ + _req = self._client.browse_with_http_info( + index_name="indexName", + browse_params={ + "cursor": "test", + }, + ) + + assert _req.path == "/1/indexes/indexName/browse" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"cursor":"test"}""") + + def test_clear_objects_(self): + """ + clearObjects + """ + _req = self._client.clear_objects_with_http_info( + index_name="theIndexName", + ) + + assert _req.path == "/1/indexes/theIndexName/clear" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + + def test_clear_rules_(self): + """ + clearRules + """ + _req = self._client.clear_rules_with_http_info( + index_name="indexName", + ) + + assert _req.path == "/1/indexes/indexName/rules/clear" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + + def test_clear_synonyms_(self): + """ + clearSynonyms + """ + _req = self._client.clear_synonyms_with_http_info( + index_name="indexName", + ) + + assert _req.path == "/1/indexes/indexName/synonyms/clear" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + + def test_custom_delete_(self): + """ + allow del method for a custom path with minimal parameters + """ + _req = self._client.custom_delete_with_http_info( + path="test/minimal", + ) + + assert _req.path == "/test/minimal" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_custom_delete_1(self): + """ + allow del method for a custom path with all parameters + """ + _req = self._client.custom_delete_with_http_info( + path="test/all", + parameters={ + "query": "parameters", + }, + ) + + assert _req.path == "/test/all" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_custom_get_(self): + """ + allow get method for a custom path with minimal parameters + """ + _req = self._client.custom_get_with_http_info( + path="test/minimal", + ) + + assert _req.path == "/test/minimal" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_custom_get_1(self): + """ + allow get method for a custom path with all parameters + """ + _req = self._client.custom_get_with_http_info( + path="test/all", + parameters={ + "query": "parameters with space", + }, + ) + + assert _req.path == "/test/all" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() + == {"query": "parameters%20with%20space"}.items() + ) + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_custom_get_2(self): + """ + requestOptions should be escaped too + """ + _req = self._client.custom_get_with_http_info( + path="test/all", + parameters={ + "query": "to be overriden", + }, + request_options={ + "headers": loads("""{"x-header-1":"spaces are left alone"}"""), + "query_parameters": loads( + """{"query":"parameters with space","and an array":["array","with spaces"]}""" + ), + }, + ) + + assert _req.path == "/test/all" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() + == { + "query": "parameters%20with%20space", + "and%20an%20array": "array%2Cwith%20spaces", + }.items() + ) + assert _req.headers.items() >= {"x-header-1": "spaces are left alone"}.items() + assert _req.data is None + + def test_custom_post_(self): + """ + allow post method for a custom path with minimal parameters + """ + _req = self._client.custom_post_with_http_info( + path="test/minimal", + ) + + assert _req.path == "/test/minimal" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_custom_post_1(self): + """ + allow post method for a custom path with all parameters + """ + _req = self._client.custom_post_with_http_info( + path="test/all", + parameters={ + "query": "parameters", + }, + body={ + "body": "parameters", + }, + ) + + assert _req.path == "/test/all" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"body":"parameters"}""") + + def test_custom_post_2(self): + """ + requestOptions can override default query parameters + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"query":"myQueryParameter"}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {"query": "myQueryParameter"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_3(self): + """ + requestOptions merges query parameters with default ones + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"query2":"myQueryParameter"}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "query2": "myQueryParameter"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_4(self): + """ + requestOptions can override default headers + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "headers": loads("""{"x-algolia-api-key":"ALGOLIA_API_KEY"}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.headers.items() >= {"x-algolia-api-key": "ALGOLIA_API_KEY"}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_5(self): + """ + requestOptions merges headers with default ones + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "headers": loads("""{"x-algolia-api-key":"ALGOLIA_API_KEY"}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.headers.items() >= {"x-algolia-api-key": "ALGOLIA_API_KEY"}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_6(self): + """ + requestOptions queryParameters accepts booleans + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"isItWorking":true}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "isItWorking": "true"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_7(self): + """ + requestOptions queryParameters accepts integers + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"myParam":2}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "myParam": "2"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_8(self): + """ + requestOptions queryParameters accepts list of string + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"myParam":["b and c","d"]}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "myParam": "b%20and%20c%2Cd"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_9(self): + """ + requestOptions queryParameters accepts list of booleans + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"myParam":[true,true,false]}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "myParam": "true%2Ctrue%2Cfalse"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_post_10(self): + """ + requestOptions queryParameters accepts list of integers + """ + _req = self._client.custom_post_with_http_info( + path="test/requestOptions", + parameters={ + "query": "parameters", + }, + body={ + "facet": "filters", + }, + request_options={ + "query_parameters": loads("""{"myParam":[1,2]}"""), + }, + ) + + assert _req.path == "/test/requestOptions" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"query": "parameters", "myParam": "1%2C2"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facet":"filters"}""") + + def test_custom_put_(self): + """ + allow put method for a custom path with minimal parameters + """ + _req = self._client.custom_put_with_http_info( + path="test/minimal", + ) + + assert _req.path == "/test/minimal" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_custom_put_1(self): + """ + allow put method for a custom path with all parameters + """ + _req = self._client.custom_put_with_http_info( + path="test/all", + parameters={ + "query": "parameters", + }, + body={ + "body": "parameters", + }, + ) + + assert _req.path == "/test/all" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"query": "parameters"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"body":"parameters"}""") + + def test_delete_api_key_(self): + """ + deleteApiKey + """ + _req = self._client.delete_api_key_with_http_info( + key="myTestApiKey", + ) + + assert _req.path == "/1/keys/myTestApiKey" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_by_(self): + """ + deleteBy + """ + _req = self._client.delete_by_with_http_info( + index_name="theIndexName", + delete_by_params={ + "filters": "brand:brandName", + }, + ) + + assert _req.path == "/1/indexes/theIndexName/deleteByQuery" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"filters":"brand:brandName"}""") + + def test_delete_index_(self): + """ + deleteIndex + """ + _req = self._client.delete_index_with_http_info( + index_name="theIndexName", + ) + + assert _req.path == "/1/indexes/theIndexName" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_object_(self): + """ + deleteObject + """ + _req = self._client.delete_object_with_http_info( + index_name="", + object_id="uniqueID", + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/uniqueID" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_rule_(self): + """ + delete rule simple case + """ + _req = self._client.delete_rule_with_http_info( + index_name="indexName", + object_id="id1", + ) + + assert _req.path == "/1/indexes/indexName/rules/id1" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_rule_1(self): + """ + delete rule with simple characters to encode in objectID + """ + _req = self._client.delete_rule_with_http_info( + index_name="indexName", + object_id="test/with/slash", + ) + + assert _req.path == "/1/indexes/indexName/rules/test%2Fwith%2Fslash" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_source_(self): + """ + deleteSource + """ + _req = self._client.delete_source_with_http_info( + source="theSource", + ) + + assert _req.path == "/1/security/sources/theSource" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_delete_synonym_(self): + """ + deleteSynonym + """ + _req = self._client.delete_synonym_with_http_info( + index_name="indexName", + object_id="id1", + ) + + assert _req.path == "/1/indexes/indexName/synonyms/id1" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_api_key_(self): + """ + getApiKey + """ + _req = self._client.get_api_key_with_http_info( + key="myTestApiKey", + ) + + assert _req.path == "/1/keys/myTestApiKey" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_app_task_(self): + """ + getAppTask + """ + _req = self._client.get_app_task_with_http_info( + task_id=123, + ) + + assert _req.path == "/1/task/123" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_dictionary_languages_(self): + """ + get getDictionaryLanguages + """ + _req = self._client.get_dictionary_languages_with_http_info() + + assert _req.path == "/1/dictionaries/*/languages" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_dictionary_settings_(self): + """ + get getDictionarySettings results + """ + _req = self._client.get_dictionary_settings_with_http_info() + + assert _req.path == "/1/dictionaries/*/settings" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_logs_(self): + """ + getLogs with minimal parameters + """ + _req = self._client.get_logs_with_http_info() + + assert _req.path == "/1/logs" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_logs_1(self): + """ + getLogs with parameters + """ + _req = self._client.get_logs_with_http_info( + offset=5, + length=10, + index_name="theIndexName", + type="all", + ) + + assert _req.path == "/1/logs" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() + == { + "offset": "5", + "length": "10", + "indexName": "theIndexName", + "type": "all", + }.items() + ) + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_object_(self): + """ + getObject + """ + _req = self._client.get_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_retrieve=[ + "attr1", + "attr2", + ], + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() + == {"attributesToRetrieve": "attr1%2Cattr2"}.items() + ) + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_object_1(self): + """ + search with a real object + """ + _req = self._client.get_object_with_http_info( + index_name="cts_e2e_browse", + object_id="Batman and Robin", + ) + + assert _req.path == "/1/indexes/cts_e2e_browse/Batman%20and%20Robin" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_objects_(self): + """ + getObjects + """ + _req = self._client.get_objects_with_http_info( + get_objects_params={ + "requests": [ + { + "attributesToRetrieve": [ + "attr1", + "attr2", + ], + "objectID": "uniqueID", + "indexName": "theIndexName", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/objects" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"attributesToRetrieve":["attr1","attr2"],"objectID":"uniqueID","indexName":"theIndexName"}]}""" + ) + + def test_get_rule_(self): + """ + getRule + """ + _req = self._client.get_rule_with_http_info( + index_name="cts_e2e_browse", + object_id="qr-1725004648916", + ) + + assert _req.path == "/1/indexes/cts_e2e_browse/rules/qr-1725004648916" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_settings_(self): + """ + getSettings + """ + _req = self._client.get_settings_with_http_info( + index_name="cts_e2e_settings", + ) + + assert _req.path == "/1/indexes/cts_e2e_settings/settings" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_sources_(self): + """ + getSources + """ + _req = self._client.get_sources_with_http_info() + + assert _req.path == "/1/security/sources" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_synonym_(self): + """ + getSynonym + """ + _req = self._client.get_synonym_with_http_info( + index_name="indexName", + object_id="id1", + ) + + assert _req.path == "/1/indexes/indexName/synonyms/id1" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_task_(self): + """ + getTask + """ + _req = self._client.get_task_with_http_info( + index_name="theIndexName", + task_id=123, + ) + + assert _req.path == "/1/indexes/theIndexName/task/123" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_top_user_ids_(self): + """ + getTopUserIds + """ + _req = self._client.get_top_user_ids_with_http_info() + + assert _req.path == "/1/clusters/mapping/top" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_get_user_id_(self): + """ + getUserId + """ + _req = self._client.get_user_id_with_http_info( + user_id="uniqueID", + ) + + assert _req.path == "/1/clusters/mapping/uniqueID" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_has_pending_mappings_(self): + """ + hasPendingMappings with minimal parameters + """ + _req = self._client.has_pending_mappings_with_http_info() + + assert _req.path == "/1/clusters/mapping/pending" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_has_pending_mappings_1(self): + """ + hasPendingMappings with parameters + """ + _req = self._client.has_pending_mappings_with_http_info( + get_clusters=True, + ) + + assert _req.path == "/1/clusters/mapping/pending" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {"getClusters": "true"}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_api_keys_(self): + """ + listApiKeys + """ + _req = self._client.list_api_keys_with_http_info() + + assert _req.path == "/1/keys" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_clusters_(self): + """ + listClusters + """ + _req = self._client.list_clusters_with_http_info() + + assert _req.path == "/1/clusters" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_indices_(self): + """ + listIndices with minimal parameters + """ + _req = self._client.list_indices_with_http_info() + + assert _req.path == "/1/indexes" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_indices_1(self): + """ + listIndices with parameters + """ + _req = self._client.list_indices_with_http_info( + page=8, + hits_per_page=3, + ) + + assert _req.path == "/1/indexes" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() == {"page": "8", "hitsPerPage": "3"}.items() + ) + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_user_ids_(self): + """ + listUserIds with minimal parameters + """ + _req = self._client.list_user_ids_with_http_info() + + assert _req.path == "/1/clusters/mapping" + assert _req.verb == "GET" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_list_user_ids_1(self): + """ + listUserIds with parameters + """ + _req = self._client.list_user_ids_with_http_info( + page=8, + hits_per_page=100, + ) + + assert _req.path == "/1/clusters/mapping" + assert _req.verb == "GET" + assert ( + _req.query_parameters.items() == {"page": "8", "hitsPerPage": "100"}.items() + ) + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_multiple_batch_(self): + """ + multipleBatch + """ + _req = self._client.multiple_batch_with_http_info( + batch_params={ + "requests": [ + { + "action": "addObject", + "body": { + "key": "value", + }, + "indexName": "theIndexName", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"action":"addObject","body":{"key":"value"},"indexName":"theIndexName"}]}""" + ) + + def test_operation_index_(self): + """ + scopes + """ + _req = self._client.operation_index_with_http_info( + index_name="", + operation_index_params={ + "operation": "move", + "destination": "", + "scope": [ + "rules", + "settings", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"operation":"move","destination":"","scope":["rules","settings"]}""" + ) + + def test_operation_index_1(self): + """ + copy + """ + _req = self._client.operation_index_with_http_info( + index_name="", + operation_index_params={ + "operation": "copy", + "destination": "", + }, + ) + + assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"operation":"copy","destination":""}""" + ) + + def test_operation_index_2(self): + """ + move + """ + _req = self._client.operation_index_with_http_info( + index_name="", + operation_index_params={ + "operation": "move", + "destination": "", + }, + ) + + assert _req.path == "/1/indexes/%3CSOURCE_INDEX_NAME%3E/operation" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"operation":"move","destination":""}""" + ) + + def test_partial_update_object_(self): + """ + Partial update with a new value for a string attribute + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "attributeId": "new value", + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeId":"new value"}""") + + def test_partial_update_object_1(self): + """ + Partial update with a new value for an integer attribute + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "attributeId": 1, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeId":1}""") + + def test_partial_update_object_2(self): + """ + Partial update with a new value for a boolean attribute + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "attributeId": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeId":true}""") + + def test_partial_update_object_3(self): + """ + Partial update with a new value for an array attribute + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "attributeId": [ + "one", + "two", + "three", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeId":["one","two","three"]}""") + + def test_partial_update_object_4(self): + """ + Partial update with a new value for an object attribute + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "attributeId": { + "nested": "value", + }, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributeId":{"nested":"value"}}""") + + def test_partial_update_object_5(self): + """ + with visible_by filter + """ + _req = self._client.partial_update_object_with_http_info( + index_name="theIndexName", + object_id="uniqueID", + attributes_to_update={ + "visible_by": [ + "Angela", + "group/Finance", + "group/Shareholders", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/uniqueID/partial" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"visible_by":["Angela","group/Finance","group/Shareholders"]}""" + ) + + def test_remove_user_id_(self): + """ + removeUserId + """ + _req = self._client.remove_user_id_with_http_info( + user_id="uniqueID", + ) + + assert _req.path == "/1/clusters/mapping/uniqueID" + assert _req.verb == "DELETE" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert _req.data is None + + def test_replace_sources_(self): + """ + replaceSources + """ + _req = self._client.replace_sources_with_http_info( + source=[ + { + "source": "theSource", + "description": "theDescription", + }, + ], + ) + + assert _req.path == "/1/security/sources" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"source":"theSource","description":"theDescription"}]""" + ) + + def test_restore_api_key_(self): + """ + restoreApiKey + """ + _req = self._client.restore_api_key_with_http_info( + key="ALGOLIA_API_KEY", + ) + + assert _req.path == "/1/keys/ALGOLIA_API_KEY/restore" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + + def test_save_object_(self): + """ + saveObject + """ + _req = self._client.save_object_with_http_info( + index_name="", + body={ + "objectID": "id", + "test": "val", + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"objectID":"id","test":"val"}""") + + def test_save_rule_(self): + """ + saveRule with minimal parameters + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="id1", + rule={ + "objectID": "id1", + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "filters": "brand:xiaomi", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/id1" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:xiaomi"}}}""" + ) + + def test_save_rule_1(self): + """ + saveRule with all parameters + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="id1", + rule={ + "objectID": "id1", + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains", + "alternatives": False, + "context": "search", + }, + ], + "consequence": { + "params": { + "filters": "brand:apple", + "query": { + "remove": [ + "algolia", + ], + "edits": [ + { + "type": "remove", + "delete": "abc", + "insert": "cde", + }, + { + "type": "replace", + "delete": "abc", + "insert": "cde", + }, + ], + }, + }, + "hide": [ + { + "objectID": "321", + }, + ], + "filterPromotes": False, + "userData": { + "algolia": "aloglia", + }, + "promote": [ + { + "objectID": "abc", + "position": 3, + }, + { + "objectIDs": [ + "abc", + "def", + ], + "position": 1, + }, + ], + }, + "description": "test", + "enabled": True, + "validity": [ + { + "from": 1656670273, + "until": 1656670277, + }, + ], + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/indexName/rules/id1" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains","alternatives":false,"context":"search"}],"consequence":{"params":{"filters":"brand:apple","query":{"remove":["algolia"],"edits":[{"type":"remove","delete":"abc","insert":"cde"},{"type":"replace","delete":"abc","insert":"cde"}]}},"hide":[{"objectID":"321"}],"filterPromotes":false,"userData":{"algolia":"aloglia"},"promote":[{"objectID":"abc","position":3},{"objectIDs":["abc","def"],"position":1}]},"description":"test","enabled":true,"validity":[{"from":1656670273,"until":1656670277}]}""" + ) + + def test_save_rule_2(self): + """ + b2b catalog + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="article-rule", + rule={ + "objectID": "article-rule", + "conditions": [ + { + "pattern": "article", + "anchoring": "startsWith", + }, + ], + "consequence": { + "params": { + "query": { + "edits": [ + { + "type": "remove", + "delete": "article", + }, + ], + }, + "restrictSearchableAttributes": [ + "title", + "book_id", + ], + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/article-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"article-rule","conditions":[{"pattern":"article","anchoring":"startsWith"}],"consequence":{"params":{"query":{"edits":[{"type":"remove","delete":"article"}]},"restrictSearchableAttributes":["title","book_id"]}}}""" + ) + + def test_save_rule_3(self): + """ + merchandising and promoting + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="director-rule", + rule={ + "objectID": "director-rule", + "conditions": [ + { + "pattern": "{facet:director} director", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "restrictSearchableAttributes": [ + "title", + "book_id", + ], + "automaticFacetFilters": [ + { + "facet": "director", + }, + ], + "query": { + "edits": [ + { + "type": "remove", + "delete": "director", + }, + ], + }, + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/director-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"director-rule","conditions":[{"pattern":"{facet:director} director","anchoring":"contains"}],"consequence":{"params":{"restrictSearchableAttributes":["title","book_id"],"automaticFacetFilters":[{"facet":"director"}],"query":{"edits":[{"type":"remove","delete":"director"}]}}}}""" + ) + + def test_save_rule_4(self): + """ + harry potter + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="harry-potter-rule", + rule={ + "objectID": "harry-potter-rule", + "conditions": [ + { + "pattern": "harry potter", + "anchoring": "contains", + }, + ], + "consequence": { + "userData": { + "promo_content": "20% OFF on all Harry Potter books!", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/harry-potter-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"harry-potter-rule","conditions":[{"pattern":"harry potter","anchoring":"contains"}],"consequence":{"userData":{"promo_content":"20% OFF on all Harry Potter books!"}}}""" + ) + + def test_save_rule_5(self): + """ + merchandising empty query + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="clearance-category-filter", + rule={ + "objectID": "clearance-category-filter", + "conditions": [ + { + "pattern": "", + "anchoring": "is", + "context": "landing", + }, + ], + "consequence": { + "params": { + "optionalFilters": "clearance:true", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/clearance-category-filter" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"clearance-category-filter","conditions":[{"pattern":"","anchoring":"is","context":"landing"}],"consequence":{"params":{"optionalFilters":"clearance:true"}}}""" + ) + + def test_save_rule_6(self): + """ + redirect + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="redirect-help-rule", + rule={ + "objectID": "redirect-help-rule", + "conditions": [ + { + "pattern": "help", + "anchoring": "contains", + }, + ], + "consequence": { + "userData": { + "redirect": "https://www.algolia.com/support", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/redirect-help-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"redirect-help-rule","conditions":[{"pattern":"help","anchoring":"contains"}],"consequence":{"userData":{"redirect":"https://www.algolia.com/support"}}}""" + ) + + def test_save_rule_7(self): + """ + promote some results over others + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="tomato-fruit", + rule={ + "objectID": "tomato-fruit", + "conditions": [ + { + "pattern": "tomato", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "optionalFilters": "food_group:fruit", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/tomato-fruit" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"tomato-fruit","conditions":[{"pattern":"tomato","anchoring":"contains"}],"consequence":{"params":{"optionalFilters":"food_group:fruit"}}}""" + ) + + def test_save_rule_8(self): + """ + promote several hits + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="Promote-Apple-Newest", + rule={ + "objectID": "Promote-Apple-Newest", + "conditions": [ + { + "pattern": "apple", + "anchoring": "is", + }, + ], + "consequence": { + "promote": [ + { + "objectIDs": [ + "iPhone-12345", + "watch-123", + ], + "position": 0, + }, + ], + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/Promote-Apple-Newest" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"Promote-Apple-Newest","conditions":[{"pattern":"apple","anchoring":"is"}],"consequence":{"promote":[{"objectIDs":["iPhone-12345","watch-123"],"position":0}]}}""" + ) + + def test_save_rule_9(self): + """ + promote newest release + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="Promote-iPhone-X", + rule={ + "objectID": "Promote-iPhone-X", + "conditions": [ + { + "pattern": "iPhone", + "anchoring": "contains", + }, + ], + "consequence": { + "promote": [ + { + "objectID": "iPhone-12345", + "position": 0, + }, + ], + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/Promote-iPhone-X" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"Promote-iPhone-X","conditions":[{"pattern":"iPhone","anchoring":"contains"}],"consequence":{"promote":[{"objectID":"iPhone-12345","position":0}]}}""" + ) + + def test_save_rule_10(self): + """ + promote single item + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="promote-harry-potter-box-set", + rule={ + "objectID": "promote-harry-potter-box-set", + "conditions": [ + { + "pattern": "Harry Potter", + "anchoring": "contains", + }, + ], + "consequence": { + "promote": [ + { + "objectID": "HP-12345", + "position": 0, + }, + ], + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/promote-harry-potter-box-set" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"promote-harry-potter-box-set","conditions":[{"pattern":"Harry Potter","anchoring":"contains"}],"consequence":{"promote":[{"objectID":"HP-12345","position":0}]}}""" + ) + + def test_save_rule_11(self): + """ + limit search results + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="article-rule", + rule={ + "objectID": "article-rule", + "conditions": [ + { + "pattern": "article", + "anchoring": "startsWith", + }, + ], + "consequence": { + "params": { + "query": { + "edits": [ + { + "type": "remove", + "delete": "article", + }, + ], + }, + "restrictSearchableAttributes": [ + "title", + "book_id", + ], + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/article-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"article-rule","conditions":[{"pattern":"article","anchoring":"startsWith"}],"consequence":{"params":{"query":{"edits":[{"type":"remove","delete":"article"}]},"restrictSearchableAttributes":["title","book_id"]}}}""" + ) + + def test_save_rule_12(self): + """ + query match + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="tagged-brand-rule", + rule={ + "conditions": [ + { + "pattern": "brand: {facet:brand}", + "anchoring": "contains", + "alternatives": False, + }, + ], + "consequence": { + "params": { + "automaticFacetFilters": [ + { + "facet": "brand", + }, + ], + "query": { + "remove": [ + "brand:", + "{facet:brand}", + ], + }, + }, + }, + "description": "filter on brand: {brand}", + "objectID": "tagged-brand-rule", + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/tagged-brand-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"conditions":[{"pattern":"brand: {facet:brand}","anchoring":"contains","alternatives":false}],"consequence":{"params":{"automaticFacetFilters":[{"facet":"brand"}],"query":{"remove":["brand:","{facet:brand}"]}}},"description":"filter on brand: {brand}","objectID":"tagged-brand-rule"}""" + ) + + def test_save_rule_13(self): + """ + dynamic filtering + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="color-facets", + rule={ + "objectID": "color-facets", + "conditions": [ + { + "pattern": "{facet:color}", + }, + ], + "consequence": { + "params": { + "automaticFacetFilters": [ + { + "facet": "color", + }, + ], + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/color-facets" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"color-facets","conditions":[{"pattern":"{facet:color}"}],"consequence":{"params":{"automaticFacetFilters":[{"facet":"color"}]}}}""" + ) + + def test_save_rule_14(self): + """ + hide hits + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="hide-12345", + rule={ + "objectID": "hide-12345", + "conditions": [ + { + "pattern": "cheap", + "anchoring": "contains", + }, + ], + "consequence": { + "hide": [ + { + "objectID": "to-hide-12345", + }, + ], + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/hide-12345" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"hide-12345","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"hide":[{"objectID":"to-hide-12345"}]}}""" + ) + + def test_save_rule_15(self): + """ + one rule per facet + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="red-color", + rule={ + "objectID": "red-color", + "conditions": [ + { + "pattern": "red", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "query": { + "remove": [ + "red", + ], + }, + "filters": "color:red", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/red-color" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"red-color","conditions":[{"pattern":"red","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["red"]},"filters":"color:red"}}}""" + ) + + def test_save_rule_16(self): + """ + numerical filters + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="cheap", + rule={ + "objectID": "cheap", + "conditions": [ + { + "pattern": "cheap", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "query": { + "remove": [ + "cheap", + ], + }, + "filters": "price < 10", + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/cheap" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"cheap","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["cheap"]},"filters":"price < 10"}}}""" + ) + + def test_save_rule_17(self): + """ + negative filters + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="gluten-free-rule", + rule={ + "objectID": "gluten-free-rule", + "conditions": [ + { + "pattern": "gluten-free", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "filters": "NOT allergens:gluten", + "query": { + "edits": [ + { + "type": "remove", + "delete": "gluten-free", + }, + ], + }, + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/gluten-free-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"gluten-free-rule","conditions":[{"pattern":"gluten-free","anchoring":"contains"}],"consequence":{"params":{"filters":"NOT allergens:gluten","query":{"edits":[{"type":"remove","delete":"gluten-free"}]}}}}""" + ) + + def test_save_rule_18(self): + """ + positive filters + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="diet-rule", + rule={ + "objectID": "diet-rule", + "conditions": [ + { + "pattern": "diet", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "filters": "'low-carb' OR 'low-fat'", + "query": { + "edits": [ + { + "type": "remove", + "delete": "diet", + }, + ], + }, + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/diet-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"diet-rule","conditions":[{"pattern":"diet","anchoring":"contains"}],"consequence":{"params":{"filters":"'low-carb' OR 'low-fat'","query":{"edits":[{"type":"remove","delete":"diet"}]}}}}""" + ) + + def test_save_rule_19(self): + """ + conditionless + """ + _req = self._client.save_rule_with_http_info( + index_name="indexName", + object_id="diet-rule", + rule={ + "objectID": "diet-rule", + "consequence": { + "params": { + "filters": "'low-carb' OR 'low-fat'", + "query": { + "edits": [ + { + "type": "remove", + "delete": "diet", + }, + ], + }, + }, + }, + }, + ) + + assert _req.path == "/1/indexes/indexName/rules/diet-rule" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"diet-rule","consequence":{"params":{"filters":"'low-carb' OR 'low-fat'","query":{"edits":[{"type":"remove","delete":"diet"}]}}}}""" + ) + + def test_save_rules_(self): + """ + saveRules with minimal parameters + """ + _req = self._client.save_rules_with_http_info( + index_name="", + rules=[ + { + "objectID": "a-rule-id", + "conditions": [ + { + "pattern": "smartphone", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "filters": "brand:apple", + }, + }, + }, + { + "objectID": "a-second-rule-id", + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "filters": "brand:samsung", + }, + }, + }, + ], + forward_to_replicas=False, + clear_existing_rules=True, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"forwardToReplicas": "false", "clearExistingRules": "true"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"objectID":"a-rule-id","conditions":[{"pattern":"smartphone","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:apple"}}},{"objectID":"a-second-rule-id","conditions":[{"pattern":"apple","anchoring":"contains"}],"consequence":{"params":{"filters":"brand:samsung"}}}]""" + ) + + def test_save_rules_1(self): + """ + saveRules with all parameters + """ + _req = self._client.save_rules_with_http_info( + index_name="", + rules=[ + { + "objectID": "id1", + "conditions": [ + { + "pattern": "apple", + "anchoring": "contains", + "alternatives": False, + "context": "search", + }, + ], + "consequence": { + "params": { + "filters": "brand:apple", + "query": { + "remove": [ + "algolia", + ], + "edits": [ + { + "type": "remove", + "delete": "abc", + "insert": "cde", + }, + { + "type": "replace", + "delete": "abc", + "insert": "cde", + }, + ], + }, + }, + "hide": [ + { + "objectID": "321", + }, + ], + "filterPromotes": False, + "userData": { + "algolia": "aloglia", + }, + "promote": [ + { + "objectID": "abc", + "position": 3, + }, + { + "objectIDs": [ + "abc", + "def", + ], + "position": 1, + }, + ], + }, + "description": "test", + "enabled": True, + "validity": [ + { + "from": 1656670273, + "until": 1656670277, + }, + ], + }, + ], + forward_to_replicas=True, + clear_existing_rules=True, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"forwardToReplicas": "true", "clearExistingRules": "true"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"objectID":"id1","conditions":[{"pattern":"apple","anchoring":"contains","alternatives":false,"context":"search"}],"consequence":{"params":{"filters":"brand:apple","query":{"remove":["algolia"],"edits":[{"type":"remove","delete":"abc","insert":"cde"},{"type":"replace","delete":"abc","insert":"cde"}]}},"hide":[{"objectID":"321"}],"filterPromotes":false,"userData":{"algolia":"aloglia"},"promote":[{"objectID":"abc","position":3},{"objectIDs":["abc","def"],"position":1}]},"description":"test","enabled":true,"validity":[{"from":1656670273,"until":1656670277}]}]""" + ) + + def test_save_rules_2(self): + """ + dynamic filtering + """ + _req = self._client.save_rules_with_http_info( + index_name="", + rules=[ + { + "objectID": "toaster", + "conditions": [ + { + "pattern": "toaster", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "query": { + "remove": [ + "toaster", + ], + }, + "filters": "product_type:toaster", + }, + }, + }, + { + "objectID": "cheap", + "conditions": [ + { + "pattern": "cheap", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "query": { + "remove": [ + "cheap", + ], + }, + "filters": "price < 15", + }, + }, + }, + ], + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"objectID":"toaster","conditions":[{"pattern":"toaster","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["toaster"]},"filters":"product_type:toaster"}}},{"objectID":"cheap","conditions":[{"pattern":"cheap","anchoring":"contains"}],"consequence":{"params":{"query":{"remove":["cheap"]},"filters":"price < 15"}}}]""" + ) + + def test_save_rules_3(self): + """ + enhance search results + """ + _req = self._client.save_rules_with_http_info( + index_name="", + rules=[ + { + "objectID": "country", + "conditions": [ + { + "pattern": "{facet:country}", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "aroundLatLngViaIP": False, + }, + }, + }, + { + "objectID": "city", + "conditions": [ + { + "pattern": "{facet:city}", + "anchoring": "contains", + }, + ], + "consequence": { + "params": { + "aroundLatLngViaIP": False, + }, + }, + }, + ], + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/rules/batch" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"objectID":"country","conditions":[{"pattern":"{facet:country}","anchoring":"contains"}],"consequence":{"params":{"aroundLatLngViaIP":false}}},{"objectID":"city","conditions":[{"pattern":"{facet:city}","anchoring":"contains"}],"consequence":{"params":{"aroundLatLngViaIP":false}}}]""" + ) + + def test_save_synonym_(self): + """ + saveSynonym + """ + _req = self._client.save_synonym_with_http_info( + index_name="indexName", + object_id="id1", + synonym_hit={ + "objectID": "id1", + "type": "synonym", + "synonyms": [ + "car", + "vehicule", + "auto", + ], + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/indexName/synonyms/id1" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"objectID":"id1","type":"synonym","synonyms":["car","vehicule","auto"]}""" + ) + + def test_save_synonyms_(self): + """ + saveSynonyms + """ + _req = self._client.save_synonyms_with_http_info( + index_name="", + synonym_hit=[ + { + "objectID": "id1", + "type": "synonym", + "synonyms": [ + "car", + "vehicule", + "auto", + ], + }, + { + "objectID": "id2", + "type": "onewaysynonym", + "input": "iphone", + "synonyms": [ + "ephone", + "aphone", + "yphone", + ], + }, + ], + forward_to_replicas=True, + replace_existing_synonyms=True, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/synonyms/batch" + assert _req.verb == "POST" + assert ( + _req.query_parameters.items() + == {"forwardToReplicas": "true", "replaceExistingSynonyms": "true"}.items() + ) + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """[{"objectID":"id1","type":"synonym","synonyms":["car","vehicule","auto"]},{"objectID":"id2","type":"onewaysynonym","input":"iphone","synonyms":["ephone","aphone","yphone"]}]""" + ) + + def test_search_(self): + """ + withHitsPerPage + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "hitsPerPage": 50, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","hitsPerPage":50}]}""" + ) + + def test_search_1(self): + """ + filterOnly + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "filters": "actor:Scarlett Johansson", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","filters":"actor:Scarlett Johansson"}]}""" + ) + + def test_search_2(self): + """ + filterOr + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "filters": "actor:Tom Cruise OR actor:Scarlett Johansson", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","filters":"actor:Tom Cruise OR actor:Scarlett Johansson"}]}""" + ) + + def test_search_3(self): + """ + filterNot + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "filters": "NOT actor:Nicolas Cage", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","filters":"NOT actor:Nicolas Cage"}]}""" + ) + + def test_search_4(self): + """ + search for a single hits request with minimal parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "cts_e2e_search_empty_index", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"cts_e2e_search_empty_index"}]}""" + ) + + def test_search_5(self): + """ + search with highlight and snippet results + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "cts_e2e_highlight_snippet_results", + "query": "vim", + "attributesToSnippet": [ + "*:20", + ], + "attributesToHighlight": [ + "*", + ], + "attributesToRetrieve": [ + "*", + ], + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"cts_e2e_highlight_snippet_results","query":"vim","attributesToSnippet":["*:20"],"attributesToHighlight":["*"],"attributesToRetrieve":["*"]}]}""" + ) + + def test_search_6(self): + """ + retrieveFacets + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "facets": [ + "author", + "genre", + ], + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","facets":["author","genre"]}]}""" + ) + + def test_search_7(self): + """ + retrieveFacetsWildcard + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "", + "query": "", + "facets": [ + "*", + ], + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"","query":"","facets":["*"]}]}""" + ) + + def test_search_8(self): + """ + search for a single facet request with minimal parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "cts_e2e_search_facet", + "type": "facet", + "facet": "editor", + }, + ], + "strategy": "stopIfEnoughMatches", + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"cts_e2e_search_facet","type":"facet","facet":"editor"}],"strategy":"stopIfEnoughMatches"}""" + ) + + def test_search_9(self): + """ + search for a single hits request with all parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "theIndexName", + "query": "myQuery", + "hitsPerPage": 50, + "type": "default", + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"theIndexName","query":"myQuery","hitsPerPage":50,"type":"default"}]}""" + ) + + def test_search_10(self): + """ + search for a single facet request with all parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "theIndexName", + "type": "facet", + "facet": "theFacet", + "facetQuery": "theFacetQuery", + "query": "theQuery", + "maxFacetHits": 50, + }, + ], + "strategy": "stopIfEnoughMatches", + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"theIndexName","type":"facet","facet":"theFacet","facetQuery":"theFacetQuery","query":"theQuery","maxFacetHits":50}],"strategy":"stopIfEnoughMatches"}""" + ) + + def test_search_11(self): + """ + search for multiple mixed requests in multiple indices with minimal parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "theIndexName", + }, + { + "indexName": "theIndexName2", + "type": "facet", + "facet": "theFacet", + }, + { + "indexName": "theIndexName", + "type": "default", + }, + ], + "strategy": "stopIfEnoughMatches", + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"theIndexName"},{"indexName":"theIndexName2","type":"facet","facet":"theFacet"},{"indexName":"theIndexName","type":"default"}],"strategy":"stopIfEnoughMatches"}""" + ) + + def test_search_12(self): + """ + search for multiple mixed requests in multiple indices with all parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "theIndexName", + "type": "facet", + "facet": "theFacet", + "facetQuery": "theFacetQuery", + "query": "theQuery", + "maxFacetHits": 50, + }, + { + "indexName": "theIndexName", + "query": "myQuery", + "hitsPerPage": 50, + "type": "default", + }, + ], + "strategy": "stopIfEnoughMatches", + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"theIndexName","type":"facet","facet":"theFacet","facetQuery":"theFacetQuery","query":"theQuery","maxFacetHits":50},{"indexName":"theIndexName","query":"myQuery","hitsPerPage":50,"type":"default"}],"strategy":"stopIfEnoughMatches"}""" + ) + + def test_search_13(self): + """ + search filters accept all of the possible shapes + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "theIndexName", + "facetFilters": "mySearch:filters", + "reRankingApplyFilter": "mySearch:filters", + "tagFilters": "mySearch:filters", + "numericFilters": "mySearch:filters", + "optionalFilters": "mySearch:filters", + }, + { + "indexName": "theIndexName", + "facetFilters": [ + "mySearch:filters", + [ + "mySearch:filters", + [ + "mySearch:filters", + ], + ], + ], + "reRankingApplyFilter": [ + "mySearch:filters", + [ + "mySearch:filters", + ], + ], + "tagFilters": [ + "mySearch:filters", + [ + "mySearch:filters", + ], + ], + "numericFilters": [ + "mySearch:filters", + [ + "mySearch:filters", + ], + ], + "optionalFilters": [ + "mySearch:filters", + [ + "mySearch:filters", + ], + ], + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"theIndexName","facetFilters":"mySearch:filters","reRankingApplyFilter":"mySearch:filters","tagFilters":"mySearch:filters","numericFilters":"mySearch:filters","optionalFilters":"mySearch:filters"},{"indexName":"theIndexName","facetFilters":["mySearch:filters",["mySearch:filters",["mySearch:filters"]]],"reRankingApplyFilter":["mySearch:filters",["mySearch:filters"]],"tagFilters":["mySearch:filters",["mySearch:filters"]],"numericFilters":["mySearch:filters",["mySearch:filters"]],"optionalFilters":["mySearch:filters",["mySearch:filters"]]}]}""" + ) + + def test_search_14(self): + """ + search filters end to end + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "indexName": "cts_e2e_search_facet", + "filters": "editor:'visual studio' OR editor:neovim", + }, + { + "indexName": "cts_e2e_search_facet", + "facetFilters": [ + "editor:'visual studio'", + "editor:neovim", + ], + }, + { + "indexName": "cts_e2e_search_facet", + "facetFilters": [ + "editor:'visual studio'", + [ + "editor:neovim", + ], + ], + }, + { + "indexName": "cts_e2e_search_facet", + "facetFilters": [ + "editor:'visual studio'", + [ + "editor:neovim", + [ + "editor:goland", + ], + ], + ], + }, + ], + }, + ) + + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"indexName":"cts_e2e_search_facet","filters":"editor:'visual studio' OR editor:neovim"},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'","editor:neovim"]},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'",["editor:neovim"]]},{"indexName":"cts_e2e_search_facet","facetFilters":["editor:'visual studio'",["editor:neovim",["editor:goland"]]]}]}""" + ) + + def test_search_15(self): + """ + search with all search parameters + """ + _req = self._client.search_with_http_info( + search_method_params={ + "requests": [ + { + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", ], "allowTyposOnNumericTokens": True, "alternativesAsExact": [ @@ -9057,1159 +12347,4678 @@ def test_search_15(self): }, ) - assert _req.path == "/1/indexes/*/queries" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/*/queries" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"requests":[{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowTyposOnNumericTokens":true,"alternativesAsExact":["multiWordsSynonym"],"analytics":true,"analyticsTags":[""],"aroundLatLng":"","aroundLatLngViaIP":true,"aroundPrecision":0,"aroundRadius":"all","attributeCriteriaComputedByMinProximity":true,"attributesToHighlight":[""],"attributesToRetrieve":[""],"attributesToSnippet":[""],"clickAnalytics":true,"decompoundQuery":true,"disableExactOnAttributes":[""],"disableTypoToleranceOnAttributes":[""],"distinct":0,"enableABTest":true,"enablePersonalization":true,"enableReRanking":true,"enableRules":true,"exactOnSingleWordQuery":"attribute","facetFilters":[""],"facetingAfterDistinct":true,"facets":[""],"filters":"","getRankingInfo":true,"highlightPostTag":"","highlightPreTag":"","hitsPerPage":1,"ignorePlurals":false,"indexName":"theIndexName","insideBoundingBox":[[47.3165,4.9665,47.3424,5.0201],[40.9234,2.1185,38.643,1.9916]],"insidePolygon":[[47.3165,4.9665,47.3424,5.0201,47.32,4.9],[40.9234,2.1185,38.643,1.9916,39.2587,2.0104]],"length":1,"maxValuesPerFacet":0,"minProximity":1,"minWordSizefor1Typo":0,"minWordSizefor2Typos":0,"minimumAroundRadius":1,"naturalLanguages":["fr"],"numericFilters":[""],"offset":0,"optionalFilters":[""],"optionalWords":[""],"page":0,"percentileComputation":true,"personalizationImpact":0,"query":"","queryLanguages":["fr"],"queryType":"prefixAll","ranking":[""],"reRankingApplyFilter":[""],"relevancyStrictness":0,"removeStopWords":true,"removeWordsIfNoResults":"allOptional","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"responseFields":[""],"restrictHighlightAndSnippetArrays":true,"restrictSearchableAttributes":[""],"ruleContexts":[""],"similarQuery":"","snippetEllipsisText":"","sortFacetValuesBy":"","sumOrFiltersScores":true,"synonyms":true,"tagFilters":[""],"type":"default","typoTolerance":"min","userToken":""}]}""" + ) + + def test_search_dictionary_entries_(self): + """ + get searchDictionaryEntries results with minimal parameters + """ + _req = self._client.search_dictionary_entries_with_http_info( + dictionary_name="stopwords", + search_dictionary_entries_params={ + "query": "about", + }, + ) + + assert _req.path == "/1/dictionaries/stopwords/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"about"}""") + + def test_search_dictionary_entries_1(self): + """ + get searchDictionaryEntries results with all parameters + """ + _req = self._client.search_dictionary_entries_with_http_info( + dictionary_name="compounds", + search_dictionary_entries_params={ + "query": "foo", + "page": 4, + "hitsPerPage": 2, + "language": "fr", + }, + ) + + assert _req.path == "/1/dictionaries/compounds/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"foo","page":4,"hitsPerPage":2,"language":"fr"}""" + ) + + def test_search_for_facet_values_(self): + """ + get searchForFacetValues results with minimal parameters + """ + _req = self._client.search_for_facet_values_with_http_info( + index_name="indexName", + facet_name="facetName", + ) + + assert _req.path == "/1/indexes/indexName/facets/facetName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_search_for_facet_values_1(self): + """ + get searchForFacetValues results with all parameters + """ + _req = self._client.search_for_facet_values_with_http_info( + index_name="indexName", + facet_name="facetName", + search_for_facet_values_request={ + "params": "query=foo&facetFilters=['bar']", + "facetQuery": "foo", + "maxFacetHits": 42, + }, + ) + + assert _req.path == "/1/indexes/indexName/facets/facetName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"params":"query=foo&facetFilters=['bar']","facetQuery":"foo","maxFacetHits":42}""" + ) + + def test_search_for_facet_values_2(self): + """ + facetName and facetQuery + """ + _req = self._client.search_for_facet_values_with_http_info( + index_name="indexName", + facet_name="author", + search_for_facet_values_request={ + "facetQuery": "stephen king", + }, + ) + + assert _req.path == "/1/indexes/indexName/facets/author/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facetQuery":"stephen king"}""") + + def test_search_rules_(self): + """ + searchRules + """ + _req = self._client.search_rules_with_http_info( + index_name="cts_e2e_browse", + search_rules_params={ + "query": "zorro", + }, + ) + + assert _req.path == "/1/indexes/cts_e2e_browse/rules/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"zorro"}""") + + def test_search_single_index_(self): + """ + search with minimal parameters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_search_single_index_1(self): + """ + search with special characters in indexName + """ + _req = self._client.search_single_index_with_http_info( + index_name="cts_e2e_space in index", + ) + + assert _req.path == "/1/indexes/cts_e2e_space%20in%20index/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_search_single_index_2(self): + """ + search with searchParams + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "myQuery", + "facetFilters": [ + "tags:algolia", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"myQuery","facetFilters":["tags:algolia"]}""" + ) + + def test_search_single_index_3(self): + """ + single search retrieve snippets + """ + _req = self._client.search_single_index_with_http_info( + index_name="cts_e2e_browse", + search_params={ + "query": "batman mask of the phantasm", + "attributesToRetrieve": [ + "*", + ], + "attributesToSnippet": [ + "*:20", + ], + }, + ) + + assert _req.path == "/1/indexes/cts_e2e_browse/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"batman mask of the phantasm","attributesToRetrieve":["*"],"attributesToSnippet":["*:20"]}""" + ) + + def test_search_single_index_4(self): + """ + query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "phone", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"phone"}""") + + def test_search_single_index_5(self): + """ + filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "country:US AND price.gross < 2.0", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"country:US AND price.gross < 2.0"}""" + ) + + def test_search_single_index_6(self): + """ + distinct + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "distinct": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"distinct":true}""") + + def test_search_single_index_7(self): + """ + filtersNumeric + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "price < 10", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"filters":"price < 10"}""") + + def test_search_single_index_8(self): + """ + filtersTimestamp + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "NOT date_timestamp:1514764800 TO 1546300799", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"NOT date_timestamp:1514764800 TO 1546300799"}""" + ) + + def test_search_single_index_9(self): + """ + filtersSumOrFiltersScoresFalse + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "(company:Google OR company:Amazon OR company:Facebook)", + "sumOrFiltersScores": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"(company:Google OR company:Amazon OR company:Facebook)","sumOrFiltersScores":false}""" + ) + + def test_search_single_index_10(self): + """ + filtersSumOrFiltersScoresTrue + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "(company:Google OR company:Amazon OR company:Facebook)", + "sumOrFiltersScores": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"(company:Google OR company:Amazon OR company:Facebook)","sumOrFiltersScores":true}""" + ) + + def test_search_single_index_11(self): + """ + filtersStephenKing + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": 'author:"Stephen King"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"filters":"author:\\"Stephen King\\""}""") + + def test_search_single_index_12(self): + """ + filtersNotTags + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "NOT _tags:non-fiction", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"filters":"NOT _tags:non-fiction"}""") + + def test_search_single_index_13(self): + """ + facetFiltersList + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "facetFilters": [ + "publisher:Penguin", + [ + "author:Stephen King", + "genre:Horror", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"facetFilters":["publisher:Penguin",["author:Stephen King","genre:Horror"]]}""" + ) + + def test_search_single_index_14(self): + """ + facetFiltersBook + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["category:Book"]}""" + ) + + def test_search_single_index_15(self): + """ + facetFiltersAND + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "category:Book", + "author:John Doe", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["category:Book","author:John Doe"]}""" + ) + + def test_search_single_index_16(self): + """ + facetFiltersOR + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + [ + "category:Book", + "author:John Doe", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}""" + ) + + def test_search_single_index_17(self): + """ + facetFiltersCombined + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetFilters": [ + "author:John Doe", + [ + "category:Book", + "category:Movie", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}""" + ) + + def test_search_single_index_18(self): + """ + facetFiltersNeg + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "facetFilters": "category:-Ebook", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facetFilters":"category:-Ebook"}""") + + def test_search_single_index_19(self): + """ + filtersAndFacetFilters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": '(author:"Stephen King" OR genre:"Horror")', + "facetFilters": [ + "publisher:Penguin", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"(author:\\"Stephen King\\" OR genre:\\"Horror\\")","facetFilters":["publisher:Penguin"]}""" + ) + + def test_search_single_index_20(self): + """ + facet author genre + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "facets": [ + "author", + "genre", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facets":["author","genre"]}""") + + def test_search_single_index_21(self): + """ + facet wildcard + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "facets": [ + "*", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"facets":["*"]}""") + + def test_search_single_index_22(self): + """ + maxValuesPerFacet + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "maxValuesPerFacet": 1000, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") + + def test_search_single_index_23(self): + """ + aroundLatLng + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "aroundLatLng": "40.71, -74.01", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"aroundLatLng":"40.71, -74.01"}""") + + def test_search_single_index_24(self): + """ + aroundLatLngViaIP + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "aroundLatLngViaIP": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"aroundLatLngViaIP":true}""") + + def test_search_single_index_25(self): + """ + aroundRadius + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "aroundLatLng": "40.71, -74.01", + "aroundRadius": 1000000, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"aroundLatLng":"40.71, -74.01","aroundRadius":1000000}""" + ) + + def test_search_single_index_26(self): + """ + insideBoundingBox + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "insideBoundingBox": [ + [ + 49.067996905313834, + 65.73828125, + 25.905859247243498, + 128.8046875, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"insideBoundingBox":[[49.067996905313834,65.73828125,25.905859247243498,128.8046875]]}""" + ) + + def test_search_single_index_27(self): + """ + insidePolygon + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "insidePolygon": [ + [ + 42.01, + -124.31, + 48.835509470063045, + -124.40453125000005, + 45.01082951668149, + -65.95726562500005, + 31.247243545293433, + -81.06578125000004, + 25.924152577235226, + -97.68234374999997, + 32.300311895879545, + -117.54828125, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" + ) + + def test_search_single_index_28(self): + """ + insidePolygon + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "insidePolygon": [ + [ + 42.01, + -124.31, + 48.835509470063045, + -124.40453125000005, + 45.01082951668149, + -65.95726562500005, + 31.247243545293433, + -81.06578125000004, + 25.924152577235226, + -97.68234374999997, + 32.300311895879545, + -117.54828125, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" + ) + + def test_search_single_index_29(self): + """ + optionalFilters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "optionalFilters": [ + "can_deliver_quickly:true", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"optionalFilters":["can_deliver_quickly:true"]}""" + ) + + def test_search_single_index_30(self): + """ + optionalFiltersMany + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "optionalFilters": [ + "brand:Apple", + "brand:Samsung", + "brand:-Huawei", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"optionalFilters":["brand:Apple","brand:Samsung","brand:-Huawei"]}""" + ) + + def test_search_single_index_31(self): + """ + optionalFiltersSimple + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "optionalFilters": [ + "brand:Apple", + "type:tablet", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"optionalFilters":["brand:Apple","type:tablet"]}""" + ) + + def test_search_single_index_32(self): + """ + restrictSearchableAttributes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "restrictSearchableAttributes": [ + "title_fr", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"restrictSearchableAttributes":["title_fr"]}""" + ) + + def test_search_single_index_33(self): + """ + getRankingInfo + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "getRankingInfo": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"getRankingInfo":true}""") + + def test_search_single_index_34(self): + """ + clickAnalytics + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "clickAnalytics": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"clickAnalytics":true}""") + + def test_search_single_index_35(self): + """ + clickAnalyticsUserToken + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "clickAnalytics": True, + "userToken": "user-1", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"clickAnalytics":true,"userToken":"user-1"}""" + ) + + def test_search_single_index_36(self): + """ + enablePersonalization + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "enablePersonalization": True, + "userToken": "user-1", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"enablePersonalization":true,"userToken":"user-1"}""" + ) + + def test_search_single_index_37(self): + """ + userToken + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "userToken": "user-1", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"userToken":"user-1"}""") + + def test_search_single_index_38(self): + """ + userToken1234 + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "userToken": "user-1234", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","userToken":"user-1234"}""" + ) + + def test_search_single_index_39(self): + """ + analyticsTag + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "analyticsTags": [ + "YOUR_ANALYTICS_TAG", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"analyticsTags":["YOUR_ANALYTICS_TAG"]}""") + + def test_search_single_index_40(self): + """ + facetFiltersUsers + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "facetFilters": [ + "user:user42", + "user:public", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"facetFilters":["user:user42","user:public"]}""" + ) + + def test_search_single_index_41(self): + """ + buildTheQuery + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "filters": "categoryPageId: Men's Clothing", + "hitsPerPage": 50, + "analyticsTags": [ + "mens-clothing", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"filters":"categoryPageId: Men's Clothing","hitsPerPage":50,"analyticsTags":["mens-clothing"]}""" + ) + + def test_search_single_index_42(self): + """ + attributesToHighlightOverride + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "attributesToHighlight": [ + "title", + "content", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","attributesToHighlight":["title","content"]}""" + ) + + def test_search_single_index_43(self): + """ + disableTypoToleranceOnAttributes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "disableTypoToleranceOnAttributes": [ + "serial_number", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}""" + ) + + def test_search_single_index_44(self): + """ + search_a_query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "shirt", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"shirt"}""") + + def test_search_single_index_45(self): + """ + search_everything + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":""}""") + + def test_search_single_index_46(self): + """ + api_filtering_range_example + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "books", + "filters": "price:10 TO 20", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"books","filters":"price:10 TO 20"}""" + ) + + def test_search_single_index_47(self): + """ + search_a_query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "similarQuery": "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + "filters": "year:1991 TO 2001", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}""" + ) + + def test_search_single_index_48(self): + """ + override_retrievable_attributes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "attributesToRetrieve": [ + "title", + "content", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","attributesToRetrieve":["title","content"]}""" + ) + + def test_search_single_index_49(self): + """ + restrict_searchable_attributes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "restrictSearchableAttributes": [ + "title", + "author", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","restrictSearchableAttributes":["title","author"]}""" + ) + + def test_search_single_index_50(self): + """ + override_default_relevancy + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "relevancyStrictness": 70, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","relevancyStrictness":70}""" + ) + + def test_search_single_index_51(self): + """ + apply_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": "(category:Book OR category:Ebook) AND _tags:published", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}""" + ) + + def test_search_single_index_52(self): + """ + apply_all_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "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"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"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\\""}""" + ) + + def test_search_single_index_53(self): + """ + escape_spaces + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'category:"Books and Comics"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","filters":"category:\\"Books and Comics\\""}""" + ) + + def test_search_single_index_54(self): + """ + escape_keywords + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'keyword:"OR"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","filters":"keyword:\\"OR\\""}""" + ) + + def test_search_single_index_55(self): + """ + escape_single_quotes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'content:"It\'s a wonderful day"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","filters":"content:\\"It's a wonderful day\\""}""" + ) + + def test_search_single_index_56(self): + """ + escape_double_quotes + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "filters": 'content:"She said "Hello World"', + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","filters":"content:\\"She said \\"Hello World\\""}""" + ) + + def test_search_single_index_57(self): + """ + apply_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:John Doe", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","optionalFilters":["category:Book","author:John Doe"]}""" + ) + + def test_search_single_index_58(self): + """ + apply_negative_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalFilters": [ + "category:Book", + "author:-John Doe", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}""" + ) + + def test_search_single_index_59(self): + """ + apply_numeric_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "numericFilters": [ + "price < 1000", + [ + "inStock = 1", + "deliveryDate < 1441755506", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}""" + ) + + def test_search_single_index_60(self): + """ + apply_tag_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "tagFilters": [ + "SciFi", + [ + "Book", + "Movie", + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}""" + ) + + def test_search_single_index_61(self): + """ + apply_filters + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "sumOrFiltersScores": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","sumOrFiltersScores":true}""" + ) + + def test_search_single_index_62(self): + """ + facets_all + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facets": [ + "*", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","facets":["*"]}""") + + def test_search_single_index_63(self): + """ + retrieve_only_some_facets + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facets": [ + "category", + "author", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facets":["category","author"]}""" + ) + + def test_search_single_index_64(self): + """ + override_default_max_values_per_facet + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "maxValuesPerFacet": 20, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","maxValuesPerFacet":20}""") + + def test_search_single_index_65(self): + """ + enable_faceting_after_distinct + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "facetingAfterDistinct": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","facetingAfterDistinct":true}""" + ) + + def test_search_single_index_66(self): + """ + sort_facet_values_alphabetically + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "sortFacetValuesBy": "count", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","sortFacetValuesBy":"count"}""" + ) + + def test_search_single_index_67(self): + """ + override_attributes_to_snippet + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "attributesToSnippet": [ + "title", + "content:80", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","attributesToSnippet":["title","content:80"]}""" + ) + + def test_search_single_index_68(self): + """ + override_default_highlight_pre_tag + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "highlightPreTag": "", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","highlightPreTag":""}""" + ) + + def test_search_single_index_69(self): + """ + override_default_highlight_post_tag + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "highlightPostTag": "", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","highlightPostTag":""}""" + ) + + def test_search_single_index_70(self): + """ + override_default_snippet_ellipsis_text + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "snippetEllipsisText": "", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","snippetEllipsisText":""}""" + ) + + def test_search_single_index_71(self): + """ + enable_restrict_highlight_and_snippet_arrays + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "restrictHighlightAndSnippetArrays": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","restrictHighlightAndSnippetArrays":false}""" + ) + + def test_search_single_index_72(self): + """ + access_page + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "page": 0, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","page":0}""") + + def test_search_single_index_73(self): + """ + override_default_hits_per_page + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "hitsPerPage": 10, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","hitsPerPage":10}""") + + def test_search_single_index_74(self): + """ + get_nth_hit + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "offset": 4, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","offset":4}""") + + def test_search_single_index_75(self): + """ + get_n_results + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "length": 4, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","length":4}""") + + def test_search_single_index_76(self): + """ + override_default_min_word_size_for_one_typo + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minWordSizefor1Typo": 2, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","minWordSizefor1Typo":2}""" + ) + + def test_search_single_index_77(self): + """ + override_default_min_word_size_for_two_typos + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minWordSizefor2Typos": 2, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","minWordSizefor2Typos":2}""" + ) + + def test_search_single_index_78(self): + """ + override_default_typo_tolerance_mode + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "typoTolerance": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","typoTolerance":false}""") + + def test_search_single_index_79(self): + """ + disable_typos_on_numeric_tokens_at_search_time + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "allowTyposOnNumericTokens": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","allowTyposOnNumericTokens":false}""" + ) + + def test_search_single_index_80(self): + """ + search_around_a_position + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundLatLng": "40.71, -74.01", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","aroundLatLng":"40.71, -74.01"}""" + ) + + def test_search_single_index_81(self): + """ + search_around_server_ip + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundLatLngViaIP": True, + }, + request_options={ + "headers": loads( + """{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}""" + ), + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert ( + _req.headers.items() + >= { + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around" + }.items() + ) + assert loads(_req.data) == loads( + """{"query":"query","aroundLatLngViaIP":true}""" + ) + + def test_search_single_index_82(self): + """ + set_around_radius + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundRadius": 1000, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","aroundRadius":1000}""") + + def test_search_single_index_83(self): + """ + disable_automatic_radius + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundRadius": "all", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","aroundRadius":"all"}""") + + def test_search_single_index_84(self): + """ + set_geo_search_precision + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundPrecision": 100, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","aroundPrecision":100}""") + + def test_search_single_index_85(self): + """ + set_geo_search_precision_non_linear + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "aroundPrecision": [ + { + "from": 0, + "value": 25, + }, + { + "from": 2000, + "value": 1000, + }, + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}""" + ) + + def test_search_single_index_86(self): + """ + set_minimum_geo_search_radius + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minimumAroundRadius": 1000, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","minimumAroundRadius":1000}""" + ) + + def test_search_single_index_87(self): + """ + search_inside_rectangular_area + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}""" + ) + + def test_search_single_index_88(self): + """ + search_inside_multiple_rectangular_areas + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insideBoundingBox": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ], + [ + 49.62625916704081, + 4.6181640625, + 47.715070300900194, + 0.482421875, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}""" + ) + + def test_search_single_index_89(self): + """ + search_inside_polygon_area + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "insidePolygon": [ + [ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}""" + ) + + def test_search_single_index_90(self): + """ + search_inside_multiple_polygon_areas + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "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, + ], + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"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]]}""" + ) + + def test_search_single_index_91(self): + """ + set_querylanguages_override + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "ignorePlurals": [ + "ca", + "es", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","ignorePlurals":["ca","es"]}""" + ) + + def test_search_single_index_92(self): + """ + set_querylanguages_override + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","removeStopWords":["ca","es"]}""" + ) + + def test_search_single_index_93(self): + """ + set_querylanguages_override + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeStopWords": [ + "ca", + "es", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","removeStopWords":["ca","es"]}""" + ) + + def test_search_single_index_94(self): + """ + set_querylanguages_with_japanese_query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "queryLanguages": [ + "ja", + "en", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","queryLanguages":["ja","en"]}""" + ) + + def test_search_single_index_95(self): + """ + set_natural_languages + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"","naturalLanguages":["fr"]}""") + + def test_search_single_index_96(self): + """ + override_natural_languages_with_query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "", + "naturalLanguages": [ + "fr", + ], + "removeWordsIfNoResults": "firstWords", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}""" + ) + + def test_search_single_index_97(self): + """ + enable_decompound_query_search_time + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "decompoundQuery": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","decompoundQuery":true}""") + + def test_search_single_index_98(self): + """ + enable_rules_search_time + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableRules": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","enableRules":true}""") + + def test_search_single_index_99(self): + """ + set_rule_contexts + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "ruleContexts": [ + "front_end", + "website2", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","ruleContexts":["front_end","website2"]}""" + ) + + def test_search_single_index_100(self): + """ + enable_personalization + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enablePersonalization": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","enablePersonalization":true}""" + ) + + def test_search_single_index_101(self): + """ + enable_personalization_with_user_token + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","enablePersonalization":true,"userToken":"123456"}""" + ) + + def test_search_single_index_102(self): + """ + personalization_impact + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "personalizationImpact": 20, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","personalizationImpact":20}""" + ) + + def test_search_single_index_103(self): + """ + set_user_token + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "userToken": "123456", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","userToken":"123456"}""") + + def test_search_single_index_104(self): + """ + set_user_token_with_personalization + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enablePersonalization": True, + "userToken": "123456", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","enablePersonalization":true,"userToken":"123456"}""" + ) + + def test_search_single_index_105(self): + """ + override_default_query_type + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "queryType": "prefixAll", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","queryType":"prefixAll"}""" + ) + + def test_search_single_index_106(self): + """ + override_default_remove_words_if_no_results + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "removeWordsIfNoResults": "lastWords", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","removeWordsIfNoResults":"lastWords"}""" + ) + + def test_search_single_index_107(self): + """ + enable_advanced_syntax_search_time + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","advancedSyntax":true}""") + + def test_search_single_index_108(self): + """ + overide_default_optional_words + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "optionalWords": [ + "toyota", + "2020 2021", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","optionalWords":["toyota","2020 2021"]}""" + ) + + def test_search_single_index_109(self): + """ + disabling_exact_for_some_attributes_search_time + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "disableExactOnAttributes": [ + "description", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","disableExactOnAttributes":["description"]}""" + ) + + def test_search_single_index_110(self): + """ + override_default_exact_single_word_query + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "exactOnSingleWordQuery": "none", + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","exactOnSingleWordQuery":"none"}""" + ) + + def test_search_single_index_111(self): + """ + override_default_aternative_as_exact + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "alternativesAsExact": [ + "multiWordsSynonym", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","alternativesAsExact":["multiWordsSynonym"]}""" + ) + + def test_search_single_index_112(self): + """ + enable_advanced_syntax_exact_phrase + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}""" + ) + + def test_search_single_index_113(self): + """ + enable_advanced_syntax_exclude_words + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "excludeWords", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}""" + ) + + def test_search_single_index_114(self): + """ + override_distinct + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "distinct": 0, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","distinct":0}""") + + def test_search_single_index_115(self): + """ + get_ranking_info + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "getRankingInfo": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","getRankingInfo":true}""") + + def test_search_single_index_116(self): + """ + disable_click_analytics + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "clickAnalytics": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","clickAnalytics":false}""") + + def test_search_single_index_117(self): + """ + enable_click_analytics + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "clickAnalytics": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","clickAnalytics":true}""") + + def test_search_single_index_118(self): + """ + disable_analytics + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "analytics": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","analytics":false}""") + + def test_search_single_index_119(self): + """ + add_analytics_tags + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "analyticsTags": [ + "front_end", + "website2", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","analyticsTags":["front_end","website2"]}""" + ) + + def test_search_single_index_120(self): + """ + disable_synonyms + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "synonyms": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","synonyms":false}""") + + def test_search_single_index_121(self): + """ + override_replace_synonyms_in_highlights + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "replaceSynonymsInHighlight": True, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","replaceSynonymsInHighlight":true}""" + ) + + def test_search_single_index_122(self): + """ + override_min_proximity + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "minProximity": 2, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","minProximity":2}""") + + def test_search_single_index_123(self): + """ + override_default_field + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "responseFields": [ + "hits", + "facets", + ], + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","responseFields":["hits","facets"]}""" + ) + + def test_search_single_index_124(self): + """ + override_percentile_computation + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "percentileComputation": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","percentileComputation":false}""" + ) + + def test_search_single_index_125(self): + """ + set_ab_test + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableABTest": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"query":"query","enableABTest":false}""") + + def test_search_single_index_126(self): + """ + set_enable_re_ranking + """ + _req = self._client.search_single_index_with_http_info( + index_name="indexName", + search_params={ + "query": "query", + "enableReRanking": False, + }, + ) + + assert _req.path == "/1/indexes/indexName/query" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"query","enableReRanking":false}""" + ) + + def test_search_synonyms_(self): + """ + searchSynonyms with minimal parameters + """ + _req = self._client.search_synonyms_with_http_info( + index_name="indexName", + ) + + assert _req.path == "/1/indexes/indexName/synonyms/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{}""") + + def test_search_synonyms_1(self): + """ + searchSynonyms with all parameters + """ + _req = self._client.search_synonyms_with_http_info( + index_name="indexName", + search_synonyms_params={ + "query": "myQuery", + "type": "altcorrection1", + "page": 10, + "hitsPerPage": 10, + }, + ) + + assert _req.path == "/1/indexes/indexName/synonyms/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""" + ) + + def test_search_user_ids_(self): + """ + searchUserIds + """ + _req = self._client.search_user_ids_with_http_info( + search_user_ids_params={ + "query": "test", + "clusterName": "theClusterName", + "page": 5, + "hitsPerPage": 10, + }, + ) + + assert _req.path == "/1/clusters/mapping/search" + assert _req.verb == "POST" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""" + ) + + def test_set_dictionary_settings_(self): + """ + get setDictionarySettings results with minimal parameters + """ + _req = self._client.set_dictionary_settings_with_http_info( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + }, + }, + ) + + assert _req.path == "/1/dictionaries/*/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""" + ) + + def test_set_dictionary_settings_1(self): + """ + get setDictionarySettings results with all parameters + """ + _req = self._client.set_dictionary_settings_with_http_info( + dictionary_settings_params={ + "disableStandardEntries": { + "plurals": { + "fr": False, + "en": False, + "ru": True, + }, + "stopwords": { + "fr": False, + }, + "compounds": { + "ru": True, + }, + }, + }, + ) + + assert _req.path == "/1/dictionaries/*/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" + ) + + def test_set_settings_(self): + """ + minimal parameters + """ + _req = self._client.set_settings_with_http_info( + index_name="cts_e2e_settings", + index_settings={ + "paginationLimitedTo": 10, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/cts_e2e_settings/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"paginationLimitedTo":10}""") + + def test_set_settings_1(self): + """ + boolean typoTolerance + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "typoTolerance": True, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"typoTolerance":true}""") + + def test_set_settings_2(self): + """ + enum typoTolerance + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "typoTolerance": "min", + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"typoTolerance":"min"}""") + + def test_set_settings_3(self): + """ + ignorePlurals + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ignorePlurals": True, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"ignorePlurals":true}""") + + def test_set_settings_4(self): + """ + list of string ignorePlurals + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ignorePlurals": [ + "fr", + ], + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"ignorePlurals":["fr"]}""") + + def test_set_settings_5(self): + """ + removeStopWords boolean + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "removeStopWords": True, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"removeStopWords":true}""") + + def test_set_settings_6(self): + """ + removeStopWords list of string + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "removeStopWords": [ + "fr", + ], + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"removeStopWords":["fr"]}""") + + def test_set_settings_7(self): + """ + boolean distinct + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": True, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"distinct":true}""") + + def test_set_settings_8(self): + """ + integer distinct + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": 1, + }, + forward_to_replicas=True, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"distinct":1}""") + + def test_set_settings_9(self): + """ + distinct company + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "company", + "distinct": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributeForDistinct":"company","distinct":true}""" + ) + + def test_set_settings_10(self): + """ + distinct design + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "design", + "distinct": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributeForDistinct":"design","distinct":true}""" + ) + + def test_set_settings_11(self): + """ + distinct true + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "distinct": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"distinct":true}""") + + def test_set_settings_12(self): + """ + distinct section + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributeForDistinct": "section", + "distinct": True, + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributeForDistinct":"section","distinct":true}""" + ) + + def test_set_settings_13(self): + """ + attributesForFaceting allergens + """ + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "allergens", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributesForFaceting":["allergens"]}""") + + def test_set_settings_14(self): + """ + api_attributes_for_faceting + """ + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "author", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributesForFaceting":["genre","author"]}""" + ) + + def test_set_settings_15(self): + """ + api_attributes_for_faceting_searchable + """ + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "genre", + "searchable(author)", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributesForFaceting":["genre","searchable(author)"]}""" + ) + + def test_set_settings_16(self): + """ + api_attributes_for_filter_only + """ + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(genre)", + "author", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"attributesForFaceting":["filterOnly(genre)","author"]}""" + ) + + def test_set_settings_17(self): + """ + attributesForFaceting categoryPageId + """ + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "searchable(categoryPageId)", + ], + }, + ) + + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"requests":[{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowTyposOnNumericTokens":true,"alternativesAsExact":["multiWordsSynonym"],"analytics":true,"analyticsTags":[""],"aroundLatLng":"","aroundLatLngViaIP":true,"aroundPrecision":0,"aroundRadius":"all","attributeCriteriaComputedByMinProximity":true,"attributesToHighlight":[""],"attributesToRetrieve":[""],"attributesToSnippet":[""],"clickAnalytics":true,"decompoundQuery":true,"disableExactOnAttributes":[""],"disableTypoToleranceOnAttributes":[""],"distinct":0,"enableABTest":true,"enablePersonalization":true,"enableReRanking":true,"enableRules":true,"exactOnSingleWordQuery":"attribute","facetFilters":[""],"facetingAfterDistinct":true,"facets":[""],"filters":"","getRankingInfo":true,"highlightPostTag":"","highlightPreTag":"","hitsPerPage":1,"ignorePlurals":false,"indexName":"theIndexName","insideBoundingBox":[[47.3165,4.9665,47.3424,5.0201],[40.9234,2.1185,38.643,1.9916]],"insidePolygon":[[47.3165,4.9665,47.3424,5.0201,47.32,4.9],[40.9234,2.1185,38.643,1.9916,39.2587,2.0104]],"length":1,"maxValuesPerFacet":0,"minProximity":1,"minWordSizefor1Typo":0,"minWordSizefor2Typos":0,"minimumAroundRadius":1,"naturalLanguages":["fr"],"numericFilters":[""],"offset":0,"optionalFilters":[""],"optionalWords":[""],"page":0,"percentileComputation":true,"personalizationImpact":0,"query":"","queryLanguages":["fr"],"queryType":"prefixAll","ranking":[""],"reRankingApplyFilter":[""],"relevancyStrictness":0,"removeStopWords":true,"removeWordsIfNoResults":"allOptional","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"responseFields":[""],"restrictHighlightAndSnippetArrays":true,"restrictSearchableAttributes":[""],"ruleContexts":[""],"similarQuery":"","snippetEllipsisText":"","sortFacetValuesBy":"","sumOrFiltersScores":true,"synonyms":true,"tagFilters":[""],"type":"default","typoTolerance":"min","userToken":""}]}""" + """{"attributesForFaceting":["searchable(categoryPageId)"]}""" ) - def test_search_dictionary_entries_(self): + def test_set_settings_18(self): """ - get searchDictionaryEntries results with minimal parameters + unretrievableAttributes """ - _req = self._client.search_dictionary_entries_with_http_info( - dictionary_name="stopwords", - search_dictionary_entries_params={ - "query": "about", + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "unretrievableAttributes": [ + "visible_by", + ], }, ) - assert _req.path == "/1/dictionaries/stopwords/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"query":"about"}""") + assert loads(_req.data) == loads( + """{"unretrievableAttributes":["visible_by"]}""" + ) - def test_search_dictionary_entries_1(self): + def test_set_settings_19(self): """ - get searchDictionaryEntries results with all parameters + attributesForFaceting user restricted data """ - _req = self._client.search_dictionary_entries_with_http_info( - dictionary_name="compounds", - search_dictionary_entries_params={ - "query": "foo", - "page": 4, - "hitsPerPage": 2, - "language": "fr", + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(visible_by)", + ], }, ) - assert _req.path == "/1/dictionaries/compounds/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"foo","page":4,"hitsPerPage":2,"language":"fr"}""" + """{"attributesForFaceting":["filterOnly(visible_by)"]}""" ) - def test_search_for_facet_values_(self): + def test_set_settings_20(self): """ - get searchForFacetValues results with minimal parameters + attributesForFaceting optional filters """ - _req = self._client.search_for_facet_values_with_http_info( - index_name="indexName", - facet_name="facetName", + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "can_deliver_quickly", + "restaurant", + ], + }, ) - assert _req.path == "/1/indexes/indexName/facets/facetName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""" + ) - def test_search_for_facet_values_1(self): + def test_set_settings_21(self): """ - get searchForFacetValues results with all parameters + attributesForFaceting redirect index """ - _req = self._client.search_for_facet_values_with_http_info( - index_name="indexName", - facet_name="facetName", - search_for_facet_values_request={ - "params": "query=foo&facetFilters=['bar']", - "facetQuery": "foo", - "maxFacetHits": 42, + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "query_terms", + ], }, ) - assert _req.path == "/1/indexes/indexName/facets/facetName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"params":"query=foo&facetFilters=['bar']","facetQuery":"foo","maxFacetHits":42}""" + """{"attributesForFaceting":["query_terms"]}""" ) - def test_search_for_facet_values_2(self): + def test_set_settings_22(self): """ - facetName and facetQuery + attributesForFaceting multiple consequences """ - _req = self._client.search_for_facet_values_with_http_info( - index_name="indexName", - facet_name="author", - search_for_facet_values_request={ - "facetQuery": "stephen king", + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "director", + ], }, ) - assert _req.path == "/1/indexes/indexName/facets/author/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facetQuery":"stephen king"}""") + assert loads(_req.data) == loads("""{"attributesForFaceting":["director"]}""") - def test_search_rules_(self): + def test_set_settings_23(self): """ - searchRules + attributesForFaceting in-depth optional filters """ - _req = self._client.search_rules_with_http_info( - index_name="cts_e2e_browse", - search_rules_params={ - "query": "zorro", + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "filterOnly(brand)", + ], }, ) - assert _req.path == "/1/indexes/cts_e2e_browse/rules/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"query":"zorro"}""") + assert loads(_req.data) == loads( + """{"attributesForFaceting":["filterOnly(brand)"]}""" + ) - def test_search_single_index_(self): + def test_set_settings_24(self): """ - search with minimal parameters + mode neuralSearch """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "neuralSearch", + }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") - def test_search_single_index_1(self): + def test_set_settings_25(self): """ - search with special characters in indexName + mode keywordSearch """ - _req = self._client.search_single_index_with_http_info( - index_name="cts_e2e_space in index", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "mode": "keywordSearch", + }, ) - assert _req.path == "/1/indexes/cts_e2e_space%20in%20index/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") - def test_search_single_index_2(self): + def test_set_settings_26(self): """ - search with searchParams + searchableAttributes same priority """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "query": "myQuery", - "facetFilters": [ - "tags:algolia", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title,comments", + "ingredients", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"searchableAttributes":["title,comments","ingredients"]}""" + ) + + def test_set_settings_27(self): + """ + searchableAttributes higher priority + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title", + "ingredients", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"searchableAttributes":["title","ingredients"]}""" + ) + + def test_set_settings_28(self): + """ + customRanking retweets + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(retweets)", + "desc(likes)", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads( + """{"customRanking":["desc(retweets)","desc(likes)"]}""" + ) + + def test_set_settings_29(self): + """ + customRanking boosted + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(boosted)", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"query":"myQuery","facetFilters":["tags:algolia"]}""" - ) + assert loads(_req.data) == loads("""{"customRanking":["desc(boosted)"]}""") - def test_search_single_index_3(self): + def test_set_settings_30(self): """ - single search retrieve snippets + customRanking pageviews """ - _req = self._client.search_single_index_with_http_info( - index_name="cts_e2e_browse", - search_params={ - "query": "batman mask of the phantasm", - "attributesToRetrieve": [ - "*", - ], - "attributesToSnippet": [ - "*:20", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(pageviews)", + "desc(comments)", ], }, ) - assert _req.path == "/1/indexes/cts_e2e_browse/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"batman mask of the phantasm","attributesToRetrieve":["*"],"attributesToSnippet":["*:20"]}""" + """{"customRanking":["desc(pageviews)","desc(comments)"]}""" ) - def test_search_single_index_4(self): + def test_set_settings_31(self): """ - query + customRanking applying search parameters for a specific query """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "query": "phone", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(nb_airline_liaisons)", + ], + "attributesForFaceting": [ + "city, country", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"query":"phone"}""") + assert loads(_req.data) == loads( + """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""" + ) - def test_search_single_index_5(self): + def test_set_settings_32(self): """ - filters + customRanking rounded pageviews """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "country:US AND price.gross < 2.0", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(rounded_pageviews)", + "desc(comments)", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"country:US AND price.gross < 2.0"}""" + """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""" ) - def test_search_single_index_6(self): + def test_set_settings_33(self): """ - distinct + customRanking price """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "distinct": True, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(price)", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":true}""") + assert loads(_req.data) == loads("""{"customRanking":["desc(price)"]}""") - def test_search_single_index_7(self): + def test_set_settings_34(self): """ - filtersNumeric + ranking exhaustive """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "price < 10", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"filters":"price < 10"}""") + assert loads(_req.data) == loads( + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + ) - def test_search_single_index_8(self): + def test_set_settings_35(self): """ - filtersTimestamp + ranking standard replica """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "NOT date_timestamp:1514764800 TO 1546300799", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "desc(post_date_timestamp)", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"NOT date_timestamp:1514764800 TO 1546300799"}""" + """{"ranking":["desc(post_date_timestamp)"]}""" ) - def test_search_single_index_9(self): + def test_set_settings_36(self): """ - filtersSumOrFiltersScoresFalse + ranking virtual replica """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "(company:Google OR company:Amazon OR company:Facebook)", - "sumOrFiltersScores": False, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "desc(post_date_timestamp)", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"(company:Google OR company:Amazon OR company:Facebook)","sumOrFiltersScores":false}""" + """{"customRanking":["desc(post_date_timestamp)"]}""" ) - def test_search_single_index_10(self): + def test_set_settings_37(self): """ - filtersSumOrFiltersScoresTrue + customRanking and ranking sort alphabetically """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "(company:Google OR company:Amazon OR company:Facebook)", - "sumOrFiltersScores": True, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "ranking": [ + "custom", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"(company:Google OR company:Amazon OR company:Facebook)","sumOrFiltersScores":true}""" + """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" ) - def test_search_single_index_11(self): + def test_set_settings_38(self): """ - filtersStephenKing + relevancyStrictness """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": 'author:"Stephen King"', + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "customRanking": [ + "asc(textual_attribute)", + ], + "relevancyStrictness": 0, }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"filters":"author:\\"Stephen King\\""}""") - - def test_search_single_index_12(self): - """ - filtersNotTags - """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "NOT _tags:non-fiction", - }, + assert loads(_req.data) == loads( + """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""" ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"filters":"NOT _tags:non-fiction"}""") - - def test_search_single_index_13(self): + def test_set_settings_39(self): """ - facetFiltersList + create replica index """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "facetFilters": [ - "publisher:Penguin", - [ - "author:Stephen King", - "genre:Horror", - ], + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "products_price_desc", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"facetFilters":["publisher:Penguin",["author:Stephen King","genre:Horror"]]}""" - ) + assert loads(_req.data) == loads("""{"replicas":["products_price_desc"]}""") - def test_search_single_index_14(self): + def test_set_settings_40(self): """ - facetFiltersNeg + create replica index articles """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "facetFilters": "category:-Ebook", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "articles_date_desc", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facetFilters":"category:-Ebook"}""") + assert loads(_req.data) == loads("""{"replicas":["articles_date_desc"]}""") - def test_search_single_index_15(self): + def test_set_settings_41(self): """ - filtersAndFacetFilters + create virtual replica index """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": '(author:"Stephen King" OR genre:"Horror")', - "facetFilters": [ - "publisher:Penguin", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "virtual(products_price_desc)", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"(author:\\"Stephen King\\" OR genre:\\"Horror\\")","facetFilters":["publisher:Penguin"]}""" + """{"replicas":["virtual(products_price_desc)"]}""" ) - def test_search_single_index_16(self): + def test_set_settings_42(self): """ - facet author genre + unlink replica index """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "facets": [ - "author", - "genre", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "replicas": [ + "", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facets":["author","genre"]}""") + assert loads(_req.data) == loads("""{"replicas":[""]}""") - def test_search_single_index_17(self): + def test_set_settings_43(self): """ - facet wildcard + forwardToReplicas """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "facets": [ - "*", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "description", ], }, + forward_to_replicas=True, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"facets":["*"]}""") + assert loads(_req.data) == loads( + """{"searchableAttributes":["name","description"]}""" + ) - def test_search_single_index_18(self): + def test_set_settings_44(self): """ maxValuesPerFacet """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ "maxValuesPerFacet": 1000, }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") - def test_search_single_index_19(self): - """ - aroundLatLng - """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "aroundLatLng": "40.71, -74.01", - }, - ) - - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" - assert _req.query_parameters.items() == {}.items() - assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"aroundLatLng":"40.71, -74.01"}""") - - def test_search_single_index_20(self): + def test_set_settings_45(self): """ - aroundLatLngViaIP + maxFacetHits """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "aroundLatLngViaIP": True, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "maxFacetHits": 1000, }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"aroundLatLngViaIP":true}""") + assert loads(_req.data) == loads("""{"maxFacetHits":1000}""") - def test_search_single_index_21(self): + def test_set_settings_46(self): """ - aroundRadius + attributesForFaceting complex """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "aroundLatLng": "40.71, -74.01", - "aroundRadius": 1000000, + _req = self._client.set_settings_with_http_info( + index_name="", + index_settings={ + "attributesForFaceting": [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"aroundLatLng":"40.71, -74.01","aroundRadius":1000000}""" + """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""" ) - def test_search_single_index_22(self): + def test_set_settings_47(self): """ - insideBoundingBox + ranking closest dates """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "insideBoundingBox": [ - [ - 49.067996905313834, - 65.73828125, - 25.905859247243498, - 128.8046875, - ], + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "ranking": [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"insideBoundingBox":[[49.067996905313834,65.73828125,25.905859247243498,128.8046875]]}""" + """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" ) - def test_search_single_index_23(self): + def test_set_settings_48(self): """ - insidePolygon + searchableAttributes item variation """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "insidePolygon": [ - [ - 42.01, - -124.31, - 48.835509470063045, - -124.40453125000005, - 45.01082951668149, - -65.95726562500005, - 31.247243545293433, - -81.06578125000004, - 25.924152577235226, - -97.68234374999997, - 32.300311895879545, - -117.54828125, - ], + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "design", + "type", + "color", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" + """{"searchableAttributes":["design","type","color"]}""" ) - def test_search_single_index_24(self): + def test_set_settings_49(self): """ - insidePolygon + searchableAttributes around location """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "insidePolygon": [ - [ - 42.01, - -124.31, - 48.835509470063045, - -124.40453125000005, - 45.01082951668149, - -65.95726562500005, - 31.247243545293433, - -81.06578125000004, - 25.924152577235226, - -97.68234374999997, - 32.300311895879545, - -117.54828125, - ], + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "country", + "code", + "iata_code", + ], + "customRanking": [ + "desc(links_count)", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"insidePolygon":[[42.01,-124.31,48.835509470063045,-124.40453125000005,45.01082951668149,-65.95726562500005,31.247243545293433,-81.06578125000004,25.924152577235226,-97.68234374999997,32.300311895879545,-117.54828125]]}""" + """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" ) - def test_search_single_index_25(self): + def test_set_settings_50(self): """ - optionalFilters + attributesToHighlight """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "optionalFilters": [ - "can_deliver_quickly:true", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToHighlight": [ + "author", + "title", + "content", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"optionalFilters":["can_deliver_quickly:true"]}""" + """{"attributesToHighlight":["author","title","content"]}""" ) - def test_search_single_index_26(self): + def test_set_settings_51(self): """ - optionalFiltersMany + attributesToHighlightStar """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "optionalFilters": [ - "brand:Apple", - "brand:Samsung", - "brand:-Huawei", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToHighlight": [ + "*", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"optionalFilters":["brand:Apple","brand:Samsung","brand:-Huawei"]}""" - ) + assert loads(_req.data) == loads("""{"attributesToHighlight":["*"]}""") - def test_search_single_index_27(self): + def test_set_settings_52(self): """ - optionalFiltersSimple + everything """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "optionalFilters": [ - "brand:Apple", - "type:tablet", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "advancedSyntax": True, + "advancedSyntaxFeatures": [ + "exactPhrase", + ], + "allowCompressionOfIntegerArray": True, + "allowTyposOnNumericTokens": True, + "alternativesAsExact": [ + "singleWordSynonym", + ], + "attributeCriteriaComputedByMinProximity": True, + "attributeForDistinct": "test", + "attributesForFaceting": [ + "algolia", + ], + "attributesToHighlight": [ + "algolia", + ], + "attributesToRetrieve": [ + "algolia", + ], + "attributesToSnippet": [ + "algolia", + ], + "attributesToTransliterate": [ + "algolia", + ], + "camelCaseAttributes": [ + "algolia", + ], + "customNormalization": { + "algolia": { + "aloglia": "aglolia", + }, + }, + "customRanking": [ + "algolia", + ], + "decompoundQuery": False, + "decompoundedAttributes": { + "algolia": "aloglia", + }, + "disableExactOnAttributes": [ + "algolia", + ], + "disablePrefixOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnAttributes": [ + "algolia", + ], + "disableTypoToleranceOnWords": [ + "algolia", + ], + "distinct": 3, + "enablePersonalization": True, + "enableReRanking": False, + "enableRules": True, + "exactOnSingleWordQuery": "attribute", + "highlightPreTag": "", + "highlightPostTag": "", + "hitsPerPage": 10, + "ignorePlurals": False, + "indexLanguages": [ + "fr", + ], + "keepDiacriticsOnCharacters": "abc", + "maxFacetHits": 20, + "maxValuesPerFacet": 30, + "minProximity": 6, + "minWordSizefor1Typo": 5, + "minWordSizefor2Typos": 11, + "mode": "neuralSearch", + "numericAttributesForFiltering": [ + "algolia", + ], + "optionalWords": [ + "myspace", + ], + "paginationLimitedTo": 0, + "queryLanguages": [ + "fr", + ], + "queryType": "prefixLast", + "ranking": [ + "geo", + ], + "reRankingApplyFilter": "mySearch:filters", + "relevancyStrictness": 10, + "removeStopWords": False, + "removeWordsIfNoResults": "lastWords", + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "a", + "b", + ], + }, + "values": { + "a": { + "order": [ + "b", + ], + "sortRemainingBy": "count", + }, + }, + }, + }, + "replaceSynonymsInHighlight": True, + "replicas": [ + "", + ], + "responseFields": [ + "algolia", + ], + "restrictHighlightAndSnippetArrays": True, + "searchableAttributes": [ + "foo", + ], + "semanticSearch": { + "eventSources": [ + "foo", + ], + }, + "separatorsToIndex": "bar", + "snippetEllipsisText": "---", + "sortFacetValuesBy": "date", + "typoTolerance": False, + "unretrievableAttributes": [ + "foo", ], + "userData": { + "user": "data", + }, }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"optionalFilters":["brand:Apple","type:tablet"]}""" + """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" ) - def test_search_single_index_28(self): + def test_set_settings_53(self): """ - restrictSearchableAttributes + searchableAttributesWithCustomRankingsAndAttributesForFaceting """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "restrictSearchableAttributes": [ - "title_fr", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "brand", + "name", + "categories", + "unordered(description)", + ], + "customRanking": [ + "desc(popularity)", + ], + "attributesForFaceting": [ + "searchable(brand)", + "type", + "categories", + "price", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"restrictSearchableAttributes":["title_fr"]}""" + """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" ) - def test_search_single_index_29(self): + def test_set_settings_54(self): """ - getRankingInfo + searchableAttributesOrdering """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "getRankingInfo": True, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "unordered(title)", + "cast", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"getRankingInfo":true}""") + assert loads(_req.data) == loads( + """{"searchableAttributes":["unordered(title)","cast"]}""" + ) - def test_search_single_index_30(self): + def test_set_settings_55(self): """ - clickAnalytics + searchableAttributesProductReferenceSuffixes """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "clickAnalytics": True, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "name", + "product_reference", + "product_reference_suffixes", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"clickAnalytics":true}""") + assert loads(_req.data) == loads( + """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""" + ) - def test_search_single_index_31(self): + def test_set_settings_56(self): """ - clickAnalyticsUserToken + queryLanguageAndIgnorePlurals """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "clickAnalytics": True, - "userToken": "user-1", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "queryLanguages": [ + "en", + ], + "ignorePlurals": True, }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"clickAnalytics":true,"userToken":"user-1"}""" + """{"queryLanguages":["en"],"ignorePlurals":true}""" ) - def test_search_single_index_32(self): + def test_set_settings_57(self): """ - enablePersonalization + searchableAttributesInMovies """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "enablePersonalization": True, - "userToken": "user-1", + _req = self._client.set_settings_with_http_info( + index_name="movies", + index_settings={ + "searchableAttributes": [ + "title_eng", + "title_fr", + "title_es", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/movies/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"enablePersonalization":true,"userToken":"user-1"}""" + """{"searchableAttributes":["title_eng","title_fr","title_es"]}""" ) - def test_search_single_index_33(self): + def test_set_settings_58(self): """ - userToken + disablePrefixOnAttributes """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "userToken": "user-1", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disablePrefixOnAttributes": [ + "serial_number", + ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"userToken":"user-1"}""") + assert loads(_req.data) == loads( + """{"disablePrefixOnAttributes":["serial_number"]}""" + ) - def test_search_single_index_34(self): + def test_set_settings_59(self): """ - analyticsTag + disableTypoToleranceOnAttributes """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "analyticsTags": [ - "YOUR_ANALYTICS_TAG", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "disableTypoToleranceOnAttributes": [ + "serial_number", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"analyticsTags":["YOUR_ANALYTICS_TAG"]}""") + assert loads(_req.data) == loads( + """{"disableTypoToleranceOnAttributes":["serial_number"]}""" + ) - def test_search_single_index_35(self): + def test_set_settings_60(self): """ - facetFiltersUsers + searchableAttributesSimpleExample """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "facetFilters": [ - "user:user42", - "user:public", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "serial_number", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"facetFilters":["user:user42","user:public"]}""" + """{"searchableAttributes":["serial_number"]}""" ) - def test_search_single_index_36(self): + def test_set_settings_61(self): """ - buildTheQuery + searchableAttributesSimpleExampleAlt """ - _req = self._client.search_single_index_with_http_info( - index_name="indexName", - search_params={ - "filters": "categoryPageId: Men's Clothing", - "hitsPerPage": 50, - "analyticsTags": [ - "mens-clothing", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "serial_number", + "serial_number_suffixes", ], }, ) - assert _req.path == "/1/indexes/indexName/query" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"filters":"categoryPageId: Men's Clothing","hitsPerPage":50,"analyticsTags":["mens-clothing"]}""" + """{"searchableAttributes":["serial_number","serial_number_suffixes"]}""" ) - def test_search_synonyms_(self): + def test_set_settings_62(self): """ - searchSynonyms with minimal parameters + set_searchable_attributes """ - _req = self._client.search_synonyms_with_http_info( - index_name="indexName", + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "searchableAttributes": [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ], + }, ) - assert _req.path == "/1/indexes/indexName/synonyms/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{}""") + assert loads(_req.data) == loads( + """{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}""" + ) - def test_search_synonyms_1(self): + def test_set_settings_63(self): """ - searchSynonyms with all parameters + set_searchable_attributes """ - _req = self._client.search_synonyms_with_http_info( - index_name="indexName", - search_synonyms_params={ - "query": "myQuery", - "type": "altcorrection1", - "page": 10, - "hitsPerPage": 10, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesForFaceting": [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ], }, ) - assert _req.path == "/1/indexes/indexName/synonyms/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""" + """{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}""" ) - def test_search_user_ids_(self): + def test_set_settings_64(self): """ - searchUserIds + unretrievable_attributes """ - _req = self._client.search_user_ids_with_http_info( - search_user_ids_params={ - "query": "test", - "clusterName": "theClusterName", - "page": 5, - "hitsPerPage": 10, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "unretrievableAttributes": [ + "total_number_of_sales", + ], }, ) - assert _req.path == "/1/clusters/mapping/search" - assert _req.verb == "POST" + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""" + """{"unretrievableAttributes":["total_number_of_sales"]}""" ) - def test_set_dictionary_settings_(self): + def test_set_settings_65(self): """ - get setDictionarySettings results with minimal parameters + set_retrievable_attributes """ - _req = self._client.set_dictionary_settings_with_http_info( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - }, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "author", + "title", + "content", + ], }, ) - assert _req.path == "/1/dictionaries/*/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""" + """{"attributesToRetrieve":["author","title","content"]}""" ) - def test_set_dictionary_settings_1(self): + def test_set_settings_66(self): """ - get setDictionarySettings results with all parameters + set_all_attributes_as_retrievable """ - _req = self._client.set_dictionary_settings_with_http_info( - dictionary_settings_params={ - "disableStandardEntries": { - "plurals": { - "fr": False, - "en": False, - "ru": True, - }, - "stopwords": { - "fr": False, - }, - "compounds": { - "ru": True, - }, - }, + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "*", + ], + }, + ) + + assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.verb == "PUT" + assert _req.query_parameters.items() == {}.items() + assert _req.headers.items() >= {}.items() + assert loads(_req.data) == loads("""{"attributesToRetrieve":["*"]}""") + + def test_set_settings_67(self): + """ + specify_attributes_not_to_retrieve + """ + _req = self._client.set_settings_with_http_info( + index_name="theIndexName", + index_settings={ + "attributesToRetrieve": [ + "*", + "-SKU", + "-internal_desc", + ], }, ) - assert _req.path == "/1/dictionaries/*/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" + """{"attributesToRetrieve":["*","-SKU","-internal_desc"]}""" ) - def test_set_settings_(self): + def test_set_settings_68(self): """ - minimal parameters + neural_search """ _req = self._client.set_settings_with_http_info( - index_name="cts_e2e_settings", + index_name="theIndexName", index_settings={ - "paginationLimitedTo": 10, + "mode": "neuralSearch", }, - forward_to_replicas=True, ) - assert _req.path == "/1/indexes/cts_e2e_settings/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"paginationLimitedTo":10}""") + assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") - def test_set_settings_1(self): + def test_set_settings_69(self): """ - boolean typoTolerance + keyword_search """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "typoTolerance": True, + "mode": "keywordSearch", }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"typoTolerance":true}""") + assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") - def test_set_settings_2(self): + def test_set_settings_70(self): """ - enum typoTolerance + set_default_ranking """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "typoTolerance": "min", + "ranking": [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ], }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"typoTolerance":"min"}""") + assert loads(_req.data) == loads( + """{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}""" + ) - def test_set_settings_3(self): + def test_set_settings_71(self): """ - ignorePlurals + set_ranking_by_attribute_asc """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "ignorePlurals": True, + "ranking": [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ], }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"ignorePlurals":true}""") + assert loads(_req.data) == loads( + """{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + ) - def test_set_settings_4(self): + def test_set_settings_72(self): """ - list of string ignorePlurals + set_ranking_by_attribute_desc """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "ignorePlurals": [ - "fr", + "ranking": [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", ], }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"ignorePlurals":["fr"]}""") + assert loads(_req.data) == loads( + """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + ) - def test_set_settings_5(self): + def test_set_settings_73(self): """ - removeStopWords boolean + restrict_searchable_attributes """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "removeStopWords": True, + "customRanking": [ + "desc(popularity)", + "asc(price)", + ], }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"removeStopWords":true}""") + assert loads(_req.data) == loads( + """{"customRanking":["desc(popularity)","asc(price)"]}""" + ) - def test_set_settings_6(self): + def test_set_settings_74(self): """ - removeStopWords list of string + set_default_relevancy """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "removeStopWords": [ - "fr", - ], + "relevancyStrictness": 90, }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"removeStopWords":["fr"]}""") + assert loads(_req.data) == loads("""{"relevancyStrictness":90}""") - def test_set_settings_7(self): + def test_set_settings_75(self): """ - boolean distinct + set_replicas """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "distinct": True, + "replicas": [ + "name_of_replica_index1", + "name_of_replica_index2", + ], }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":true}""") + assert loads(_req.data) == loads( + """{"replicas":["name_of_replica_index1","name_of_replica_index2"]}""" + ) - def test_set_settings_8(self): + def test_set_settings_76(self): """ - integer distinct + set_default_max_values_per_facet """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "distinct": 1, + "maxValuesPerFacet": 100, }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":1}""") + assert loads(_req.data) == loads("""{"maxValuesPerFacet":100}""") - def test_set_settings_9(self): + def test_set_settings_77(self): """ - distinct company + set_default_sort_facet_values_by """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "attributeForDistinct": "company", - "distinct": True, + "sortFacetValuesBy": "alpha", }, ) @@ -10217,19 +17026,19 @@ def test_set_settings_9(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributeForDistinct":"company","distinct":true}""" - ) + assert loads(_req.data) == loads("""{"sortFacetValuesBy":"alpha"}""") - def test_set_settings_10(self): + def test_set_settings_78(self): """ - distinct design + set_attributes_to_snippet """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "attributeForDistinct": "design", - "distinct": True, + "attributesToSnippet": [ + "content:80", + "description", + ], }, ) @@ -10238,17 +17047,19 @@ def test_set_settings_10(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributeForDistinct":"design","distinct":true}""" + """{"attributesToSnippet":["content:80","description"]}""" ) - def test_set_settings_11(self): + def test_set_settings_79(self): """ - distinct true + set_all_attributes_to_snippet """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "distinct": True, + "attributesToSnippet": [ + "*:80", + ], }, ) @@ -10256,17 +17067,16 @@ def test_set_settings_11(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"distinct":true}""") + assert loads(_req.data) == loads("""{"attributesToSnippet":["*:80"]}""") - def test_set_settings_12(self): + def test_set_settings_80(self): """ - distinct section + set_default_highlight_pre_tag """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "attributeForDistinct": "section", - "distinct": True, + "highlightPreTag": "", }, ) @@ -10274,183 +17084,154 @@ def test_set_settings_12(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributeForDistinct":"section","distinct":true}""" - ) + assert loads(_req.data) == loads("""{"highlightPreTag":""}""") - def test_set_settings_13(self): + def test_set_settings_81(self): """ - attributesForFaceting allergens + set_default_highlight_post_tag """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "allergens", - ], + "highlightPostTag": "", }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributesForFaceting":["allergens"]}""") + assert loads(_req.data) == loads("""{"highlightPostTag":""}""") - def test_set_settings_14(self): + def test_set_settings_82(self): """ - attributesForFaceting categoryPageId + set_default_snippet_ellipsis_text """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "searchable(categoryPageId)", - ], + "snippetEllipsisText": "…", }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["searchable(categoryPageId)"]}""" - ) + assert loads(_req.data) == loads("""{"snippetEllipsisText":"…"}""") - def test_set_settings_15(self): + def test_set_settings_83(self): """ - unretrievableAttributes + enable_restrict_highlight_and_snippet_arrays_by_default """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "unretrievableAttributes": [ - "visible_by", - ], + "restrictHighlightAndSnippetArrays": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"unretrievableAttributes":["visible_by"]}""" + """{"restrictHighlightAndSnippetArrays":true}""" ) - def test_set_settings_16(self): + def test_set_settings_84(self): """ - attributesForFaceting user restricted data + set_default_hits_per_page """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "filterOnly(visible_by)", - ], + "hitsPerPage": 20, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["filterOnly(visible_by)"]}""" - ) + assert loads(_req.data) == loads("""{"hitsPerPage":20}""") - def test_set_settings_17(self): + def test_set_settings_85(self): """ - attributesForFaceting optional filters + set_pagination_limit """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "can_deliver_quickly", - "restaurant", - ], + "paginationLimitedTo": 1000, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""" - ) + assert loads(_req.data) == loads("""{"paginationLimitedTo":1000}""") - def test_set_settings_18(self): + def test_set_settings_86(self): """ - attributesForFaceting redirect index + set_default_min_word_size_for_one_typo """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "query_terms", - ], + "minWordSizefor1Typo": 4, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["query_terms"]}""" - ) + assert loads(_req.data) == loads("""{"minWordSizefor1Typo":4}""") - def test_set_settings_19(self): + def test_set_settings_87(self): """ - attributesForFaceting multiple consequences + set_default_min_word_size_for_two_typos """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "director", - ], + "minWordSizefor2Typos": 4, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"attributesForFaceting":["director"]}""") + assert loads(_req.data) == loads("""{"minWordSizefor2Typos":4}""") - def test_set_settings_20(self): + def test_set_settings_88(self): """ - attributesForFaceting in-depth optional filters + set_default_typo_tolerance_mode """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "filterOnly(brand)", - ], + "typoTolerance": True, }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"attributesForFaceting":["filterOnly(brand)"]}""" - ) + assert loads(_req.data) == loads("""{"typoTolerance":true}""") - def test_set_settings_21(self): + def test_set_settings_89(self): """ - mode neuralSearch + disable_typos_on_numeric_tokens_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "mode": "neuralSearch", + "allowTyposOnNumericTokens": False, }, ) @@ -10458,16 +17239,19 @@ def test_set_settings_21(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"mode":"neuralSearch"}""") + assert loads(_req.data) == loads("""{"allowTyposOnNumericTokens":false}""") - def test_set_settings_22(self): + def test_set_settings_90(self): """ - mode keywordSearch + disable_typo_tolerance_for_words """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "mode": "keywordSearch", + "disableTypoToleranceOnWords": [ + "wheel", + "1X2BCD", + ], }, ) @@ -10475,19 +17259,18 @@ def test_set_settings_22(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"mode":"keywordSearch"}""") + assert loads(_req.data) == loads( + """{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}""" + ) - def test_set_settings_23(self): + def test_set_settings_91(self): """ - searchableAttributes same priority + set_separators_to_index """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "title,comments", - "ingredients", - ], + "separatorsToIndex": "+#", }, ) @@ -10495,21 +17278,19 @@ def test_set_settings_23(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"searchableAttributes":["title,comments","ingredients"]}""" - ) + assert loads(_req.data) == loads("""{"separatorsToIndex":"+#"}""") - def test_set_settings_24(self): + def test_set_settings_92(self): """ - searchableAttributes higher priority + set_languages_using_querylanguages """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "title", - "ingredients", + "queryLanguages": [ + "es", ], + "ignorePlurals": True, }, ) @@ -10518,19 +17299,22 @@ def test_set_settings_24(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["title","ingredients"]}""" + """{"queryLanguages":["es"],"ignorePlurals":true}""" ) - def test_set_settings_25(self): + def test_set_settings_93(self): """ - customRanking retweets + set_attributes_to_transliterate """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(retweets)", - "desc(likes)", + "indexLanguages": [ + "ja", + ], + "attributesToTransliterate": [ + "name", + "description", ], }, ) @@ -10540,19 +17324,20 @@ def test_set_settings_25(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"customRanking":["desc(retweets)","desc(likes)"]}""" + """{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}""" ) - def test_set_settings_26(self): + def test_set_settings_94(self): """ - customRanking boosted + set_languages_using_querylanguages """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(boosted)", + "queryLanguages": [ + "es", ], + "removeStopWords": True, }, ) @@ -10560,18 +17345,19 @@ def test_set_settings_26(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"customRanking":["desc(boosted)"]}""") + assert loads(_req.data) == loads( + """{"queryLanguages":["es"],"removeStopWords":true}""" + ) - def test_set_settings_27(self): + def test_set_settings_95(self): """ - customRanking pageviews + set_camel_case_attributes """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(pageviews)", - "desc(comments)", + "camelCaseAttributes": [ + "description", ], }, ) @@ -10580,23 +17366,20 @@ def test_set_settings_27(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["desc(pageviews)","desc(comments)"]}""" - ) + assert loads(_req.data) == loads("""{"camelCaseAttributes":["description"]}""") - def test_set_settings_28(self): + def test_set_settings_96(self): """ - customRanking applying search parameters for a specific query + set_decompounded_attributes """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(nb_airline_liaisons)", - ], - "attributesForFaceting": [ - "city, country", - ], + "decompoundedAttributes": { + "de": [ + "name", + ], + }, }, ) @@ -10605,20 +17388,26 @@ def test_set_settings_28(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""" + """{"decompoundedAttributes":{"de":["name"]}}""" ) - def test_set_settings_29(self): + def test_set_settings_97(self): """ - customRanking rounded pageviews + set_decompounded_multiple_attributes """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(rounded_pageviews)", - "desc(comments)", - ], + "decompoundedAttributes": { + "de": [ + "name_de", + "description_de", + ], + "fi": [ + "name_fi", + "description_fi", + ], + }, }, ) @@ -10627,19 +17416,17 @@ def test_set_settings_29(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""" + """{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}""" ) - def test_set_settings_30(self): + def test_set_settings_98(self): """ - customRanking price + set_keep_diacritics_on_characters """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(price)", - ], + "keepDiacriticsOnCharacters": "øé", }, ) @@ -10647,26 +17434,20 @@ def test_set_settings_30(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"customRanking":["desc(price)"]}""") + assert loads(_req.data) == loads("""{"keepDiacriticsOnCharacters":"øé"}""") - def test_set_settings_31(self): + def test_set_settings_99(self): """ - ranking exhaustive + set_custom_normalization """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "ranking": [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + "customNormalization": { + "default": { + "ä": "ae", + }, + }, }, ) @@ -10675,19 +17456,21 @@ def test_set_settings_31(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + """{"customNormalization":{"default":{"ä":"ae"}}}""" ) - def test_set_settings_32(self): + def test_set_settings_100(self): """ - ranking standard replica + set_languages_using_querylanguages """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "ranking": [ - "desc(post_date_timestamp)", + "queryLanguages": [ + "es", ], + "removeStopWords": True, + "ignorePlurals": True, }, ) @@ -10696,18 +17479,18 @@ def test_set_settings_32(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"ranking":["desc(post_date_timestamp)"]}""" + """{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}""" ) - def test_set_settings_33(self): + def test_set_settings_101(self): """ - ranking virtual replica + set_indexlanguages """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "desc(post_date_timestamp)", + "indexLanguages": [ + "ja", ], }, ) @@ -10716,30 +17499,16 @@ def test_set_settings_33(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["desc(post_date_timestamp)"]}""" - ) + assert loads(_req.data) == loads("""{"indexLanguages":["ja"]}""") - def test_set_settings_34(self): + def test_set_settings_102(self): """ - customRanking and ranking sort alphabetically + enable_decompound_query_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "ranking": [ - "custom", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - ], + "decompoundQuery": True, }, ) @@ -10747,21 +17516,16 @@ def test_set_settings_34(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" - ) + assert loads(_req.data) == loads("""{"decompoundQuery":true}""") - def test_set_settings_35(self): + def test_set_settings_103(self): """ - relevancyStrictness + enable_rules_syntax_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "customRanking": [ - "asc(textual_attribute)", - ], - "relevancyStrictness": 0, + "enableRules": True, }, ) @@ -10769,20 +17533,16 @@ def test_set_settings_35(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""" - ) + assert loads(_req.data) == loads("""{"enableRules":true}""") - def test_set_settings_36(self): + def test_set_settings_104(self): """ - create replica index + enable_personalization_settings """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "replicas": [ - "products_price_desc", - ], + "enablePersonalization": True, }, ) @@ -10790,18 +17550,16 @@ def test_set_settings_36(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"replicas":["products_price_desc"]}""") + assert loads(_req.data) == loads("""{"enablePersonalization":true}""") - def test_set_settings_37(self): + def test_set_settings_105(self): """ - create virtual replica index + set_default_query_type """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "replicas": [ - "virtual(products_price_desc)", - ], + "queryType": "prefixLast", }, ) @@ -10809,20 +17567,16 @@ def test_set_settings_37(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"replicas":["virtual(products_price_desc)"]}""" - ) + assert loads(_req.data) == loads("""{"queryType":"prefixLast"}""") - def test_set_settings_38(self): + def test_set_settings_106(self): """ - unlink replica index + set_default_remove_words_if_no_result """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "replicas": [ - "", - ], + "removeWordsIfNoResults": "none", }, ) @@ -10830,39 +17584,36 @@ def test_set_settings_38(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"replicas":[""]}""") + assert loads(_req.data) == loads("""{"removeWordsIfNoResults":"none"}""") - def test_set_settings_39(self): + def test_set_settings_107(self): """ - forwardToReplicas + enable_advanced_syntax_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "name", - "description", - ], + "advancedSyntax": True, }, - forward_to_replicas=True, ) assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" - assert _req.query_parameters.items() == {"forwardToReplicas": "true"}.items() + assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"searchableAttributes":["name","description"]}""" - ) + assert loads(_req.data) == loads("""{"advancedSyntax":true}""") - def test_set_settings_40(self): + def test_set_settings_108(self): """ - maxValuesPerFacet + set_default_optional_words """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "maxValuesPerFacet": 1000, + "optionalWords": [ + "blue", + "iphone case", + ], }, ) @@ -10870,16 +17621,18 @@ def test_set_settings_40(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"maxValuesPerFacet":1000}""") + assert loads(_req.data) == loads("""{"optionalWords":["blue","iphone case"]}""") - def test_set_settings_41(self): + def test_set_settings_109(self): """ - maxFacetHits + disabling_prefix_search_for_some_attributes_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "maxFacetHits": 1000, + "disablePrefixOnAttributes": [ + "sku", + ], }, ) @@ -10887,49 +17640,37 @@ def test_set_settings_41(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads("""{"maxFacetHits":1000}""") + assert loads(_req.data) == loads("""{"disablePrefixOnAttributes":["sku"]}""") - def test_set_settings_42(self): + def test_set_settings_110(self): """ - attributesForFaceting complex + disabling_exact_for_some_attributes_by_default """ _req = self._client.set_settings_with_http_info( - index_name="", + index_name="theIndexName", index_settings={ - "attributesForFaceting": [ - "actor", - "filterOnly(category)", - "searchable(publisher)", + "disableExactOnAttributes": [ + "description", ], }, ) - assert _req.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""" + """{"disableExactOnAttributes":["description"]}""" ) - def test_set_settings_43(self): + def test_set_settings_111(self): """ - ranking closest dates + set_default_exact_single_word_query """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "ranking": [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ], + "exactOnSingleWordQuery": "attribute", }, ) @@ -10937,21 +17678,18 @@ def test_set_settings_43(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" - ) + assert loads(_req.data) == loads("""{"exactOnSingleWordQuery":"attribute"}""") - def test_set_settings_44(self): + def test_set_settings_112(self): """ - searchableAttributes item variation + set_default_aternative_as_exact """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "design", - "type", - "color", + "alternativesAsExact": [ + "ignorePlurals", + "singleWordSynonym", ], }, ) @@ -10961,25 +17699,17 @@ def test_set_settings_44(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["design","type","color"]}""" + """{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}""" ) - def test_set_settings_45(self): + def test_set_settings_113(self): """ - searchableAttributes around location + enable_advanced_syntax_by_default """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", - ], - "customRanking": [ - "desc(links_count)", - ], + "advancedSyntax": True, }, ) @@ -10987,25 +17717,18 @@ def test_set_settings_45(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" - ) + assert loads(_req.data) == loads("""{"advancedSyntax":true}""") - def test_set_settings_46(self): + def test_set_settings_114(self): """ - searchableAttributes around location + set_numeric_attributes_for_filtering """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "name", - "country", - "code", - "iata_code", - ], - "customRanking": [ - "desc(links_count)", + "numericAttributesForFiltering": [ + "quantity", + "popularity", ], }, ) @@ -11015,19 +17738,17 @@ def test_set_settings_46(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""" + """{"numericAttributesForFiltering":["quantity","popularity"]}""" ) - def test_set_settings_47(self): + def test_set_settings_115(self): """ - disableTypoToleranceOnAttributes + enable_compression_of_integer_array """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", - ], + "allowCompressionOfIntegerArray": True, }, ) @@ -11035,151 +17756,16 @@ def test_set_settings_47(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"disableTypoToleranceOnAttributes":["serial_number"]}""" - ) + assert loads(_req.data) == loads("""{"allowCompressionOfIntegerArray":true}""") - def test_set_settings_48(self): + def test_set_settings_116(self): """ - everything + set_attributes_for_distinct """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "advancedSyntax": True, - "advancedSyntaxFeatures": [ - "exactPhrase", - ], - "allowCompressionOfIntegerArray": True, - "allowTyposOnNumericTokens": True, - "alternativesAsExact": [ - "singleWordSynonym", - ], - "attributeCriteriaComputedByMinProximity": True, - "attributeForDistinct": "test", - "attributesForFaceting": [ - "algolia", - ], - "attributesToHighlight": [ - "algolia", - ], - "attributesToRetrieve": [ - "algolia", - ], - "attributesToSnippet": [ - "algolia", - ], - "attributesToTransliterate": [ - "algolia", - ], - "camelCaseAttributes": [ - "algolia", - ], - "customNormalization": { - "algolia": { - "aloglia": "aglolia", - }, - }, - "customRanking": [ - "algolia", - ], - "decompoundQuery": False, - "decompoundedAttributes": { - "algolia": "aloglia", - }, - "disableExactOnAttributes": [ - "algolia", - ], - "disablePrefixOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnAttributes": [ - "algolia", - ], - "disableTypoToleranceOnWords": [ - "algolia", - ], - "distinct": 3, - "enablePersonalization": True, - "enableReRanking": False, - "enableRules": True, - "exactOnSingleWordQuery": "attribute", - "highlightPreTag": "", - "highlightPostTag": "", - "hitsPerPage": 10, - "ignorePlurals": False, - "indexLanguages": [ - "fr", - ], - "keepDiacriticsOnCharacters": "abc", - "maxFacetHits": 20, - "maxValuesPerFacet": 30, - "minProximity": 6, - "minWordSizefor1Typo": 5, - "minWordSizefor2Typos": 11, - "mode": "neuralSearch", - "numericAttributesForFiltering": [ - "algolia", - ], - "optionalWords": [ - "myspace", - ], - "paginationLimitedTo": 0, - "queryLanguages": [ - "fr", - ], - "queryType": "prefixLast", - "ranking": [ - "geo", - ], - "reRankingApplyFilter": "mySearch:filters", - "relevancyStrictness": 10, - "removeStopWords": False, - "removeWordsIfNoResults": "lastWords", - "renderingContent": { - "facetOrdering": { - "facets": { - "order": [ - "a", - "b", - ], - }, - "values": { - "a": { - "order": [ - "b", - ], - "sortRemainingBy": "count", - }, - }, - }, - }, - "replaceSynonymsInHighlight": True, - "replicas": [ - "", - ], - "responseFields": [ - "algolia", - ], - "restrictHighlightAndSnippetArrays": True, - "searchableAttributes": [ - "foo", - ], - "semanticSearch": { - "eventSources": [ - "foo", - ], - }, - "separatorsToIndex": "bar", - "snippetEllipsisText": "---", - "sortFacetValuesBy": "date", - "typoTolerance": False, - "unretrievableAttributes": [ - "foo", - ], - "userData": { - "user": "data", - }, + "attributeForDistinct": "url", }, ) @@ -11187,32 +17773,17 @@ def test_set_settings_48(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" - ) + assert loads(_req.data) == loads("""{"attributeForDistinct":"url"}""") - def test_set_settings_49(self): + def test_set_settings_117(self): """ - searchableAttributesWithCustomRankingsAndAttributesForFaceting + set_distinct """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "brand", - "name", - "categories", - "unordered(description)", - ], - "customRanking": [ - "desc(popularity)", - ], - "attributesForFaceting": [ - "searchable(brand)", - "type", - "categories", - "price", - ], + "distinct": 1, + "attributeForDistinct": "url", }, ) @@ -11221,21 +17792,17 @@ def test_set_settings_49(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" + """{"distinct":1,"attributeForDistinct":"url"}""" ) - def test_set_settings_50(self): + def test_set_settings_118(self): """ - searchableAttributesProductReferenceSuffixes + set_replace_synonyms_in_highlights """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "name", - "product_reference", - "product_reference_suffixes", - ], + "replaceSynonymsInHighlight": False, }, ) @@ -11243,21 +17810,16 @@ def test_set_settings_50(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""" - ) + assert loads(_req.data) == loads("""{"replaceSynonymsInHighlight":false}""") - def test_set_settings_51(self): + def test_set_settings_119(self): """ - queryLanguageAndIgnorePlurals + set_min_proximity """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "queryLanguages": [ - "en", - ], - "ignorePlurals": True, + "minProximity": 1, }, ) @@ -11265,43 +17827,40 @@ def test_set_settings_51(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"queryLanguages":["en"],"ignorePlurals":true}""" - ) + assert loads(_req.data) == loads("""{"minProximity":1}""") - def test_set_settings_52(self): + def test_set_settings_120(self): """ - searchableAttributesInMovies + set_default_field """ _req = self._client.set_settings_with_http_info( - index_name="movies", + index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "title_eng", - "title_fr", - "title_es", + "responseFields": [ + "hits", + "hitsPerPage", + "nbPages", + "page", ], }, ) - assert _req.path == "/1/indexes/movies/settings" + assert _req.path == "/1/indexes/theIndexName/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["title_eng","title_fr","title_es"]}""" + """{"responseFields":["hits","hitsPerPage","nbPages","page"]}""" ) - def test_set_settings_53(self): + def test_set_settings_121(self): """ - disablePrefixOnAttributes + set_max_facet_hits """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "disablePrefixOnAttributes": [ - "serial_number", - ], + "maxFacetHits": 10, }, ) @@ -11309,20 +17868,16 @@ def test_set_settings_53(self): assert _req.verb == "PUT" assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() - assert loads(_req.data) == loads( - """{"disablePrefixOnAttributes":["serial_number"]}""" - ) + assert loads(_req.data) == loads("""{"maxFacetHits":10}""") - def test_set_settings_54(self): + def test_set_settings_122(self): """ - disableTypoToleranceOnAttributes + set_attribute_criteria_computed_by_min_proximity """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "disableTypoToleranceOnAttributes": [ - "serial_number", - ], + "attributeCriteriaComputedByMinProximity": True, }, ) @@ -11331,19 +17886,19 @@ def test_set_settings_54(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"disableTypoToleranceOnAttributes":["serial_number"]}""" + """{"attributeCriteriaComputedByMinProximity":true}""" ) - def test_set_settings_55(self): + def test_set_settings_123(self): """ - searchableAttributesSimpleExample + set_user_data """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "serial_number", - ], + "userData": { + "extraData": "This is the custom data that you want to store in your index", + }, }, ) @@ -11352,20 +17907,45 @@ def test_set_settings_55(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["serial_number"]}""" + """{"userData":{"extraData":"This is the custom data that you want to store in your index"}}""" ) - def test_set_settings_56(self): + def test_set_settings_124(self): """ - searchableAttributesSimpleExampleAlt + set_rendering_content """ _req = self._client.set_settings_with_http_info( index_name="theIndexName", index_settings={ - "searchableAttributes": [ - "serial_number", - "serial_number_suffixes", - ], + "renderingContent": { + "facetOrdering": { + "facets": { + "order": [ + "size", + "brand", + ], + }, + "values": { + "brand": { + "order": [ + "uniqlo", + ], + "hide": [ + "muji", + ], + "sortRemainingBy": "count", + }, + "size": { + "order": [ + "S", + "M", + "L", + ], + "sortRemainingBy": "hidden", + }, + }, + }, + }, }, ) @@ -11374,7 +17954,7 @@ def test_set_settings_56(self): assert _req.query_parameters.items() == {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads( - """{"searchableAttributes":["serial_number","serial_number_suffixes"]}""" + """{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}""" ) def test_update_api_key_(self): diff --git a/tests/output/ruby/test/requests/search_test.rb b/tests/output/ruby/test/requests/search_test.rb index 19eb62b8bf..804f6ed1ee 100644 --- a/tests/output/ruby/test/requests/search_test.rb +++ b/tests/output/ruby/test/requests/search_test.rb @@ -2898,8 +2898,76 @@ def test_search_single_index13 ) end - # facetFiltersNeg + # facetFiltersBook def test_search_single_index14 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: ["category:Book"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"facetFilters\":[\"category:Book\"]}"), JSON.parse(req.body)) + end + + # facetFiltersAND + def test_search_single_index15 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: ["category:Book", "author:John Doe"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"facetFilters\":[\"category:Book\",\"author:John Doe\"]}"), + JSON.parse(req.body) + ) + end + + # facetFiltersOR + def test_search_single_index16 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", facet_filters: [["category:Book", "author:John Doe"]]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"facetFilters\":[[\"category:Book\",\"author:John Doe\"]]}"), + JSON.parse(req.body) + ) + end + + # facetFiltersCombined + def test_search_single_index17 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + facet_filters: ["author:John Doe", ["category:Book", "category:Movie"]] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"facetFilters\":[\"author:John Doe\",[\"category:Book\",\"category:Movie\"]]}"), + JSON.parse(req.body) + ) + end + + # facetFiltersNeg + def test_search_single_index18 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(facet_filters: "category:-Ebook") @@ -2913,7 +2981,7 @@ def test_search_single_index14 end # filtersAndFacetFilters - def test_search_single_index15 + def test_search_single_index19 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -2935,7 +3003,7 @@ def test_search_single_index15 end # facet author genre - def test_search_single_index16 + def test_search_single_index20 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(facets: ["author", "genre"]) @@ -2949,7 +3017,7 @@ def test_search_single_index16 end # facet wildcard - def test_search_single_index17 + def test_search_single_index21 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(facets: ["*"]) @@ -2963,7 +3031,7 @@ def test_search_single_index17 end # maxValuesPerFacet - def test_search_single_index18 + def test_search_single_index22 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(max_values_per_facet: 1000) @@ -2977,7 +3045,7 @@ def test_search_single_index18 end # aroundLatLng - def test_search_single_index19 + def test_search_single_index23 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(around_lat_lng: "40.71, -74.01") @@ -2991,7 +3059,7 @@ def test_search_single_index19 end # aroundLatLngViaIP - def test_search_single_index20 + def test_search_single_index24 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(around_lat_lng_via_ip: true) @@ -3005,7 +3073,7 @@ def test_search_single_index20 end # aroundRadius - def test_search_single_index21 + def test_search_single_index25 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(around_lat_lng: "40.71, -74.01", around_radius: 1000000) @@ -3019,7 +3087,7 @@ def test_search_single_index21 end # insideBoundingBox - def test_search_single_index22 + def test_search_single_index26 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -3038,7 +3106,7 @@ def test_search_single_index22 end # insidePolygon - def test_search_single_index23 + def test_search_single_index27 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -3074,7 +3142,7 @@ def test_search_single_index23 end # insidePolygon - def test_search_single_index24 + def test_search_single_index28 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -3110,7 +3178,7 @@ def test_search_single_index24 end # optionalFilters - def test_search_single_index25 + def test_search_single_index29 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(optional_filters: ["can_deliver_quickly:true"]) @@ -3124,7 +3192,7 @@ def test_search_single_index25 end # optionalFiltersMany - def test_search_single_index26 + def test_search_single_index30 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -3143,7 +3211,7 @@ def test_search_single_index26 end # optionalFiltersSimple - def test_search_single_index27 + def test_search_single_index31 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(optional_filters: ["brand:Apple", "type:tablet"]) @@ -3157,7 +3225,7 @@ def test_search_single_index27 end # restrictSearchableAttributes - def test_search_single_index28 + def test_search_single_index32 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(restrict_searchable_attributes: ["title_fr"]) @@ -3171,7 +3239,7 @@ def test_search_single_index28 end # getRankingInfo - def test_search_single_index29 + def test_search_single_index33 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(get_ranking_info: true) @@ -3185,7 +3253,7 @@ def test_search_single_index29 end # clickAnalytics - def test_search_single_index30 + def test_search_single_index34 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(click_analytics: true) @@ -3199,7 +3267,7 @@ def test_search_single_index30 end # clickAnalyticsUserToken - def test_search_single_index31 + def test_search_single_index35 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(click_analytics: true, user_token: "user-1") @@ -3213,7 +3281,7 @@ def test_search_single_index31 end # enablePersonalization - def test_search_single_index32 + def test_search_single_index36 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(enable_personalization: true, user_token: "user-1") @@ -3227,7 +3295,7 @@ def test_search_single_index32 end # userToken - def test_search_single_index33 + def test_search_single_index37 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(user_token: "user-1") @@ -3240,8 +3308,22 @@ def test_search_single_index33 assert_equal(JSON.parse("{\"userToken\":\"user-1\"}"), JSON.parse(req.body)) end + # userToken1234 + def test_search_single_index38 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", user_token: "user-1234") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"userToken\":\"user-1234\"}"), JSON.parse(req.body)) + end + # analyticsTag - def test_search_single_index34 + def test_search_single_index39 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(analytics_tags: ["YOUR_ANALYTICS_TAG"]) @@ -3255,7 +3337,7 @@ def test_search_single_index34 end # facetFiltersUsers - def test_search_single_index35 + def test_search_single_index40 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new(facet_filters: ["user:user42", "user:public"]) @@ -3269,7 +3351,7 @@ def test_search_single_index35 end # buildTheQuery - def test_search_single_index36 + def test_search_single_index41 req = @client.search_single_index_with_http_info( "indexName", Algolia::Search::SearchParamsObject.new( @@ -3291,509 +3373,2926 @@ def test_search_single_index36 ) end - # searchSynonyms with minimal parameters - def test_search_synonyms - req = @client.search_synonyms_with_http_info("indexName") + # attributesToHighlightOverride + def test_search_single_index42 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_highlight: ["title", "content"]) + ) assert_equal(:post, req.method) - assert_equal("/1/indexes/indexName/synonyms/search", req.path) + assert_equal("/1/indexes/indexName/query", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"query\":\"query\",\"attributesToHighlight\":[\"title\",\"content\"]}"), + JSON.parse(req.body) + ) end - # searchSynonyms with all parameters - def test_search_synonyms1 - req = @client.search_synonyms_with_http_info( + # disableTypoToleranceOnAttributes + def test_search_single_index43 + req = @client.search_single_index_with_http_info( "indexName", - Algolia::Search::SearchSynonymsParams.new(query: "myQuery", type: "altcorrection1", page: 10, hits_per_page: 10) + Algolia::Search::SearchParamsObject.new(query: "query", disable_typo_tolerance_on_attributes: ["serial_number"]) ) assert_equal(:post, req.method) - assert_equal("/1/indexes/indexName/synonyms/search", req.path) + assert_equal("/1/indexes/indexName/query", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse("{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}"), + JSON.parse("{\"query\":\"query\",\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body) ) end - # searchUserIds - def test_search_user_ids - req = @client.search_user_ids_with_http_info( - Algolia::Search::SearchUserIdsParams.new( - query: "test", - cluster_name: "theClusterName", - page: 5, - hits_per_page: 10 - ) + # search_a_query + def test_search_single_index44 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "shirt") ) assert_equal(:post, req.method) - assert_equal("/1/clusters/mapping/search", req.path) + assert_equal("/1/indexes/indexName/query", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}"), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"query\":\"shirt\"}"), JSON.parse(req.body)) end - # get setDictionarySettings results with minimal parameters - def test_set_dictionary_settings - req = @client.set_dictionary_settings_with_http_info( - Algolia::Search::DictionarySettingsParams.new( - disable_standard_entries: Algolia::Search::StandardEntries.new(plurals: {fr: false, en: false, ru: true}) - ) - ) + # search_everything + def test_search_single_index45 + req = @client.search_single_index_with_http_info("indexName", Algolia::Search::SearchParamsObject.new(query: "")) - assert_equal(:put, req.method) - assert_equal("/1/dictionaries/*/settings", req.path) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}"), - JSON.parse(req.body) + assert_equal(JSON.parse("{\"query\":\"\"}"), JSON.parse(req.body)) + end + + # api_filtering_range_example + def test_search_single_index46 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "books", filters: "price:10 TO 20") ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"books\",\"filters\":\"price:10 TO 20\"}"), JSON.parse(req.body)) end - # get setDictionarySettings results with all parameters - def test_set_dictionary_settings1 - req = @client.set_dictionary_settings_with_http_info( - Algolia::Search::DictionarySettingsParams.new( - disable_standard_entries: Algolia::Search::StandardEntries.new( - plurals: {fr: false, en: false, ru: true}, - stopwords: {fr: false}, - compounds: {ru: true} - ) + # search_a_query + def test_search_single_index47 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "", + similar_query: "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001" ) ) - assert_equal(:put, req.method) - assert_equal("/1/dictionaries/*/settings", req.path) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( JSON.parse( - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}" + "{\"query\":\"\",\"similarQuery\":\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\"filters\":\"year:1991 TO 2001\"}" ), JSON.parse(req.body) ) end - # minimal parameters - def test_set_settings - req = @client.set_settings_with_http_info( - "cts_e2e_settings", - Algolia::Search::IndexSettings.new(pagination_limited_to: 10), - true + # override_retrievable_attributes + def test_search_single_index48 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_retrieve: ["title", "content"]) ) - assert_equal(:put, req.method) - assert_equal("/1/indexes/cts_e2e_settings/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"paginationLimitedTo\":10}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"query\":\"query\",\"attributesToRetrieve\":[\"title\",\"content\"]}"), + JSON.parse(req.body) + ) end - # boolean typoTolerance - def test_set_settings1 - req = @client.set_settings_with_http_info( - "theIndexName", - Algolia::Search::IndexSettings.new(typo_tolerance: true), - true + # restrict_searchable_attributes + def test_search_single_index49 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", restrict_searchable_attributes: ["title", "author"]) ) - assert_equal(:put, req.method) - assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"typoTolerance\":true}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"query\":\"query\",\"restrictSearchableAttributes\":[\"title\",\"author\"]}"), + JSON.parse(req.body) + ) end - # enum typoTolerance - def test_set_settings2 - req = @client.set_settings_with_http_info( - "theIndexName", - Algolia::Search::IndexSettings.new(typo_tolerance: "min"), - true + # override_default_relevancy + def test_search_single_index50 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", relevancy_strictness: 70) ) - assert_equal(:put, req.method) - assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"typoTolerance\":\"min\"}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"query\":\"query\",\"relevancyStrictness\":70}"), JSON.parse(req.body)) end - # ignorePlurals - def test_set_settings3 - req = @client.set_settings_with_http_info( - "theIndexName", - Algolia::Search::IndexSettings.new(ignore_plurals: true), - true + # apply_filters + def test_search_single_index51 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published" + ) ) - assert_equal(:put, req.method) - assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"ignorePlurals\":true}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"query\":\"query\",\"filters\":\"(category:Book OR category:Ebook) AND _tags:published\"}"), + JSON.parse(req.body) + ) + end + + # apply_all_filters + def test_search_single_index52 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + 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\"" + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"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\\\"\"}" + ), + JSON.parse(req.body) + ) + end + + # escape_spaces + def test_search_single_index53 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "category:\"Books and Comics\"") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"filters\":\"category:\\\"Books and Comics\\\"\"}"), + JSON.parse(req.body) + ) + end + + # escape_keywords + def test_search_single_index54 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "keyword:\"OR\"") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"filters\":\"keyword:\\\"OR\\\"\"}"), JSON.parse(req.body)) + end + + # escape_single_quotes + def test_search_single_index55 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "content:\"It's a wonderful day\"") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"filters\":\"content:\\\"It's a wonderful day\\\"\"}"), + JSON.parse(req.body) + ) + end + + # escape_double_quotes + def test_search_single_index56 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", filters: "content:\"She said \"Hello World\"") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"filters\":\"content:\\\"She said \\\"Hello World\\\"\"}"), + JSON.parse(req.body) + ) + end + + # apply_filters + def test_search_single_index57 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", optional_filters: ["category:Book", "author:John Doe"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:John Doe\"]}"), + JSON.parse(req.body) + ) + end + + # apply_negative_filters + def test_search_single_index58 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", optional_filters: ["category:Book", "author:-John Doe"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:-John Doe\"]}"), + JSON.parse(req.body) + ) + end + + # apply_numeric_filters + def test_search_single_index59 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + numeric_filters: ["price < 1000", ["inStock = 1", "deliveryDate < 1441755506"]] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"query\":\"query\",\"numericFilters\":[\"price < 1000\",[\"inStock = 1\",\"deliveryDate < 1441755506\"]]}" + ), + JSON.parse(req.body) + ) + end + + # apply_tag_filters + def test_search_single_index60 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", tag_filters: ["SciFi", ["Book", "Movie"]]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"tagFilters\":[\"SciFi\",[\"Book\",\"Movie\"]]}"), + JSON.parse(req.body) + ) + end + + # apply_filters + def test_search_single_index61 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", sum_or_filters_scores: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"sumOrFiltersScores\":true}"), JSON.parse(req.body)) + end + + # facets_all + def test_search_single_index62 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", facets: ["*"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"facets\":[\"*\"]}"), JSON.parse(req.body)) + end + + # retrieve_only_some_facets + def test_search_single_index63 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", facets: ["category", "author"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"facets\":[\"category\",\"author\"]}"), JSON.parse(req.body)) + end + + # override_default_max_values_per_facet + def test_search_single_index64 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", max_values_per_facet: 20) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"maxValuesPerFacet\":20}"), JSON.parse(req.body)) + end + + # enable_faceting_after_distinct + def test_search_single_index65 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", faceting_after_distinct: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"facetingAfterDistinct\":true}"), JSON.parse(req.body)) + end + + # sort_facet_values_alphabetically + def test_search_single_index66 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", sort_facet_values_by: "count") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"sortFacetValuesBy\":\"count\"}"), JSON.parse(req.body)) + end + + # override_attributes_to_snippet + def test_search_single_index67 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", attributes_to_snippet: ["title", "content:80"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"attributesToSnippet\":[\"title\",\"content:80\"]}"), + JSON.parse(req.body) + ) + end + + # override_default_highlight_pre_tag + def test_search_single_index68 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", highlight_pre_tag: "") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"highlightPreTag\":\"\"}"), JSON.parse(req.body)) + end + + # override_default_highlight_post_tag + def test_search_single_index69 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", highlight_post_tag: "") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"highlightPostTag\":\"\"}"), JSON.parse(req.body)) + end + + # override_default_snippet_ellipsis_text + def test_search_single_index70 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", snippet_ellipsis_text: "") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"snippetEllipsisText\":\"\"}"), JSON.parse(req.body)) + end + + # enable_restrict_highlight_and_snippet_arrays + def test_search_single_index71 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", restrict_highlight_and_snippet_arrays: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"restrictHighlightAndSnippetArrays\":false}"), JSON.parse(req.body)) + end + + # access_page + def test_search_single_index72 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", page: 0) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"page\":0}"), JSON.parse(req.body)) + end + + # override_default_hits_per_page + def test_search_single_index73 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", hits_per_page: 10) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"hitsPerPage\":10}"), JSON.parse(req.body)) + end + + # get_nth_hit + def test_search_single_index74 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", offset: 4) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"offset\":4}"), JSON.parse(req.body)) + end + + # get_n_results + def test_search_single_index75 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", length: 4) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"length\":4}"), JSON.parse(req.body)) + end + + # override_default_min_word_size_for_one_typo + def test_search_single_index76 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", min_word_sizefor1_typo: 2) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"minWordSizefor1Typo\":2}"), JSON.parse(req.body)) + end + + # override_default_min_word_size_for_two_typos + def test_search_single_index77 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", min_word_sizefor2_typos: 2) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"minWordSizefor2Typos\":2}"), JSON.parse(req.body)) + end + + # override_default_typo_tolerance_mode + def test_search_single_index78 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", typo_tolerance: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"typoTolerance\":false}"), JSON.parse(req.body)) + end + + # disable_typos_on_numeric_tokens_at_search_time + def test_search_single_index79 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", allow_typos_on_numeric_tokens: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"allowTyposOnNumericTokens\":false}"), JSON.parse(req.body)) + end + + # search_around_a_position + def test_search_single_index80 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", around_lat_lng: "40.71, -74.01") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"aroundLatLng\":\"40.71, -74.01\"}"), JSON.parse(req.body)) + end + + # search_around_server_ip + def test_search_single_index81 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", around_lat_lng_via_ip: true), + { + :header_params => JSON.parse( + "{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you would like to search around\"}", + :symbolize_names => true + ) + } + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert( + ({ + :"x-forwarded-for" => "94.228.178.246 // should be replaced with the actual IP you would like to search around" + }.transform_keys(&:to_s).to_a - + req.headers.to_a) + .empty?, + req.headers.to_s + ) + assert_equal(JSON.parse("{\"query\":\"query\",\"aroundLatLngViaIP\":true}"), JSON.parse(req.body)) + end + + # set_around_radius + def test_search_single_index82 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", around_radius: 1000) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"aroundRadius\":1000}"), JSON.parse(req.body)) + end + + # disable_automatic_radius + def test_search_single_index83 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", around_radius: "all") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"aroundRadius\":\"all\"}"), JSON.parse(req.body)) + end + + # set_geo_search_precision + def test_search_single_index84 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", around_precision: 100) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"aroundPrecision\":100}"), JSON.parse(req.body)) + end + + # set_geo_search_precision_non_linear + def test_search_single_index85 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + around_precision: [ + Algolia::Search::Range.new(from: 0, value: 25), + Algolia::Search::Range.new(from: 2000, value: 1000) + ] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"aroundPrecision\":[{\"from\":0,\"value\":25},{\"from\":2000,\"value\":1000}]}"), + JSON.parse(req.body) + ) + end + + # set_minimum_geo_search_radius + def test_search_single_index86 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", minimum_around_radius: 1000) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"minimumAroundRadius\":1000}"), JSON.parse(req.body)) + end + + # search_inside_rectangular_area + def test_search_single_index87 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_bounding_box: [[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}" + ), + JSON.parse(req.body) + ) + end + + # search_inside_multiple_rectangular_areas + def test_search_single_index88 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_bounding_box: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875] + ] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}" + ), + JSON.parse(req.body) + ) + end + + # search_inside_polygon_area + def test_search_single_index89 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_polygon: [ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625] + ] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"query\":\"query\",\"insidePolygon\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}" + ), + JSON.parse(req.body) + ) + end + + # search_inside_multiple_polygon_areas + def test_search_single_index90 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + inside_polygon: [ + [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 + ] + ] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"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]]}" + ), + JSON.parse(req.body) + ) + end + + # set_querylanguages_override + def test_search_single_index91 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", ignore_plurals: ["ca", "es"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"ignorePlurals\":[\"ca\",\"es\"]}"), JSON.parse(req.body)) + end + + # set_querylanguages_override + def test_search_single_index92 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", remove_stop_words: ["ca", "es"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}"), JSON.parse(req.body)) + end + + # set_querylanguages_override + def test_search_single_index93 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", remove_stop_words: ["ca", "es"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}"), JSON.parse(req.body)) + end + + # set_querylanguages_with_japanese_query + def test_search_single_index94 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", query_languages: ["ja", "en"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"queryLanguages\":[\"ja\",\"en\"]}"), JSON.parse(req.body)) + end + + # set_natural_languages + def test_search_single_index95 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "", natural_languages: ["fr"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"\",\"naturalLanguages\":[\"fr\"]}"), JSON.parse(req.body)) + end + + # override_natural_languages_with_query + def test_search_single_index96 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "", + natural_languages: ["fr"], + remove_words_if_no_results: "firstWords" + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"\",\"naturalLanguages\":[\"fr\"],\"removeWordsIfNoResults\":\"firstWords\"}"), + JSON.parse(req.body) + ) + end + + # enable_decompound_query_search_time + def test_search_single_index97 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", decompound_query: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"decompoundQuery\":true}"), JSON.parse(req.body)) + end + + # enable_rules_search_time + def test_search_single_index98 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_rules: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"enableRules\":true}"), JSON.parse(req.body)) + end + + # set_rule_contexts + def test_search_single_index99 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", rule_contexts: ["front_end", "website2"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"ruleContexts\":[\"front_end\",\"website2\"]}"), + JSON.parse(req.body) + ) + end + + # enable_personalization + def test_search_single_index100 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"enablePersonalization\":true}"), JSON.parse(req.body)) + end + + # enable_personalization_with_user_token + def test_search_single_index101 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true, user_token: "123456") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}"), + JSON.parse(req.body) + ) + end + + # personalization_impact + def test_search_single_index102 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", personalization_impact: 20) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"personalizationImpact\":20}"), JSON.parse(req.body)) + end + + # set_user_token + def test_search_single_index103 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", user_token: "123456") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"userToken\":\"123456\"}"), JSON.parse(req.body)) + end + + # set_user_token_with_personalization + def test_search_single_index104 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_personalization: true, user_token: "123456") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}"), + JSON.parse(req.body) + ) + end + + # override_default_query_type + def test_search_single_index105 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", query_type: "prefixAll") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"queryType\":\"prefixAll\"}"), JSON.parse(req.body)) + end + + # override_default_remove_words_if_no_results + def test_search_single_index106 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", remove_words_if_no_results: "lastWords") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"removeWordsIfNoResults\":\"lastWords\"}"), JSON.parse(req.body)) + end + + # enable_advanced_syntax_search_time + def test_search_single_index107 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", advanced_syntax: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"advancedSyntax\":true}"), JSON.parse(req.body)) + end + + # overide_default_optional_words + def test_search_single_index108 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", optional_words: ["toyota", "2020 2021"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"optionalWords\":[\"toyota\",\"2020 2021\"]}"), JSON.parse(req.body)) + end + + # disabling_exact_for_some_attributes_search_time + def test_search_single_index109 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", disable_exact_on_attributes: ["description"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"disableExactOnAttributes\":[\"description\"]}"), + JSON.parse(req.body) + ) + end + + # override_default_exact_single_word_query + def test_search_single_index110 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", exact_on_single_word_query: "none") + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"exactOnSingleWordQuery\":\"none\"}"), JSON.parse(req.body)) + end + + # override_default_aternative_as_exact + def test_search_single_index111 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", alternatives_as_exact: ["multiWordsSynonym"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"alternativesAsExact\":[\"multiWordsSynonym\"]}"), + JSON.parse(req.body) + ) + end + + # enable_advanced_syntax_exact_phrase + def test_search_single_index112 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + advanced_syntax: true, + advanced_syntax_features: ["exactPhrase"] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"]}"), + JSON.parse(req.body) + ) + end + + # enable_advanced_syntax_exclude_words + def test_search_single_index113 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new( + query: "query", + advanced_syntax: true, + advanced_syntax_features: ["excludeWords"] + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"excludeWords\"]}"), + JSON.parse(req.body) + ) + end + + # override_distinct + def test_search_single_index114 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", distinct: 0) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"distinct\":0}"), JSON.parse(req.body)) + end + + # get_ranking_info + def test_search_single_index115 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", get_ranking_info: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"getRankingInfo\":true}"), JSON.parse(req.body)) + end + + # disable_click_analytics + def test_search_single_index116 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", click_analytics: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"clickAnalytics\":false}"), JSON.parse(req.body)) + end + + # enable_click_analytics + def test_search_single_index117 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", click_analytics: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"clickAnalytics\":true}"), JSON.parse(req.body)) + end + + # disable_analytics + def test_search_single_index118 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", analytics: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"analytics\":false}"), JSON.parse(req.body)) + end + + # add_analytics_tags + def test_search_single_index119 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", analytics_tags: ["front_end", "website2"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"query\",\"analyticsTags\":[\"front_end\",\"website2\"]}"), + JSON.parse(req.body) + ) + end + + # disable_synonyms + def test_search_single_index120 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", synonyms: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"synonyms\":false}"), JSON.parse(req.body)) + end + + # override_replace_synonyms_in_highlights + def test_search_single_index121 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", replace_synonyms_in_highlight: true) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"replaceSynonymsInHighlight\":true}"), JSON.parse(req.body)) + end + + # override_min_proximity + def test_search_single_index122 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", min_proximity: 2) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"minProximity\":2}"), JSON.parse(req.body)) + end + + # override_default_field + def test_search_single_index123 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", response_fields: ["hits", "facets"]) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"responseFields\":[\"hits\",\"facets\"]}"), JSON.parse(req.body)) + end + + # override_percentile_computation + def test_search_single_index124 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", percentile_computation: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"percentileComputation\":false}"), JSON.parse(req.body)) + end + + # set_ab_test + def test_search_single_index125 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_ab_test: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"enableABTest\":false}"), JSON.parse(req.body)) + end + + # set_enable_re_ranking + def test_search_single_index126 + req = @client.search_single_index_with_http_info( + "indexName", + Algolia::Search::SearchParamsObject.new(query: "query", enable_re_ranking: false) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/query", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"query\":\"query\",\"enableReRanking\":false}"), JSON.parse(req.body)) + end + + # searchSynonyms with minimal parameters + def test_search_synonyms + req = @client.search_synonyms_with_http_info("indexName") + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/synonyms/search", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{}"), JSON.parse(req.body)) + end + + # searchSynonyms with all parameters + def test_search_synonyms1 + req = @client.search_synonyms_with_http_info( + "indexName", + Algolia::Search::SearchSynonymsParams.new(query: "myQuery", type: "altcorrection1", page: 10, hits_per_page: 10) + ) + + assert_equal(:post, req.method) + assert_equal("/1/indexes/indexName/synonyms/search", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}"), + JSON.parse(req.body) + ) + end + + # searchUserIds + def test_search_user_ids + req = @client.search_user_ids_with_http_info( + Algolia::Search::SearchUserIdsParams.new( + query: "test", + cluster_name: "theClusterName", + page: 5, + hits_per_page: 10 + ) + ) + + assert_equal(:post, req.method) + assert_equal("/1/clusters/mapping/search", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}"), + JSON.parse(req.body) + ) + end + + # get setDictionarySettings results with minimal parameters + def test_set_dictionary_settings + req = @client.set_dictionary_settings_with_http_info( + Algolia::Search::DictionarySettingsParams.new( + disable_standard_entries: Algolia::Search::StandardEntries.new(plurals: {fr: false, en: false, ru: true}) + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/dictionaries/*/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}"), + JSON.parse(req.body) + ) + end + + # get setDictionarySettings results with all parameters + def test_set_dictionary_settings1 + req = @client.set_dictionary_settings_with_http_info( + Algolia::Search::DictionarySettingsParams.new( + disable_standard_entries: Algolia::Search::StandardEntries.new( + plurals: {fr: false, en: false, ru: true}, + stopwords: {fr: false}, + compounds: {ru: true} + ) + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/dictionaries/*/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}" + ), + JSON.parse(req.body) + ) + end + + # minimal parameters + def test_set_settings + req = @client.set_settings_with_http_info( + "cts_e2e_settings", + Algolia::Search::IndexSettings.new(pagination_limited_to: 10), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/cts_e2e_settings/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"paginationLimitedTo\":10}"), JSON.parse(req.body)) + end + + # boolean typoTolerance + def test_set_settings1 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(typo_tolerance: true), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"typoTolerance\":true}"), JSON.parse(req.body)) + end + + # enum typoTolerance + def test_set_settings2 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(typo_tolerance: "min"), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"typoTolerance\":\"min\"}"), JSON.parse(req.body)) + end + + # ignorePlurals + def test_set_settings3 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(ignore_plurals: true), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"ignorePlurals\":true}"), JSON.parse(req.body)) end # list of string ignorePlurals def test_set_settings4 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(ignore_plurals: ["fr"]), - true + Algolia::Search::IndexSettings.new(ignore_plurals: ["fr"]), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"ignorePlurals\":[\"fr\"]}"), JSON.parse(req.body)) + end + + # removeStopWords boolean + def test_set_settings5 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(remove_stop_words: true), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"removeStopWords\":true}"), JSON.parse(req.body)) + end + + # removeStopWords list of string + def test_set_settings6 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(remove_stop_words: ["fr"]), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"removeStopWords\":[\"fr\"]}"), JSON.parse(req.body)) + end + + # boolean distinct + def test_set_settings7 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: true), true) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"distinct\":true}"), JSON.parse(req.body)) + end + + # integer distinct + def test_set_settings8 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: 1), true) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"distinct\":1}"), JSON.parse(req.body)) + end + + # distinct company + def test_set_settings9 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "company", distinct: true) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributeForDistinct\":\"company\",\"distinct\":true}"), JSON.parse(req.body)) + end + + # distinct design + def test_set_settings10 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "design", distinct: true) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributeForDistinct\":\"design\",\"distinct\":true}"), JSON.parse(req.body)) + end + + # distinct true + def test_set_settings11 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: true)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"distinct\":true}"), JSON.parse(req.body)) + end + + # distinct section + def test_set_settings12 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attribute_for_distinct: "section", distinct: true) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributeForDistinct\":\"section\",\"distinct\":true}"), JSON.parse(req.body)) + end + + # attributesForFaceting allergens + def test_set_settings13 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["allergens"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"allergens\"]}"), JSON.parse(req.body)) + end + + # api_attributes_for_faceting + def test_set_settings14 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["genre", "author"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"genre\",\"author\"]}"), JSON.parse(req.body)) + end + + # api_attributes_for_faceting_searchable + def test_set_settings15 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["genre", "searchable(author)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"genre\",\"searchable(author)\"]}"), JSON.parse(req.body)) + end + + # api_attributes_for_filter_only + def test_set_settings16 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(genre)", "author"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"filterOnly(genre)\",\"author\"]}"), JSON.parse(req.body)) + end + + # attributesForFaceting categoryPageId + def test_set_settings17 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["searchable(categoryPageId)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}"), JSON.parse(req.body)) + end + + # unretrievableAttributes + def test_set_settings18 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(unretrievable_attributes: ["visible_by"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"unretrievableAttributes\":[\"visible_by\"]}"), JSON.parse(req.body)) + end + + # attributesForFaceting user restricted data + def test_set_settings19 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(visible_by)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}"), JSON.parse(req.body)) + end + + # attributesForFaceting optional filters + def test_set_settings20 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["can_deliver_quickly", "restaurant"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}"), + JSON.parse(req.body) + ) + end + + # attributesForFaceting redirect index + def test_set_settings21 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["query_terms"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"query_terms\"]}"), JSON.parse(req.body)) + end + + # attributesForFaceting multiple consequences + def test_set_settings22 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["director"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"director\"]}"), JSON.parse(req.body)) + end + + # attributesForFaceting in-depth optional filters + def test_set_settings23 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(brand)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesForFaceting\":[\"filterOnly(brand)\"]}"), JSON.parse(req.body)) + end + + # mode neuralSearch + def test_set_settings24 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"mode\":\"neuralSearch\"}"), JSON.parse(req.body)) + end + + # mode keywordSearch + def test_set_settings25 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"mode\":\"keywordSearch\"}"), JSON.parse(req.body)) + end + + # searchableAttributes same priority + def test_set_settings26 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title,comments", "ingredients"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}"), JSON.parse(req.body)) + end + + # searchableAttributes higher priority + def test_set_settings27 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title", "ingredients"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"title\",\"ingredients\"]}"), JSON.parse(req.body)) + end + + # customRanking retweets + def test_set_settings28 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(retweets)", "desc(likes)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}"), JSON.parse(req.body)) + end + + # customRanking boosted + def test_set_settings29 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(boosted)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(boosted)\"]}"), JSON.parse(req.body)) + end + + # customRanking pageviews + def test_set_settings30 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(pageviews)", "desc(comments)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}"), JSON.parse(req.body)) + end + + # customRanking applying search parameters for a specific query + def test_set_settings31 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + custom_ranking: ["desc(nb_airline_liaisons)"], + attributes_for_faceting: ["city, country"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}"), + JSON.parse(req.body) + ) + end + + # customRanking rounded pageviews + def test_set_settings32 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(rounded_pageviews)", "desc(comments)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}"), + JSON.parse(req.body) + ) + end + + # customRanking price + def test_set_settings33 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(price)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(price)\"]}"), JSON.parse(req.body)) + end + + # ranking exhaustive + def test_set_settings34 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + ), + JSON.parse(req.body) + ) + end + + # ranking standard replica + def test_set_settings35 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(ranking: ["desc(post_date_timestamp)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"ranking\":[\"desc(post_date_timestamp)\"]}"), JSON.parse(req.body)) + end + + # ranking virtual replica + def test_set_settings36 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(post_date_timestamp)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(post_date_timestamp)\"]}"), JSON.parse(req.body)) + end + + # customRanking and ranking sort alphabetically + def test_set_settings37 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + custom_ranking: ["asc(textual_attribute)"], + ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}" + ), + JSON.parse(req.body) + ) + end + + # relevancyStrictness + def test_set_settings38 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(custom_ranking: ["asc(textual_attribute)"], relevancy_strictness: 0) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}"), + JSON.parse(req.body) + ) + end + + # create replica index + def test_set_settings39 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(replicas: ["products_price_desc"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"replicas\":[\"products_price_desc\"]}"), JSON.parse(req.body)) + end + + # create replica index articles + def test_set_settings40 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(replicas: ["articles_date_desc"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"replicas\":[\"articles_date_desc\"]}"), JSON.parse(req.body)) + end + + # create virtual replica index + def test_set_settings41 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(replicas: ["virtual(products_price_desc)"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"replicas\":[\"virtual(products_price_desc)\"]}"), JSON.parse(req.body)) + end + + # unlink replica index + def test_set_settings42 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(replicas: [""])) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"replicas\":[\"\"]}"), JSON.parse(req.body)) + end + + # forwardToReplicas + def test_set_settings43 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["name", "description"]), + true + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"name\",\"description\"]}"), JSON.parse(req.body)) + end + + # maxValuesPerFacet + def test_set_settings44 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(max_values_per_facet: 1000) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"maxValuesPerFacet\":1000}"), JSON.parse(req.body)) + end + + # maxFacetHits + def test_set_settings45 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(max_facet_hits: 1000)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"maxFacetHits\":1000}"), JSON.parse(req.body)) + end + + # attributesForFaceting complex + def test_set_settings46 + req = @client.set_settings_with_http_info( + "", + Algolia::Search::IndexSettings.new( + attributes_for_faceting: ["actor", "filterOnly(category)", "searchable(publisher)"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}"), + JSON.parse(req.body) + ) + end + + # ranking closest dates + def test_set_settings47 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + ranking: ["asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + ), + JSON.parse(req.body) + ) + end + + # searchableAttributes item variation + def test_set_settings48 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["design", "type", "color"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}"), JSON.parse(req.body)) + end + + # searchableAttributes around location + def test_set_settings49 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["name", "country", "code", "iata_code"], + custom_ranking: ["desc(links_count)"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" + ), + JSON.parse(req.body) + ) + end + + # attributesToHighlight + def test_set_settings50 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attributes_to_highlight: ["author", "title", "content"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesToHighlight\":[\"author\",\"title\",\"content\"]}"), JSON.parse(req.body)) + end + + # attributesToHighlightStar + def test_set_settings51 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attributes_to_highlight: ["*"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesToHighlight\":[\"*\"]}"), JSON.parse(req.body)) + end + + # everything + def test_set_settings52 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + advanced_syntax: true, + advanced_syntax_features: ["exactPhrase"], + allow_compression_of_integer_array: true, + allow_typos_on_numeric_tokens: true, + alternatives_as_exact: ["singleWordSynonym"], + attribute_criteria_computed_by_min_proximity: true, + attribute_for_distinct: "test", + attributes_for_faceting: ["algolia"], + attributes_to_highlight: ["algolia"], + attributes_to_retrieve: ["algolia"], + attributes_to_snippet: ["algolia"], + attributes_to_transliterate: ["algolia"], + camel_case_attributes: ["algolia"], + custom_normalization: {algolia: {aloglia: "aglolia"}}, + custom_ranking: ["algolia"], + decompound_query: false, + decompounded_attributes: {algolia: "aloglia"}, + disable_exact_on_attributes: ["algolia"], + disable_prefix_on_attributes: ["algolia"], + disable_typo_tolerance_on_attributes: ["algolia"], + disable_typo_tolerance_on_words: ["algolia"], + distinct: 3, + enable_personalization: true, + enable_re_ranking: false, + enable_rules: true, + exact_on_single_word_query: "attribute", + highlight_pre_tag: "", + highlight_post_tag: "", + hits_per_page: 10, + ignore_plurals: false, + index_languages: ["fr"], + keep_diacritics_on_characters: "abc", + max_facet_hits: 20, + max_values_per_facet: 30, + min_proximity: 6, + min_word_sizefor1_typo: 5, + min_word_sizefor2_typos: 11, + mode: "neuralSearch", + numeric_attributes_for_filtering: ["algolia"], + optional_words: ["myspace"], + pagination_limited_to: 0, + query_languages: ["fr"], + query_type: "prefixLast", + ranking: ["geo"], + re_ranking_apply_filter: "mySearch:filters", + relevancy_strictness: 10, + remove_stop_words: false, + remove_words_if_no_results: "lastWords", + rendering_content: Algolia::Search::RenderingContent.new( + facet_ordering: Algolia::Search::FacetOrdering.new( + facets: Algolia::Search::Facets.new(order: ["a", "b"]), + values: {a: Algolia::Search::Value.new(order: ["b"], sort_remaining_by: "count")} + ) + ), + replace_synonyms_in_highlight: true, + replicas: [""], + response_fields: ["algolia"], + restrict_highlight_and_snippet_arrays: true, + searchable_attributes: ["foo"], + semantic_search: Algolia::Search::SemanticSearch.new(event_sources: ["foo"]), + separators_to_index: "bar", + snippet_ellipsis_text: "---", + sort_facet_values_by: "date", + typo_tolerance: false, + unretrievable_attributes: ["foo"], + user_data: {user: "data"} + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}" + ), + JSON.parse(req.body) + ) + end + + # searchableAttributesWithCustomRankingsAndAttributesForFaceting + def test_set_settings53 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["brand", "name", "categories", "unordered(description)"], + custom_ranking: ["desc(popularity)"], + attributes_for_faceting: ["searchable(brand)", "type", "categories", "price"] + ) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}" + ), + JSON.parse(req.body) + ) + end + + # searchableAttributesOrdering + def test_set_settings54 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["unordered(title)", "cast"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"unordered(title)\",\"cast\"]}"), JSON.parse(req.body)) + end + + # searchableAttributesProductReferenceSuffixes + def test_set_settings55 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["name", "product_reference", "product_reference_suffixes"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}"), + JSON.parse(req.body) + ) + end + + # queryLanguageAndIgnorePlurals + def test_set_settings56 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(query_languages: ["en"], ignore_plurals: true) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}"), JSON.parse(req.body)) + end + + # searchableAttributesInMovies + def test_set_settings57 + req = @client.set_settings_with_http_info( + "movies", + Algolia::Search::IndexSettings.new(searchable_attributes: ["title_eng", "title_fr", "title_es"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/movies/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}"), + JSON.parse(req.body) + ) + end + + # disablePrefixOnAttributes + def test_set_settings58 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["serial_number"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"disablePrefixOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + end + + # disableTypoToleranceOnAttributes + def test_set_settings59 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + end + + # searchableAttributesSimpleExample + def test_set_settings60 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"searchableAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + end + + # searchableAttributesSimpleExampleAlt + def test_set_settings61 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number", "serial_number_suffixes"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse("{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}"), + JSON.parse(req.body) + ) + end + + # set_searchable_attributes + def test_set_settings62 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + searchable_attributes: ["title,alternative_title", "author", "unordered(text)", "emails.personal"] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"searchableAttributes\":[\"title,alternative_title\",\"author\",\"unordered(text)\",\"emails.personal\"]}" + ), + JSON.parse(req.body) + ) + end + + # set_searchable_attributes + def test_set_settings63 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + attributes_for_faceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ] + ) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal( + JSON.parse( + "{\"attributesForFaceting\":[\"author\",\"filterOnly(isbn)\",\"searchable(edition)\",\"afterDistinct(category)\",\"afterDistinct(searchable(publisher))\"]}" + ), + JSON.parse(req.body) + ) + end + + # unretrievable_attributes + def test_set_settings64 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(unretrievable_attributes: ["total_number_of_sales"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"unretrievableAttributes\":[\"total_number_of_sales\"]}"), JSON.parse(req.body)) + end + + # set_retrievable_attributes + def test_set_settings65 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["author", "title", "content"]) + ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"ignorePlurals\":[\"fr\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"attributesToRetrieve\":[\"author\",\"title\",\"content\"]}"), JSON.parse(req.body)) end - # removeStopWords boolean - def test_set_settings5 + # set_all_attributes_as_retrievable + def test_set_settings66 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(remove_stop_words: true), - true + Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["*"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"removeStopWords\":true}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"attributesToRetrieve\":[\"*\"]}"), JSON.parse(req.body)) end - # removeStopWords list of string - def test_set_settings6 + # specify_attributes_not_to_retrieve + def test_set_settings67 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(remove_stop_words: ["fr"]), - true + Algolia::Search::IndexSettings.new(attributes_to_retrieve: ["*", "-SKU", "-internal_desc"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"removeStopWords\":[\"fr\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"attributesToRetrieve\":[\"*\",\"-SKU\",\"-internal_desc\"]}"), JSON.parse(req.body)) end - # boolean distinct - def test_set_settings7 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: true), true) + # neural_search + def test_set_settings68 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"distinct\":true}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"mode\":\"neuralSearch\"}"), JSON.parse(req.body)) end - # integer distinct - def test_set_settings8 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: 1), true) + # keyword_search + def test_set_settings69 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"distinct\":1}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"mode\":\"keywordSearch\"}"), JSON.parse(req.body)) end - # distinct company - def test_set_settings9 + # set_default_ranking + def test_set_settings70 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "company", distinct: true) + Algolia::Search::IndexSettings.new( + ranking: ["typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom"] + ) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributeForDistinct\":\"company\",\"distinct\":true}"), JSON.parse(req.body)) + assert_equal( + JSON.parse( + "{\"ranking\":[\"typo\",\"geo\",\"words\",\"filters\",\"attribute\",\"proximity\",\"exact\",\"custom\"]}" + ), + JSON.parse(req.body) + ) end - # distinct design - def test_set_settings10 + # set_ranking_by_attribute_asc + def test_set_settings71 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "design", distinct: true) + Algolia::Search::IndexSettings.new( + ranking: ["asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributeForDistinct\":\"design\",\"distinct\":true}"), JSON.parse(req.body)) + assert_equal( + JSON.parse( + "{\"ranking\":[\"asc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + ), + JSON.parse(req.body) + ) end - # distinct true - def test_set_settings11 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(distinct: true)) + # set_ranking_by_attribute_desc + def test_set_settings72 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new( + ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] + ) + ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"distinct\":true}"), JSON.parse(req.body)) + assert_equal( + JSON.parse( + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + ), + JSON.parse(req.body) + ) end - # distinct section - def test_set_settings12 + # restrict_searchable_attributes + def test_set_settings73 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(attribute_for_distinct: "section", distinct: true) + Algolia::Search::IndexSettings.new(custom_ranking: ["desc(popularity)", "asc(price)"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributeForDistinct\":\"section\",\"distinct\":true}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"customRanking\":[\"desc(popularity)\",\"asc(price)\"]}"), JSON.parse(req.body)) end - # attributesForFaceting allergens - def test_set_settings13 + # set_default_relevancy + def test_set_settings74 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["allergens"]) + "theIndexName", + Algolia::Search::IndexSettings.new(relevancy_strictness: 90) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"allergens\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"relevancyStrictness\":90}"), JSON.parse(req.body)) end - # attributesForFaceting categoryPageId - def test_set_settings14 + # set_replicas + def test_set_settings75 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["searchable(categoryPageId)"]) + "theIndexName", + Algolia::Search::IndexSettings.new(replicas: ["name_of_replica_index1", "name_of_replica_index2"]) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"replicas\":[\"name_of_replica_index1\",\"name_of_replica_index2\"]}"), + JSON.parse(req.body) + ) end - # unretrievableAttributes - def test_set_settings15 + # set_default_max_values_per_facet + def test_set_settings76 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(unretrievable_attributes: ["visible_by"]) + "theIndexName", + Algolia::Search::IndexSettings.new(max_values_per_facet: 100) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"unretrievableAttributes\":[\"visible_by\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"maxValuesPerFacet\":100}"), JSON.parse(req.body)) end - # attributesForFaceting user restricted data - def test_set_settings16 + # set_default_sort_facet_values_by + def test_set_settings77 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(visible_by)"]) + "theIndexName", + Algolia::Search::IndexSettings.new(sort_facet_values_by: "alpha") ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"sortFacetValuesBy\":\"alpha\"}"), JSON.parse(req.body)) end - # attributesForFaceting optional filters - def test_set_settings17 + # set_attributes_to_snippet + def test_set_settings78 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["can_deliver_quickly", "restaurant"]) + "theIndexName", + Algolia::Search::IndexSettings.new(attributes_to_snippet: ["content:80", "description"]) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}"), - JSON.parse(req.body) + assert_equal(JSON.parse("{\"attributesToSnippet\":[\"content:80\",\"description\"]}"), JSON.parse(req.body)) + end + + # set_all_attributes_to_snippet + def test_set_settings79 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(attributes_to_snippet: ["*:80"]) ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"attributesToSnippet\":[\"*:80\"]}"), JSON.parse(req.body)) end - # attributesForFaceting redirect index - def test_set_settings18 + # set_default_highlight_pre_tag + def test_set_settings80 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["query_terms"]) + "theIndexName", + Algolia::Search::IndexSettings.new(highlight_pre_tag: "") ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"query_terms\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"highlightPreTag\":\"\"}"), JSON.parse(req.body)) end - # attributesForFaceting multiple consequences - def test_set_settings19 + # set_default_highlight_post_tag + def test_set_settings81 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["director"]) + "theIndexName", + Algolia::Search::IndexSettings.new(highlight_post_tag: "") ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"director\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"highlightPostTag\":\"\"}"), JSON.parse(req.body)) end - # attributesForFaceting in-depth optional filters - def test_set_settings20 + # set_default_snippet_ellipsis_text + def test_set_settings82 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new(attributes_for_faceting: ["filterOnly(brand)"]) + "theIndexName", + Algolia::Search::IndexSettings.new(snippet_ellipsis_text: "…") ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"attributesForFaceting\":[\"filterOnly(brand)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"snippetEllipsisText\":\"\u2026\"}"), JSON.parse(req.body)) end - # mode neuralSearch - def test_set_settings21 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "neuralSearch")) + # enable_restrict_highlight_and_snippet_arrays_by_default + def test_set_settings83 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(restrict_highlight_and_snippet_arrays: true) + ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"mode\":\"neuralSearch\"}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"restrictHighlightAndSnippetArrays\":true}"), JSON.parse(req.body)) end - # mode keywordSearch - def test_set_settings22 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(mode: "keywordSearch")) + # set_default_hits_per_page + def test_set_settings84 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(hits_per_page: 20)) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"mode\":\"keywordSearch\"}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"hitsPerPage\":20}"), JSON.parse(req.body)) end - # searchableAttributes same priority - def test_set_settings23 + # set_pagination_limit + def test_set_settings85 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title,comments", "ingredients"]) + Algolia::Search::IndexSettings.new(pagination_limited_to: 1000) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"paginationLimitedTo\":1000}"), JSON.parse(req.body)) end - # searchableAttributes higher priority - def test_set_settings24 + # set_default_min_word_size_for_one_typo + def test_set_settings86 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title", "ingredients"]) + Algolia::Search::IndexSettings.new(min_word_sizefor1_typo: 4) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"searchableAttributes\":[\"title\",\"ingredients\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"minWordSizefor1Typo\":4}"), JSON.parse(req.body)) end - # customRanking retweets - def test_set_settings25 + # set_default_min_word_size_for_two_typos + def test_set_settings87 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(retweets)", "desc(likes)"]) + Algolia::Search::IndexSettings.new(min_word_sizefor2_typos: 4) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"minWordSizefor2Typos\":4}"), JSON.parse(req.body)) end - # customRanking boosted - def test_set_settings26 + # set_default_typo_tolerance_mode + def test_set_settings88 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(typo_tolerance: true)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"typoTolerance\":true}"), JSON.parse(req.body)) + end + + # disable_typos_on_numeric_tokens_by_default + def test_set_settings89 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(boosted)"]) + Algolia::Search::IndexSettings.new(allow_typos_on_numeric_tokens: false) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"customRanking\":[\"desc(boosted)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"allowTyposOnNumericTokens\":false}"), JSON.parse(req.body)) end - # customRanking pageviews - def test_set_settings27 + # disable_typo_tolerance_for_words + def test_set_settings90 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(pageviews)", "desc(comments)"]) + Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_words: ["wheel", "1X2BCD"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"disableTypoToleranceOnWords\":[\"wheel\",\"1X2BCD\"]}"), JSON.parse(req.body)) end - # customRanking applying search parameters for a specific query - def test_set_settings28 + # set_separators_to_index + def test_set_settings91 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - custom_ranking: ["desc(nb_airline_liaisons)"], - attributes_for_faceting: ["city, country"] - ) + Algolia::Search::IndexSettings.new(separators_to_index: "+#") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}"), - JSON.parse(req.body) + assert_equal(JSON.parse("{\"separatorsToIndex\":\"+#\"}"), JSON.parse(req.body)) + end + + # set_languages_using_querylanguages + def test_set_settings92 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(query_languages: ["es"], ignore_plurals: true) ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"queryLanguages\":[\"es\"],\"ignorePlurals\":true}"), JSON.parse(req.body)) end - # customRanking rounded pageviews - def test_set_settings29 + # set_attributes_to_transliterate + def test_set_settings93 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(rounded_pageviews)", "desc(comments)"]) + Algolia::Search::IndexSettings.new(index_languages: ["ja"], attributes_to_transliterate: ["name", "description"]) ) assert_equal(:put, req.method) @@ -3801,101 +6300,107 @@ def test_set_settings29 assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse("{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}"), + JSON.parse("{\"indexLanguages\":[\"ja\"],\"attributesToTransliterate\":[\"name\",\"description\"]}"), JSON.parse(req.body) ) end - # customRanking price - def test_set_settings30 + # set_languages_using_querylanguages + def test_set_settings94 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(price)"]) + Algolia::Search::IndexSettings.new(query_languages: ["es"], remove_stop_words: true) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"customRanking\":[\"desc(price)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"queryLanguages\":[\"es\"],\"removeStopWords\":true}"), JSON.parse(req.body)) end - # ranking exhaustive - def test_set_settings31 + # set_camel_case_attributes + def test_set_settings95 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - ranking: ["desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] - ) + Algolia::Search::IndexSettings.new(camel_case_attributes: ["description"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" - ), - JSON.parse(req.body) + assert_equal(JSON.parse("{\"camelCaseAttributes\":[\"description\"]}"), JSON.parse(req.body)) + end + + # set_decompounded_attributes + def test_set_settings96 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(decompounded_attributes: {de: ["name"]}) ) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"decompoundedAttributes\":{\"de\":[\"name\"]}}"), JSON.parse(req.body)) end - # ranking standard replica - def test_set_settings32 + # set_decompounded_multiple_attributes + def test_set_settings97 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(ranking: ["desc(post_date_timestamp)"]) + Algolia::Search::IndexSettings.new( + decompounded_attributes: {de: ["name_de", "description_de"], fi: ["name_fi", "description_fi"]} + ) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"ranking\":[\"desc(post_date_timestamp)\"]}"), JSON.parse(req.body)) + assert_equal( + JSON.parse( + "{\"decompoundedAttributes\":{\"de\":[\"name_de\",\"description_de\"],\"fi\":[\"name_fi\",\"description_fi\"]}}" + ), + JSON.parse(req.body) + ) end - # ranking virtual replica - def test_set_settings33 + # set_keep_diacritics_on_characters + def test_set_settings98 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["desc(post_date_timestamp)"]) + Algolia::Search::IndexSettings.new(keep_diacritics_on_characters: "øé") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"customRanking\":[\"desc(post_date_timestamp)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"keepDiacriticsOnCharacters\":\"\u00F8\u00E9\"}"), JSON.parse(req.body)) end - # customRanking and ranking sort alphabetically - def test_set_settings34 + # set_custom_normalization + def test_set_settings99 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - custom_ranking: ["asc(textual_attribute)"], - ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] - ) + Algolia::Search::IndexSettings.new(custom_normalization: {default: {ä: "ae"}}) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}" - ), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"customNormalization\":{\"default\":{\"\u00E4\":\"ae\"}}}"), JSON.parse(req.body)) end - # relevancyStrictness - def test_set_settings35 + # set_languages_using_querylanguages + def test_set_settings100 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(custom_ranking: ["asc(textual_attribute)"], relevancy_strictness: 0) + Algolia::Search::IndexSettings.new(query_languages: ["es"], remove_stop_words: true, ignore_plurals: true) ) assert_equal(:put, req.method) @@ -3903,174 +6408,164 @@ def test_set_settings35 assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse("{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}"), + JSON.parse("{\"queryLanguages\":[\"es\"],\"removeStopWords\":true,\"ignorePlurals\":true}"), JSON.parse(req.body) ) end - # create replica index - def test_set_settings36 + # set_indexlanguages + def test_set_settings101 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(replicas: ["products_price_desc"]) + Algolia::Search::IndexSettings.new(index_languages: ["ja"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"replicas\":[\"products_price_desc\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"indexLanguages\":[\"ja\"]}"), JSON.parse(req.body)) end - # create virtual replica index - def test_set_settings37 + # enable_decompound_query_by_default + def test_set_settings102 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(replicas: ["virtual(products_price_desc)"]) + Algolia::Search::IndexSettings.new(decompound_query: true) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"replicas\":[\"virtual(products_price_desc)\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"decompoundQuery\":true}"), JSON.parse(req.body)) end - # unlink replica index - def test_set_settings38 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(replicas: [""])) + # enable_rules_syntax_by_default + def test_set_settings103 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(enable_rules: true)) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"replicas\":[\"\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"enableRules\":true}"), JSON.parse(req.body)) end - # forwardToReplicas - def test_set_settings39 + # enable_personalization_settings + def test_set_settings104 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["name", "description"]), - true + Algolia::Search::IndexSettings.new(enable_personalization: true) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) - assert_equal({:"forwardToReplicas" => "true"}.to_a, req.query_params.to_a) + assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"searchableAttributes\":[\"name\",\"description\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"enablePersonalization\":true}"), JSON.parse(req.body)) end - # maxValuesPerFacet - def test_set_settings40 + # set_default_query_type + def test_set_settings105 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(max_values_per_facet: 1000) + Algolia::Search::IndexSettings.new(query_type: "prefixLast") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"maxValuesPerFacet\":1000}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"queryType\":\"prefixLast\"}"), JSON.parse(req.body)) end - # maxFacetHits - def test_set_settings41 - req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(max_facet_hits: 1000)) + # set_default_remove_words_if_no_result + def test_set_settings106 + req = @client.set_settings_with_http_info( + "theIndexName", + Algolia::Search::IndexSettings.new(remove_words_if_no_results: "none") + ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"maxFacetHits\":1000}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"removeWordsIfNoResults\":\"none\"}"), JSON.parse(req.body)) end - # attributesForFaceting complex - def test_set_settings42 + # enable_advanced_syntax_by_default + def test_set_settings107 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(advanced_syntax: true)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"advancedSyntax\":true}"), JSON.parse(req.body)) + end + + # set_default_optional_words + def test_set_settings108 req = @client.set_settings_with_http_info( - "", - Algolia::Search::IndexSettings.new( - attributes_for_faceting: ["actor", "filterOnly(category)", "searchable(publisher)"] - ) + "theIndexName", + Algolia::Search::IndexSettings.new(optional_words: ["blue", "iphone case"]) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/%3CYOUR_INDEX_NAME%3E/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}"), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"optionalWords\":[\"blue\",\"iphone case\"]}"), JSON.parse(req.body)) end - # ranking closest dates - def test_set_settings43 + # disabling_prefix_search_for_some_attributes_by_default + def test_set_settings109 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - ranking: ["asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"] - ) + Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["sku"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" - ), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"disablePrefixOnAttributes\":[\"sku\"]}"), JSON.parse(req.body)) end - # searchableAttributes item variation - def test_set_settings44 + # disabling_exact_for_some_attributes_by_default + def test_set_settings110 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["design", "type", "color"]) + Algolia::Search::IndexSettings.new(disable_exact_on_attributes: ["description"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"disableExactOnAttributes\":[\"description\"]}"), JSON.parse(req.body)) end - # searchableAttributes around location - def test_set_settings45 + # set_default_exact_single_word_query + def test_set_settings111 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "country", "code", "iata_code"], - custom_ranking: ["desc(links_count)"] - ) + Algolia::Search::IndexSettings.new(exact_on_single_word_query: "attribute") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" - ), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"exactOnSingleWordQuery\":\"attribute\"}"), JSON.parse(req.body)) end - # searchableAttributes around location - def test_set_settings46 + # set_default_aternative_as_exact + def test_set_settings112 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "country", "code", "iata_code"], - custom_ranking: ["desc(links_count)"] - ) + Algolia::Search::IndexSettings.new(alternatives_as_exact: ["ignorePlurals", "singleWordSynonym"]) ) assert_equal(:put, req.method) @@ -4078,233 +6573,179 @@ def test_set_settings46 assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse( - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" - ), + JSON.parse("{\"alternativesAsExact\":[\"ignorePlurals\",\"singleWordSynonym\"]}"), JSON.parse(req.body) ) end - # disableTypoToleranceOnAttributes - def test_set_settings47 + # enable_advanced_syntax_by_default + def test_set_settings113 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(advanced_syntax: true)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"advancedSyntax\":true}"), JSON.parse(req.body)) + end + + # set_numeric_attributes_for_filtering + def test_set_settings114 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new(numeric_attributes_for_filtering: ["quantity", "popularity"]) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"numericAttributesForFiltering\":[\"quantity\",\"popularity\"]}"), JSON.parse(req.body)) end - # everything - def test_set_settings48 + # enable_compression_of_integer_array + def test_set_settings115 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - advanced_syntax: true, - advanced_syntax_features: ["exactPhrase"], - allow_compression_of_integer_array: true, - allow_typos_on_numeric_tokens: true, - alternatives_as_exact: ["singleWordSynonym"], - attribute_criteria_computed_by_min_proximity: true, - attribute_for_distinct: "test", - attributes_for_faceting: ["algolia"], - attributes_to_highlight: ["algolia"], - attributes_to_retrieve: ["algolia"], - attributes_to_snippet: ["algolia"], - attributes_to_transliterate: ["algolia"], - camel_case_attributes: ["algolia"], - custom_normalization: {algolia: {aloglia: "aglolia"}}, - custom_ranking: ["algolia"], - decompound_query: false, - decompounded_attributes: {algolia: "aloglia"}, - disable_exact_on_attributes: ["algolia"], - disable_prefix_on_attributes: ["algolia"], - disable_typo_tolerance_on_attributes: ["algolia"], - disable_typo_tolerance_on_words: ["algolia"], - distinct: 3, - enable_personalization: true, - enable_re_ranking: false, - enable_rules: true, - exact_on_single_word_query: "attribute", - highlight_pre_tag: "", - highlight_post_tag: "", - hits_per_page: 10, - ignore_plurals: false, - index_languages: ["fr"], - keep_diacritics_on_characters: "abc", - max_facet_hits: 20, - max_values_per_facet: 30, - min_proximity: 6, - min_word_sizefor1_typo: 5, - min_word_sizefor2_typos: 11, - mode: "neuralSearch", - numeric_attributes_for_filtering: ["algolia"], - optional_words: ["myspace"], - pagination_limited_to: 0, - query_languages: ["fr"], - query_type: "prefixLast", - ranking: ["geo"], - re_ranking_apply_filter: "mySearch:filters", - relevancy_strictness: 10, - remove_stop_words: false, - remove_words_if_no_results: "lastWords", - rendering_content: Algolia::Search::RenderingContent.new( - facet_ordering: Algolia::Search::FacetOrdering.new( - facets: Algolia::Search::Facets.new(order: ["a", "b"]), - values: {a: Algolia::Search::Value.new(order: ["b"], sort_remaining_by: "count")} - ) - ), - replace_synonyms_in_highlight: true, - replicas: [""], - response_fields: ["algolia"], - restrict_highlight_and_snippet_arrays: true, - searchable_attributes: ["foo"], - semantic_search: Algolia::Search::SemanticSearch.new(event_sources: ["foo"]), - separators_to_index: "bar", - snippet_ellipsis_text: "---", - sort_facet_values_by: "date", - typo_tolerance: false, - unretrievable_attributes: ["foo"], - user_data: {user: "data"} - ) + Algolia::Search::IndexSettings.new(allow_compression_of_integer_array: true) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}" - ), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"allowCompressionOfIntegerArray\":true}"), JSON.parse(req.body)) end - # searchableAttributesWithCustomRankingsAndAttributesForFaceting - def test_set_settings49 + # set_attributes_for_distinct + def test_set_settings116 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["brand", "name", "categories", "unordered(description)"], - custom_ranking: ["desc(popularity)"], - attributes_for_faceting: ["searchable(brand)", "type", "categories", "price"] - ) + Algolia::Search::IndexSettings.new(attribute_for_distinct: "url") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse( - "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}" - ), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"attributeForDistinct\":\"url\"}"), JSON.parse(req.body)) end - # searchableAttributesProductReferenceSuffixes - def test_set_settings50 + # set_distinct + def test_set_settings117 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new( - searchable_attributes: ["name", "product_reference", "product_reference_suffixes"] - ) + Algolia::Search::IndexSettings.new(distinct: 1, attribute_for_distinct: "url") ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal( - JSON.parse("{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}"), - JSON.parse(req.body) - ) + assert_equal(JSON.parse("{\"distinct\":1,\"attributeForDistinct\":\"url\"}"), JSON.parse(req.body)) end - # queryLanguageAndIgnorePlurals - def test_set_settings51 + # set_replace_synonyms_in_highlights + def test_set_settings118 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(query_languages: ["en"], ignore_plurals: true) + Algolia::Search::IndexSettings.new(replace_synonyms_in_highlight: false) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"replaceSynonymsInHighlight\":false}"), JSON.parse(req.body)) end - # searchableAttributesInMovies - def test_set_settings52 + # set_min_proximity + def test_set_settings119 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(min_proximity: 1)) + + assert_equal(:put, req.method) + assert_equal("/1/indexes/theIndexName/settings", req.path) + assert_equal({}.to_a, req.query_params.to_a) + assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) + assert_equal(JSON.parse("{\"minProximity\":1}"), JSON.parse(req.body)) + end + + # set_default_field + def test_set_settings120 req = @client.set_settings_with_http_info( - "movies", - Algolia::Search::IndexSettings.new(searchable_attributes: ["title_eng", "title_fr", "title_es"]) + "theIndexName", + Algolia::Search::IndexSettings.new(response_fields: ["hits", "hitsPerPage", "nbPages", "page"]) ) assert_equal(:put, req.method) - assert_equal("/1/indexes/movies/settings", req.path) + assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse("{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}"), + JSON.parse("{\"responseFields\":[\"hits\",\"hitsPerPage\",\"nbPages\",\"page\"]}"), JSON.parse(req.body) ) end - # disablePrefixOnAttributes - def test_set_settings53 - req = @client.set_settings_with_http_info( - "theIndexName", - Algolia::Search::IndexSettings.new(disable_prefix_on_attributes: ["serial_number"]) - ) + # set_max_facet_hits + def test_set_settings121 + req = @client.set_settings_with_http_info("theIndexName", Algolia::Search::IndexSettings.new(max_facet_hits: 10)) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"disablePrefixOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"maxFacetHits\":10}"), JSON.parse(req.body)) end - # disableTypoToleranceOnAttributes - def test_set_settings54 + # set_attribute_criteria_computed_by_min_proximity + def test_set_settings122 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(disable_typo_tolerance_on_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new(attribute_criteria_computed_by_min_proximity: true) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + assert_equal(JSON.parse("{\"attributeCriteriaComputedByMinProximity\":true}"), JSON.parse(req.body)) end - # searchableAttributesSimpleExample - def test_set_settings55 + # set_user_data + def test_set_settings123 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number"]) + Algolia::Search::IndexSettings.new( + user_data: {extraData: "This is the custom data that you want to store in your index"} + ) ) assert_equal(:put, req.method) assert_equal("/1/indexes/theIndexName/settings", req.path) assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) - assert_equal(JSON.parse("{\"searchableAttributes\":[\"serial_number\"]}"), JSON.parse(req.body)) + assert_equal( + JSON.parse("{\"userData\":{\"extraData\":\"This is the custom data that you want to store in your index\"}}"), + JSON.parse(req.body) + ) end - # searchableAttributesSimpleExampleAlt - def test_set_settings56 + # set_rendering_content + def test_set_settings124 req = @client.set_settings_with_http_info( "theIndexName", - Algolia::Search::IndexSettings.new(searchable_attributes: ["serial_number", "serial_number_suffixes"]) + Algolia::Search::IndexSettings.new( + rendering_content: Algolia::Search::RenderingContent.new( + facet_ordering: Algolia::Search::FacetOrdering.new( + facets: Algolia::Search::Facets.new(order: ["size", "brand"]), + values: { + brand: Algolia::Search::Value.new(order: ["uniqlo"], hide: ["muji"], sort_remaining_by: "count"), + size: Algolia::Search::Value.new(order: ["S", "M", "L"], sort_remaining_by: "hidden") + } + ) + ) + ) ) assert_equal(:put, req.method) @@ -4312,7 +6753,9 @@ def test_set_settings56 assert_equal({}.to_a, req.query_params.to_a) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal( - JSON.parse("{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}"), + JSON.parse( + "{\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"size\",\"brand\"]},\"values\":{\"brand\":{\"order\":[\"uniqlo\"],\"hide\":[\"muji\"],\"sortRemainingBy\":\"count\"},\"size\":{\"order\":[\"S\",\"M\",\"L\"],\"sortRemainingBy\":\"hidden\"}}}}}" + ), JSON.parse(req.body) ) end diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala index dd63a5d4cc..e3f41d4066 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala @@ -4075,7 +4075,104 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("facetFiltersNeg14") { + test("facetFiltersBook14") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some(FacetFilters(Seq(FacetFilters("category:Book")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facetFilters":["category:Book"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("facetFiltersAND15") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some(FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("author:John Doe")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facetFilters":["category:Book","author:John Doe"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("facetFiltersOR16") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = + Some(FacetFilters(Seq(FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("author:John Doe")))))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facetFilters":[["category:Book","author:John Doe"]]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("facetFiltersCombined17") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetFilters = Some( + FacetFilters( + Seq( + FacetFilters("author:John Doe"), + FacetFilters(Seq(FacetFilters("category:Book"), FacetFilters("category:Movie"))) + ) + ) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = + parse("""{"query":"query","facetFilters":["author:John Doe",["category:Book","category:Movie"]]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("facetFiltersNeg18") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4096,7 +4193,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("filtersAndFacetFilters15") { + test("filtersAndFacetFilters19") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4119,7 +4216,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("facet author genre16") { + test("facet author genre20") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4140,7 +4237,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("facet wildcard17") { + test("facet wildcard21") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4161,7 +4258,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("maxValuesPerFacet18") { + test("maxValuesPerFacet22") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4182,7 +4279,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("aroundLatLng19") { + test("aroundLatLng23") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4203,7 +4300,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("aroundLatLngViaIP20") { + test("aroundLatLngViaIP24") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4224,7 +4321,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("aroundRadius21") { + test("aroundRadius25") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4246,7 +4343,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("insideBoundingBox22") { + test("insideBoundingBox26") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4269,7 +4366,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("insidePolygon23") { + test("insidePolygon27") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4298,7 +4395,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("insidePolygon24") { + test("insidePolygon28") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4327,7 +4424,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("optionalFilters25") { + test("optionalFilters29") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4348,7 +4445,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("optionalFiltersMany26") { + test("optionalFiltersMany30") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4378,7 +4475,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("optionalFiltersSimple27") { + test("optionalFiltersSimple31") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4400,7 +4497,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("restrictSearchableAttributes28") { + test("restrictSearchableAttributes32") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4421,7 +4518,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("getRankingInfo29") { + test("getRankingInfo33") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4442,7 +4539,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("clickAnalytics30") { + test("clickAnalytics34") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4463,7 +4560,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("clickAnalyticsUserToken31") { + test("clickAnalyticsUserToken35") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4485,7 +4582,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("enablePersonalization32") { + test("enablePersonalization36") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4507,7 +4604,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("userToken33") { + test("userToken37") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4528,7 +4625,29 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("analyticsTag34") { + test("userToken123438") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + userToken = Some("user-1234") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","userToken":"user-1234"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("analyticsTag39") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4549,7 +4668,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("facetFiltersUsers35") { + test("facetFiltersUsers40") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4570,7 +4689,7 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("buildTheQuery36") { + test("buildTheQuery41") { val (client, echo) = testClient() val future = client.searchSingleIndex( indexName = "indexName", @@ -4594,32 +4713,36 @@ class SearchTest extends AnyFunSuite { assert(actualBody == expectedBody) } - test("searchSynonyms with minimal parameters") { + test("attributesToHighlightOverride42") { val (client, echo) = testClient() - val future = client.searchSynonyms( - indexName = "indexName" + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToHighlight = Some(Seq("title", "content")) + ) + ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/indexName/synonyms/search") + assert(res.path == "/1/indexes/indexName/query") assert(res.method == "POST") - val expectedBody = parse("""{}""") + val expectedBody = parse("""{"query":"query","attributesToHighlight":["title","content"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchSynonyms with all parameters1") { + test("disableTypoToleranceOnAttributes43") { val (client, echo) = testClient() - val future = client.searchSynonyms( + val future = client.searchSingleIndex( indexName = "indexName", - searchSynonymsParams = Some( - SearchSynonymsParams( - query = Some("myQuery"), - `type` = Some(SynonymType.withName("altcorrection1")), - page = Some(10), - hitsPerPage = Some(10) + searchParams = Some( + SearchParamsObject( + query = Some("query"), + disableTypoToleranceOnAttributes = Some(Seq("serial_number")) ) ) ) @@ -4627,40 +4750,41 @@ class SearchTest extends AnyFunSuite { Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/indexName/synonyms/search") + assert(res.path == "/1/indexes/indexName/query") assert(res.method == "POST") - val expectedBody = parse("""{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""") + val expectedBody = parse("""{"query":"query","disableTypoToleranceOnAttributes":["serial_number"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchUserIds") { + test("search_a_query44") { val (client, echo) = testClient() - val future = client.searchUserIds( - searchUserIdsParams = SearchUserIdsParams( - query = "test", - clusterName = Some("theClusterName"), - page = Some(5), - hitsPerPage = Some(10) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("shirt") + ) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/clusters/mapping/search") + assert(res.path == "/1/indexes/indexName/query") assert(res.method == "POST") - val expectedBody = parse("""{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""") + val expectedBody = parse("""{"query":"shirt"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("get setDictionarySettings results with minimal parameters") { + test("search_everything45") { val (client, echo) = testClient() - val future = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("") ) ) ) @@ -4668,21 +4792,21 @@ class SearchTest extends AnyFunSuite { Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/dictionaries/*/settings") - assert(res.method == "PUT") - val expectedBody = parse("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""") + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":""}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("get setDictionarySettings results with all parameters1") { + test("api_filtering_range_example46") { val (client, echo) = testClient() - val future = client.setDictionarySettings( - dictionarySettingsParams = DictionarySettingsParams( - disableStandardEntries = StandardEntries( - plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)), - stopwords = Some(Map("fr" -> false)), - compounds = Some(Map("ru" -> true)) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("books"), + filters = Some("price:10 TO 20") ) ) ) @@ -4690,131 +4814,3380 @@ class SearchTest extends AnyFunSuite { Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/dictionaries/*/settings") - assert(res.method == "PUT") - val expectedBody = parse( - """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" - ) + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"books","filters":"price:10 TO 20"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("minimal parameters") { + test("search_a_query47") { val (client, echo) = testClient() - val future = client.setSettings( - indexName = "cts_e2e_settings", - indexSettings = IndexSettings( - paginationLimitedTo = Some(10) - ), - forwardToReplicas = Some(true) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some(""), + similarQuery = Some("Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen"), + filters = Some("year:1991 TO 2001") + ) + ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/cts_e2e_settings/settings") - assert(res.method == "PUT") - val expectedBody = parse("""{"paginationLimitedTo":10}""") + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"query":"","similarQuery":"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen","filters":"year:1991 TO 2001"}""" + ) val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("boolean typoTolerance1") { + test("override_retrievable_attributes48") { val (client, echo) = testClient() - val future = client.setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - typoTolerance = Some(TypoTolerance(true)) - ), - forwardToReplicas = Some(true) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToRetrieve = Some(Seq("title", "content")) + ) + ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/theIndexName/settings") - assert(res.method == "PUT") - val expectedBody = parse("""{"typoTolerance":true}""") + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","attributesToRetrieve":["title","content"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("enum typoTolerance2") { + test("restrict_searchable_attributes49") { val (client, echo) = testClient() - val future = client.setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - typoTolerance = Some(TypoToleranceEnum.withName("min")) - ), - forwardToReplicas = Some(true) + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + restrictSearchableAttributes = Some(Seq("title", "author")) + ) + ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/theIndexName/settings") - assert(res.method == "PUT") - val expectedBody = parse("""{"typoTolerance":"min"}""") + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","restrictSearchableAttributes":["title","author"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("ignorePlurals3") { + test("override_default_relevancy50") { val (client, echo) = testClient() - val future = client.setSettings( - indexName = "theIndexName", - indexSettings = IndexSettings( - ignorePlurals = Some(IgnorePlurals(true)) - ), - forwardToReplicas = Some(true) - ) - + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + relevancyStrictness = Some(70) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","relevancyStrictness":70}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_filters51") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("(category:Book OR category:Ebook) AND _tags:published") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","filters":"(category:Book OR category:Ebook) AND _tags:published"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_all_filters52") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some( + "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\"" + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"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\""}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("escape_spaces53") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("category:\"Books and Comics\"") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","filters":"category:\"Books and Comics\""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("escape_keywords54") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("keyword:\"OR\"") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","filters":"keyword:\"OR\""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("escape_single_quotes55") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("content:\"It's a wonderful day\"") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","filters":"content:\"It's a wonderful day\""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("escape_double_quotes56") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + filters = Some("content:\"She said \"Hello World\"") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","filters":"content:\"She said \"Hello World\""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_filters57") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalFilters = + Some(OptionalFilters(Seq(OptionalFilters("category:Book"), OptionalFilters("author:John Doe")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","optionalFilters":["category:Book","author:John Doe"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_negative_filters58") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalFilters = + Some(OptionalFilters(Seq(OptionalFilters("category:Book"), OptionalFilters("author:-John Doe")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","optionalFilters":["category:Book","author:-John Doe"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_numeric_filters59") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + numericFilters = Some( + NumericFilters( + Seq( + NumericFilters("price < 1000"), + NumericFilters(Seq(NumericFilters("inStock = 1"), NumericFilters("deliveryDate < 1441755506"))) + ) + ) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = + parse("""{"query":"query","numericFilters":["price < 1000",["inStock = 1","deliveryDate < 1441755506"]]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_tag_filters60") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + tagFilters = + Some(TagFilters(Seq(TagFilters("SciFi"), TagFilters(Seq(TagFilters("Book"), TagFilters("Movie")))))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","tagFilters":["SciFi",["Book","Movie"]]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("apply_filters61") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + sumOrFiltersScores = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","sumOrFiltersScores":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("facets_all62") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facets = Some(Seq("*")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facets":["*"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("retrieve_only_some_facets63") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facets = Some(Seq("category", "author")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facets":["category","author"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_max_values_per_facet64") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + maxValuesPerFacet = Some(20) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","maxValuesPerFacet":20}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_faceting_after_distinct65") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + facetingAfterDistinct = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","facetingAfterDistinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("sort_facet_values_alphabetically66") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + sortFacetValuesBy = Some("count") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","sortFacetValuesBy":"count"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_attributes_to_snippet67") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + attributesToSnippet = Some(Seq("title", "content:80")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","attributesToSnippet":["title","content:80"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_highlight_pre_tag68") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + highlightPreTag = Some("") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","highlightPreTag":""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_highlight_post_tag69") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + highlightPostTag = Some("") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","highlightPostTag":""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_snippet_ellipsis_text70") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + snippetEllipsisText = Some("") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","snippetEllipsisText":""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_restrict_highlight_and_snippet_arrays71") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + restrictHighlightAndSnippetArrays = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","restrictHighlightAndSnippetArrays":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("access_page72") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + page = Some(0) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","page":0}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_hits_per_page73") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + hitsPerPage = Some(10) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","hitsPerPage":10}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("get_nth_hit74") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + offset = Some(4) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","offset":4}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("get_n_results75") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + length = Some(4) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","length":4}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_min_word_size_for_one_typo76") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minWordSizefor1Typo = Some(2) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","minWordSizefor1Typo":2}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_min_word_size_for_two_typos77") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minWordSizefor2Typos = Some(2) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","minWordSizefor2Typos":2}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_typo_tolerance_mode78") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + typoTolerance = Some(TypoTolerance(false)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","typoTolerance":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disable_typos_on_numeric_tokens_at_search_time79") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + allowTyposOnNumericTokens = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","allowTyposOnNumericTokens":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_around_a_position80") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundLatLng = Some("40.71, -74.01") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","aroundLatLng":"40.71, -74.01"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_around_server_ip81") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundLatLngViaIP = Some(true) + ) + ), + requestOptions = Some( + RequestOptions + .builder() + .withHeader( + "x-forwarded-for", + "94.228.178.246 // should be replaced with the actual IP you would like to search around" + ) + .build() + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","aroundLatLngViaIP":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedHeaders = parse( + """{"x-forwarded-for":"94.228.178.246 // should be replaced with the actual IP you would like to search around"}""" + ).asInstanceOf[JObject].obj.toMap + val actualHeaders = res.headers + for ((k, v) <- expectedHeaders) { + assert(actualHeaders.contains(k)) + assert(actualHeaders(k) == v.asInstanceOf[JString].s) + } + } + + test("set_around_radius82") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundRadius = Some(AroundRadius(1000)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","aroundRadius":1000}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disable_automatic_radius83") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundRadius = Some(AroundRadiusAll.withName("all")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","aroundRadius":"all"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_geo_search_precision84") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundPrecision = Some(AroundPrecision(100)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","aroundPrecision":100}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_geo_search_precision_non_linear85") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + aroundPrecision = Some( + AroundPrecision( + Seq( + Range( + from = Some(0), + value = Some(25) + ), + Range( + from = Some(2000), + value = Some(1000) + ) + ) + ) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = + parse("""{"query":"query","aroundPrecision":[{"from":0,"value":25},{"from":2000,"value":1000}]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_minimum_geo_search_radius86") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minimumAroundRadius = Some(1000) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","minimumAroundRadius":1000}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_inside_rectangular_area87") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insideBoundingBox = + Some(InsideBoundingBox(Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625)))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_inside_multiple_rectangular_areas88") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insideBoundingBox = Some( + InsideBoundingBox( + Seq( + Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625), + Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875) + ) + ) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"query":"query","insideBoundingBox":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_inside_polygon_area89") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insidePolygon = Some( + Seq(Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625)) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"query":"query","insidePolygon":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("search_inside_multiple_polygon_areas90") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + insidePolygon = Some( + Seq( + Seq(46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625, 49.62625916704081, 4.6181640625), + Seq(49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875, 45.17210966999772, 1.009765625, + 50.62626704081, 4.6181640625) + ) + ) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse( + """{"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]]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_querylanguages_override91") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","ignorePlurals":["ca","es"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_querylanguages_override92") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeStopWords = + Some(RemoveStopWords(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","removeStopWords":["ca","es"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_querylanguages_override93") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeStopWords = + Some(RemoveStopWords(Seq(SupportedLanguage.withName("ca"), SupportedLanguage.withName("es")))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","removeStopWords":["ca","es"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_querylanguages_with_japanese_query94") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + queryLanguages = Some(Seq(SupportedLanguage.withName("ja"), SupportedLanguage.withName("en"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","queryLanguages":["ja","en"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_natural_languages95") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some(""), + naturalLanguages = Some(Seq(SupportedLanguage.withName("fr"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"","naturalLanguages":["fr"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_natural_languages_with_query96") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some(""), + naturalLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("firstWords")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"","naturalLanguages":["fr"],"removeWordsIfNoResults":"firstWords"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_decompound_query_search_time97") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + decompoundQuery = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","decompoundQuery":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_rules_search_time98") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableRules = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enableRules":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_rule_contexts99") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + ruleContexts = Some(Seq("front_end", "website2")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","ruleContexts":["front_end","website2"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_personalization100") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enablePersonalization":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_personalization_with_user_token101") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true), + userToken = Some("123456") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enablePersonalization":true,"userToken":"123456"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("personalization_impact102") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + personalizationImpact = Some(20) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","personalizationImpact":20}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_user_token103") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + userToken = Some("123456") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","userToken":"123456"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_user_token_with_personalization104") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enablePersonalization = Some(true), + userToken = Some("123456") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enablePersonalization":true,"userToken":"123456"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_query_type105") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + queryType = Some(QueryType.withName("prefixAll")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","queryType":"prefixAll"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_remove_words_if_no_results106") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","removeWordsIfNoResults":"lastWords"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_advanced_syntax_search_time107") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","advancedSyntax":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("overide_default_optional_words108") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + optionalWords = Some(OptionalWords(Seq("toyota", "2020 2021"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","optionalWords":["toyota","2020 2021"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disabling_exact_for_some_attributes_search_time109") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + disableExactOnAttributes = Some(Seq("description")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","disableExactOnAttributes":["description"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_exact_single_word_query110") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("none")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","exactOnSingleWordQuery":"none"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_aternative_as_exact111") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + alternativesAsExact = Some(Seq(AlternativesAsExact.withName("multiWordsSynonym"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","alternativesAsExact":["multiWordsSynonym"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_advanced_syntax_exact_phrase112") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_advanced_syntax_exclude_words113") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("excludeWords"))) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","advancedSyntax":true,"advancedSyntaxFeatures":["excludeWords"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_distinct114") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + distinct = Some(Distinct(0)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","distinct":0}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("get_ranking_info115") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + getRankingInfo = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","getRankingInfo":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disable_click_analytics116") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + clickAnalytics = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","clickAnalytics":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_click_analytics117") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + clickAnalytics = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","clickAnalytics":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disable_analytics118") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + analytics = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","analytics":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("add_analytics_tags119") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + analyticsTags = Some(Seq("front_end", "website2")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","analyticsTags":["front_end","website2"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disable_synonyms120") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + synonyms = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","synonyms":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_replace_synonyms_in_highlights121") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + replaceSynonymsInHighlight = Some(true) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","replaceSynonymsInHighlight":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_min_proximity122") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + minProximity = Some(2) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","minProximity":2}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_default_field123") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + responseFields = Some(Seq("hits", "facets")) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","responseFields":["hits","facets"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("override_percentile_computation124") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + percentileComputation = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","percentileComputation":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_ab_test125") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableABTest = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enableABTest":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_enable_re_ranking126") { + val (client, echo) = testClient() + val future = client.searchSingleIndex( + indexName = "indexName", + searchParams = Some( + SearchParamsObject( + query = Some("query"), + enableReRanking = Some(false) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/query") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"query","enableReRanking":false}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchSynonyms with minimal parameters") { + val (client, echo) = testClient() + val future = client.searchSynonyms( + indexName = "indexName" + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/synonyms/search") + assert(res.method == "POST") + val expectedBody = parse("""{}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchSynonyms with all parameters1") { + val (client, echo) = testClient() + val future = client.searchSynonyms( + indexName = "indexName", + searchSynonymsParams = Some( + SearchSynonymsParams( + query = Some("myQuery"), + `type` = Some(SynonymType.withName("altcorrection1")), + page = Some(10), + hitsPerPage = Some(10) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/indexName/synonyms/search") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"myQuery","type":"altcorrection1","page":10,"hitsPerPage":10}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchUserIds") { + val (client, echo) = testClient() + val future = client.searchUserIds( + searchUserIdsParams = SearchUserIdsParams( + query = "test", + clusterName = Some("theClusterName"), + page = Some(5), + hitsPerPage = Some(10) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/clusters/mapping/search") + assert(res.method == "POST") + val expectedBody = parse("""{"query":"test","clusterName":"theClusterName","page":5,"hitsPerPage":10}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("get setDictionarySettings results with minimal parameters") { + val (client, echo) = testClient() + val future = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/dictionaries/*/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true}}}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("get setDictionarySettings results with all parameters1") { + val (client, echo) = testClient() + val future = client.setDictionarySettings( + dictionarySettingsParams = DictionarySettingsParams( + disableStandardEntries = StandardEntries( + plurals = Some(Map("fr" -> false, "en" -> false, "ru" -> true)), + stopwords = Some(Map("fr" -> false)), + compounds = Some(Map("ru" -> true)) + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/dictionaries/*/settings") + assert(res.method == "PUT") + val expectedBody = parse( + """{"disableStandardEntries":{"plurals":{"fr":false,"en":false,"ru":true},"stopwords":{"fr":false},"compounds":{"ru":true}}}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("minimal parameters") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "cts_e2e_settings", + indexSettings = IndexSettings( + paginationLimitedTo = Some(10) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/cts_e2e_settings/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"paginationLimitedTo":10}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("boolean typoTolerance1") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + typoTolerance = Some(TypoTolerance(true)) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"typoTolerance":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("enum typoTolerance2") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + typoTolerance = Some(TypoToleranceEnum.withName("min")) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"typoTolerance":"min"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("ignorePlurals3") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ignorePlurals = Some(IgnorePlurals(true)) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"ignorePlurals":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("list of string ignorePlurals4") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("fr")))) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"ignorePlurals":["fr"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("removeStopWords boolean5") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + removeStopWords = Some(RemoveStopWords(true)) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"removeStopWords":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("removeStopWords list of string6") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + removeStopWords = Some(RemoveStopWords(Seq(SupportedLanguage.withName("fr")))) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"removeStopWords":["fr"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("boolean distinct7") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Some(Distinct(true)) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"distinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("integer distinct8") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Some(Distinct(1)) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"distinct":1}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("distinct company9") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = Some("company"), + distinct = Some(Distinct(true)) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributeForDistinct":"company","distinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("distinct design10") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = Some("design"), + distinct = Some(Distinct(true)) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributeForDistinct":"design","distinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("distinct true11") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + distinct = Some(Distinct(true)) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"distinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("distinct section12") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributeForDistinct = Some("section"), + distinct = Some(Distinct(true)) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributeForDistinct":"section","distinct":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting allergens13") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("allergens")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["allergens"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("api_attributes_for_faceting14") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("genre", "author")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["genre","author"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("api_attributes_for_faceting_searchable15") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("genre", "searchable(author)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["genre","searchable(author)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("api_attributes_for_filter_only16") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(genre)", "author")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["filterOnly(genre)","author"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting categoryPageId17") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("searchable(categoryPageId)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["searchable(categoryPageId)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("unretrievableAttributes18") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + unretrievableAttributes = Some(Seq("visible_by")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"unretrievableAttributes":["visible_by"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting user restricted data19") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(visible_by)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["filterOnly(visible_by)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting optional filters20") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("can_deliver_quickly", "restaurant")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting redirect index21") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("query_terms")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["query_terms"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting multiple consequences22") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("director")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["director"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting in-depth optional filters23") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("filterOnly(brand)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["filterOnly(brand)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("mode neuralSearch24") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + mode = Some(Mode.withName("neuralSearch")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"mode":"neuralSearch"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("mode keywordSearch25") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + mode = Some(Mode.withName("keywordSearch")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"mode":"keywordSearch"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributes same priority26") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title,comments", "ingredients")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["title,comments","ingredients"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributes higher priority27") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title", "ingredients")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["title","ingredients"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking retweets28") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(retweets)", "desc(likes)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(retweets)","desc(likes)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking boosted29") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(boosted)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(boosted)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking pageviews30") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(pageviews)", "desc(comments)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(pageviews)","desc(comments)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking applying search parameters for a specific query31") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(nb_airline_liaisons)")), + attributesForFaceting = Some(Seq("city, country")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = + parse("""{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking rounded pageviews32") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(rounded_pageviews)", "desc(comments)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking price33") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(price)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(price)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("ranking exhaustive34") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = + Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = + parse("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("ranking standard replica35") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = Some(Seq("desc(post_date_timestamp)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"ranking":["desc(post_date_timestamp)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("ranking virtual replica36") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("desc(post_date_timestamp)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["desc(post_date_timestamp)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("customRanking and ranking sort alphabetically37") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("asc(textual_attribute)")), + ranking = Some(Seq("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse( + """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("relevancyStrictness38") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + customRanking = Some(Seq("asc(textual_attribute)")), + relevancyStrictness = Some(0) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("create replica index39") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = Some(Seq("products_price_desc")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"replicas":["products_price_desc"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("create replica index articles40") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = Some(Seq("articles_date_desc")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"replicas":["articles_date_desc"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("create virtual replica index41") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = Some(Seq("virtual(products_price_desc)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"replicas":["virtual(products_price_desc)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("unlink replica index42") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + replicas = Some(Seq("")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"replicas":[""]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("forwardToReplicas43") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "description")) + ), + forwardToReplicas = Some(true) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["name","description"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap + val actualQuery = res.queryParameters + assert(actualQuery.size == expectedQuery.size) + for ((k, v) <- actualQuery) { + assert(expectedQuery.contains(k)) + assert(expectedQuery(k).values == v) + } + } + + test("maxValuesPerFacet44") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + maxValuesPerFacet = Some(1000) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"maxValuesPerFacet":1000}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("maxFacetHits45") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + maxFacetHits = Some(1000) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"maxFacetHits":1000}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesForFaceting complex46") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "", + indexSettings = IndexSettings( + attributesForFaceting = Some(Seq("actor", "filterOnly(category)", "searchable(publisher)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("ranking closest dates47") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + ranking = Some( + Seq("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom") + ) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse( + """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributes item variation48") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("design", "type", "color")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["design","type","color"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributes around location49") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), + customRanking = Some(Seq("desc(links_count)")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = + parse("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesToHighlight50") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToHighlight = Some(Seq("author", "title", "content")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesToHighlight":["author","title","content"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("attributesToHighlightStar51") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToHighlight = Some(Seq("*")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesToHighlight":["*"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("everything52") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + advancedSyntax = Some(true), + advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))), + allowCompressionOfIntegerArray = Some(true), + allowTyposOnNumericTokens = Some(true), + alternativesAsExact = Some(Seq(AlternativesAsExact.withName("singleWordSynonym"))), + attributeCriteriaComputedByMinProximity = Some(true), + attributeForDistinct = Some("test"), + attributesForFaceting = Some(Seq("algolia")), + attributesToHighlight = Some(Seq("algolia")), + attributesToRetrieve = Some(Seq("algolia")), + attributesToSnippet = Some(Seq("algolia")), + attributesToTransliterate = Some(Seq("algolia")), + camelCaseAttributes = Some(Seq("algolia")), + customNormalization = Some(Map("algolia" -> Map("aloglia" -> "aglolia"))), + customRanking = Some(Seq("algolia")), + decompoundQuery = Some(false), + decompoundedAttributes = Some(JObject(List(JField("algolia", JString("aloglia"))))), + disableExactOnAttributes = Some(Seq("algolia")), + disablePrefixOnAttributes = Some(Seq("algolia")), + disableTypoToleranceOnAttributes = Some(Seq("algolia")), + disableTypoToleranceOnWords = Some(Seq("algolia")), + distinct = Some(Distinct(3)), + enablePersonalization = Some(true), + enableReRanking = Some(false), + enableRules = Some(true), + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")), + highlightPreTag = Some(""), + highlightPostTag = Some(""), + hitsPerPage = Some(10), + ignorePlurals = Some(IgnorePlurals(false)), + indexLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + keepDiacriticsOnCharacters = Some("abc"), + maxFacetHits = Some(20), + maxValuesPerFacet = Some(30), + minProximity = Some(6), + minWordSizefor1Typo = Some(5), + minWordSizefor2Typos = Some(11), + mode = Some(Mode.withName("neuralSearch")), + numericAttributesForFiltering = Some(Seq("algolia")), + optionalWords = Some(OptionalWords(Seq("myspace"))), + paginationLimitedTo = Some(0), + queryLanguages = Some(Seq(SupportedLanguage.withName("fr"))), + queryType = Some(QueryType.withName("prefixLast")), + ranking = Some(Seq("geo")), + reRankingApplyFilter = Some(ReRankingApplyFilter("mySearch:filters")), + relevancyStrictness = Some(10), + removeStopWords = Some(RemoveStopWords(false)), + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")), + renderingContent = Some( + RenderingContent( + facetOrdering = Some( + FacetOrdering( + facets = Some( + Facets( + order = Some(Seq("a", "b")) + ) + ), + values = Some( + Map( + "a" -> Value( + order = Some(Seq("b")), + sortRemainingBy = Some(SortRemainingBy.withName("count")) + ) + ) + ) + ) + ) + ) + ), + replaceSynonymsInHighlight = Some(true), + replicas = Some(Seq("")), + responseFields = Some(Seq("algolia")), + restrictHighlightAndSnippetArrays = Some(true), + searchableAttributes = Some(Seq("foo")), + semanticSearch = Some( + SemanticSearch( + eventSources = Some(Seq("foo")) + ) + ), + separatorsToIndex = Some("bar"), + snippetEllipsisText = Some("---"), + sortFacetValuesBy = Some("date"), + typoTolerance = Some(TypoTolerance(false)), + unretrievableAttributes = Some(Seq("foo")), + userData = Some(JObject(List(JField("user", JString("data"))))) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse( + """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesWithCustomRankingsAndAttributesForFaceting53") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("brand", "name", "categories", "unordered(description)")), + customRanking = Some(Seq("desc(popularity)")), + attributesForFaceting = Some(Seq("searchable(brand)", "type", "categories", "price")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse( + """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" + ) + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesOrdering54") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("unordered(title)", "cast")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["unordered(title)","cast"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesProductReferenceSuffixes55") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("name", "product_reference", "product_reference_suffixes")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("queryLanguageAndIgnorePlurals56") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + queryLanguages = Some(Seq(SupportedLanguage.withName("en"))), + ignorePlurals = Some(IgnorePlurals(true)) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"queryLanguages":["en"],"ignorePlurals":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesInMovies57") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "movies", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title_eng", "title_fr", "title_es")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/movies/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["title_eng","title_fr","title_es"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disablePrefixOnAttributes58") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + disablePrefixOnAttributes = Some(Seq("serial_number")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"disablePrefixOnAttributes":["serial_number"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("disableTypoToleranceOnAttributes59") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"disableTypoToleranceOnAttributes":["serial_number"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesSimpleExample60") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("serial_number")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["serial_number"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("searchableAttributesSimpleExampleAlt61") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("serial_number", "serial_number_suffixes")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"searchableAttributes":["serial_number","serial_number_suffixes"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_searchable_attributes62") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + searchableAttributes = Some(Seq("title,alternative_title", "author", "unordered(text)", "emails.personal")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = + parse("""{"searchableAttributes":["title,alternative_title","author","unordered(text)","emails.personal"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_searchable_attributes63") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesForFaceting = Some( + Seq( + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))" + ) + ) + ) + ) + Await.ready(future, Duration.Inf) val res = echo.lastResponse.get assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"ignorePlurals":true}""") + val expectedBody = parse( + """{"attributesForFaceting":["author","filterOnly(isbn)","searchable(edition)","afterDistinct(category)","afterDistinct(searchable(publisher))"]}""" + ) val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("list of string ignorePlurals4") { + test("unretrievable_attributes64") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ignorePlurals = Some(IgnorePlurals(Seq(SupportedLanguage.withName("fr")))) - ), - forwardToReplicas = Some(true) + unretrievableAttributes = Some(Seq("total_number_of_sales")) + ) ) Await.ready(future, Duration.Inf) @@ -4822,26 +8195,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"ignorePlurals":["fr"]}""") + val expectedBody = parse("""{"unretrievableAttributes":["total_number_of_sales"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("removeStopWords boolean5") { + test("set_retrievable_attributes65") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - removeStopWords = Some(RemoveStopWords(true)) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("author", "title", "content")) + ) ) Await.ready(future, Duration.Inf) @@ -4849,26 +8214,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"removeStopWords":true}""") + val expectedBody = parse("""{"attributesToRetrieve":["author","title","content"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("removeStopWords list of string6") { + test("set_all_attributes_as_retrievable66") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - removeStopWords = Some(RemoveStopWords(Seq(SupportedLanguage.withName("fr")))) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("*")) + ) ) Await.ready(future, Duration.Inf) @@ -4876,26 +8233,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"removeStopWords":["fr"]}""") + val expectedBody = parse("""{"attributesToRetrieve":["*"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("boolean distinct7") { + test("specify_attributes_not_to_retrieve67") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Some(Distinct(true)) - ), - forwardToReplicas = Some(true) + attributesToRetrieve = Some(Seq("*", "-SKU", "-internal_desc")) + ) ) Await.ready(future, Duration.Inf) @@ -4903,26 +8252,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"distinct":true}""") + val expectedBody = parse("""{"attributesToRetrieve":["*","-SKU","-internal_desc"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("integer distinct8") { + test("neural_search68") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Some(Distinct(1)) - ), - forwardToReplicas = Some(true) + mode = Some(Mode.withName("neuralSearch")) + ) ) Await.ready(future, Duration.Inf) @@ -4930,25 +8271,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"distinct":1}""") + val expectedBody = parse("""{"mode":"neuralSearch"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("distinct company9") { + test("keyword_search69") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = Some("company"), - distinct = Some(Distinct(true)) + mode = Some(Mode.withName("keywordSearch")) ) ) @@ -4957,18 +8290,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributeForDistinct":"company","distinct":true}""") + val expectedBody = parse("""{"mode":"keywordSearch"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("distinct design10") { + test("set_default_ranking70") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = Some("design"), - distinct = Some(Distinct(true)) + ranking = Some(Seq("typo", "geo", "words", "filters", "attribute", "proximity", "exact", "custom")) ) ) @@ -4977,17 +8309,19 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributeForDistinct":"design","distinct":true}""") + val expectedBody = + parse("""{"ranking":["typo","geo","words","filters","attribute","proximity","exact","custom"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("distinct true11") { + test("set_ranking_by_attribute_asc71") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - distinct = Some(Distinct(true)) + ranking = + Some(Seq("asc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) ) ) @@ -4996,18 +8330,19 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"distinct":true}""") + val expectedBody = + parse("""{"ranking":["asc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("distinct section12") { + test("set_ranking_by_attribute_desc72") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - attributeForDistinct = Some("section"), - distinct = Some(Distinct(true)) + ranking = + Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) ) ) @@ -5016,169 +8351,322 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributeForDistinct":"section","distinct":true}""") + val expectedBody = + parse("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting allergens13") { + test("restrict_searchable_attributes73") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("allergens")) + customRanking = Some(Seq("desc(popularity)", "asc(price)")) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["allergens"]}""") + val expectedBody = parse("""{"customRanking":["desc(popularity)","asc(price)"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting categoryPageId14") { + test("set_default_relevancy74") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("searchable(categoryPageId)")) + relevancyStrictness = Some(90) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["searchable(categoryPageId)"]}""") + val expectedBody = parse("""{"relevancyStrictness":90}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("unretrievableAttributes15") { + test("set_replicas75") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - unretrievableAttributes = Some(Seq("visible_by")) + replicas = Some(Seq("name_of_replica_index1", "name_of_replica_index2")) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"unretrievableAttributes":["visible_by"]}""") + val expectedBody = parse("""{"replicas":["name_of_replica_index1","name_of_replica_index2"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting user restricted data16") { + test("set_default_max_values_per_facet76") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("filterOnly(visible_by)")) + maxValuesPerFacet = Some(100) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"maxValuesPerFacet":100}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_default_sort_facet_values_by77") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + sortFacetValuesBy = Some("alpha") + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"sortFacetValuesBy":"alpha"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_attributes_to_snippet78") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToSnippet = Some(Seq("content:80", "description")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesToSnippet":["content:80","description"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_all_attributes_to_snippet79") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + attributesToSnippet = Some(Seq("*:80")) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"attributesToSnippet":["*:80"]}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_default_highlight_pre_tag80") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + highlightPreTag = Some("") + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"highlightPreTag":""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_default_highlight_post_tag81") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + highlightPostTag = Some("") + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"highlightPostTag":""}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_default_snippet_ellipsis_text82") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + snippetEllipsisText = Some("…") + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"snippetEllipsisText":"…"}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("enable_restrict_highlight_and_snippet_arrays_by_default83") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + restrictHighlightAndSnippetArrays = Some(true) + ) + ) + + Await.ready(future, Duration.Inf) + val res = echo.lastResponse.get + + assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.method == "PUT") + val expectedBody = parse("""{"restrictHighlightAndSnippetArrays":true}""") + val actualBody = parse(res.body.get) + assert(actualBody == expectedBody) + } + + test("set_default_hits_per_page84") { + val (client, echo) = testClient() + val future = client.setSettings( + indexName = "theIndexName", + indexSettings = IndexSettings( + hitsPerPage = Some(20) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["filterOnly(visible_by)"]}""") + val expectedBody = parse("""{"hitsPerPage":20}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting optional filters17") { + test("set_pagination_limit85") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("can_deliver_quickly", "restaurant")) + paginationLimitedTo = Some(1000) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["can_deliver_quickly","restaurant"]}""") + val expectedBody = parse("""{"paginationLimitedTo":1000}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting redirect index18") { + test("set_default_min_word_size_for_one_typo86") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("query_terms")) + minWordSizefor1Typo = Some(4) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["query_terms"]}""") + val expectedBody = parse("""{"minWordSizefor1Typo":4}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting multiple consequences19") { + test("set_default_min_word_size_for_two_typos87") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("director")) + minWordSizefor2Typos = Some(4) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["director"]}""") + val expectedBody = parse("""{"minWordSizefor2Typos":4}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting in-depth optional filters20") { + test("set_default_typo_tolerance_mode88") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("filterOnly(brand)")) + typoTolerance = Some(TypoTolerance(true)) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["filterOnly(brand)"]}""") + val expectedBody = parse("""{"typoTolerance":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("mode neuralSearch21") { + test("disable_typos_on_numeric_tokens_by_default89") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - mode = Some(Mode.withName("neuralSearch")) + allowTyposOnNumericTokens = Some(false) ) ) @@ -5187,17 +8675,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"mode":"neuralSearch"}""") + val expectedBody = parse("""{"allowTyposOnNumericTokens":false}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("mode keywordSearch22") { + test("disable_typo_tolerance_for_words90") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - mode = Some(Mode.withName("keywordSearch")) + disableTypoToleranceOnWords = Some(Seq("wheel", "1X2BCD")) ) ) @@ -5206,17 +8694,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"mode":"keywordSearch"}""") + val expectedBody = parse("""{"disableTypoToleranceOnWords":["wheel","1X2BCD"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributes same priority23") { + test("set_separators_to_index91") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title,comments", "ingredients")) + separatorsToIndex = Some("+#") ) ) @@ -5225,17 +8713,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["title,comments","ingredients"]}""") + val expectedBody = parse("""{"separatorsToIndex":"+#"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributes higher priority24") { + test("set_languages_using_querylanguages92") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title", "ingredients")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + ignorePlurals = Some(IgnorePlurals(true)) ) ) @@ -5244,17 +8733,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["title","ingredients"]}""") + val expectedBody = parse("""{"queryLanguages":["es"],"ignorePlurals":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking retweets25") { + test("set_attributes_to_transliterate93") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(retweets)", "desc(likes)")) + indexLanguages = Some(Seq(SupportedLanguage.withName("ja"))), + attributesToTransliterate = Some(Seq("name", "description")) ) ) @@ -5263,17 +8753,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(retweets)","desc(likes)"]}""") + val expectedBody = parse("""{"indexLanguages":["ja"],"attributesToTransliterate":["name","description"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking boosted26") { + test("set_languages_using_querylanguages94") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(boosted)")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + removeStopWords = Some(RemoveStopWords(true)) ) ) @@ -5282,17 +8773,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(boosted)"]}""") + val expectedBody = parse("""{"queryLanguages":["es"],"removeStopWords":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking pageviews27") { + test("set_camel_case_attributes95") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(pageviews)", "desc(comments)")) + camelCaseAttributes = Some(Seq("description")) ) ) @@ -5301,18 +8792,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(pageviews)","desc(comments)"]}""") + val expectedBody = parse("""{"camelCaseAttributes":["description"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking applying search parameters for a specific query28") { + test("set_decompounded_attributes96") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(nb_airline_liaisons)")), - attributesForFaceting = Some(Seq("city, country")) + decompoundedAttributes = Some(JObject(List(JField("de", JArray(List(JString("name"))))))) ) ) @@ -5321,18 +8811,24 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = - parse("""{"customRanking":["desc(nb_airline_liaisons)"],"attributesForFaceting":["city, country"]}""") + val expectedBody = parse("""{"decompoundedAttributes":{"de":["name"]}}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking rounded pageviews29") { + test("set_decompounded_multiple_attributes97") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(rounded_pageviews)", "desc(comments)")) + decompoundedAttributes = Some( + JObject( + List( + JField("de", JArray(List(JString("name_de"), JString("description_de")))), + JField("fi", JArray(List(JString("name_fi"), JString("description_fi")))) + ) + ) + ) ) ) @@ -5341,17 +8837,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(rounded_pageviews)","desc(comments)"]}""") + val expectedBody = + parse("""{"decompoundedAttributes":{"de":["name_de","description_de"],"fi":["name_fi","description_fi"]}}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking price30") { + test("set_keep_diacritics_on_characters98") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(price)")) + keepDiacriticsOnCharacters = Some("øé") ) ) @@ -5360,18 +8857,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(price)"]}""") + val expectedBody = parse("""{"keepDiacriticsOnCharacters":"øé"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("ranking exhaustive31") { + test("set_custom_normalization99") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = - Some(Seq("desc(price)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom")) + customNormalization = Some(Map("default" -> Map("ä" -> "ae"))) ) ) @@ -5380,18 +8876,19 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = - parse("""{"ranking":["desc(price)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""") + val expectedBody = parse("""{"customNormalization":{"default":{"ä":"ae"}}}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("ranking standard replica32") { + test("set_languages_using_querylanguages100") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = Some(Seq("desc(post_date_timestamp)")) + queryLanguages = Some(Seq(SupportedLanguage.withName("es"))), + removeStopWords = Some(RemoveStopWords(true)), + ignorePlurals = Some(IgnorePlurals(true)) ) ) @@ -5400,17 +8897,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"ranking":["desc(post_date_timestamp)"]}""") + val expectedBody = parse("""{"queryLanguages":["es"],"removeStopWords":true,"ignorePlurals":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("ranking virtual replica33") { + test("set_indexlanguages101") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("desc(post_date_timestamp)")) + indexLanguages = Some(Seq(SupportedLanguage.withName("ja"))) ) ) @@ -5419,18 +8916,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["desc(post_date_timestamp)"]}""") + val expectedBody = parse("""{"indexLanguages":["ja"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("customRanking and ranking sort alphabetically34") { + test("enable_decompound_query_by_default102") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("asc(textual_attribute)")), - ranking = Some(Seq("custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact")) + decompoundQuery = Some(true) ) ) @@ -5439,20 +8935,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse( - """{"customRanking":["asc(textual_attribute)"],"ranking":["custom","typo","geo","words","filters","proximity","attribute","exact"]}""" - ) + val expectedBody = parse("""{"decompoundQuery":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("relevancyStrictness35") { + test("enable_rules_syntax_by_default103") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - customRanking = Some(Seq("asc(textual_attribute)")), - relevancyStrictness = Some(0) + enableRules = Some(true) ) ) @@ -5461,17 +8954,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"customRanking":["asc(textual_attribute)"],"relevancyStrictness":0}""") + val expectedBody = parse("""{"enableRules":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("create replica index36") { + test("enable_personalization_settings104") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = Some(Seq("products_price_desc")) + enablePersonalization = Some(true) ) ) @@ -5480,17 +8973,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"replicas":["products_price_desc"]}""") + val expectedBody = parse("""{"enablePersonalization":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("create virtual replica index37") { + test("set_default_query_type105") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = Some(Seq("virtual(products_price_desc)")) + queryType = Some(QueryType.withName("prefixLast")) ) ) @@ -5499,17 +8992,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"replicas":["virtual(products_price_desc)"]}""") + val expectedBody = parse("""{"queryType":"prefixLast"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("unlink replica index38") { + test("set_default_remove_words_if_no_result106") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - replicas = Some(Seq("")) + removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("none")) ) ) @@ -5518,19 +9011,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"replicas":[""]}""") + val expectedBody = parse("""{"removeWordsIfNoResults":"none"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("forwardToReplicas39") { + test("enable_advanced_syntax_by_default107") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "description")) - ), - forwardToReplicas = Some(true) + advancedSyntax = Some(true) + ) ) Await.ready(future, Duration.Inf) @@ -5538,24 +9030,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["name","description"]}""") + val expectedBody = parse("""{"advancedSyntax":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) - val expectedQuery = parse("""{"forwardToReplicas":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } } - test("maxValuesPerFacet40") { + test("set_default_optional_words108") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - maxValuesPerFacet = Some(1000) + optionalWords = Some(OptionalWords(Seq("blue", "iphone case"))) ) ) @@ -5564,17 +9049,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"maxValuesPerFacet":1000}""") + val expectedBody = parse("""{"optionalWords":["blue","iphone case"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("maxFacetHits41") { + test("disabling_prefix_search_for_some_attributes_by_default109") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - maxFacetHits = Some(1000) + disablePrefixOnAttributes = Some(Seq("sku")) ) ) @@ -5583,38 +9068,36 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"maxFacetHits":1000}""") + val expectedBody = parse("""{"disablePrefixOnAttributes":["sku"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("attributesForFaceting complex42") { + test("disabling_exact_for_some_attributes_by_default110") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "", + indexName = "theIndexName", indexSettings = IndexSettings( - attributesForFaceting = Some(Seq("actor", "filterOnly(category)", "searchable(publisher)")) + disableExactOnAttributes = Some(Seq("description")) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"attributesForFaceting":["actor","filterOnly(category)","searchable(publisher)"]}""") + val expectedBody = parse("""{"disableExactOnAttributes":["description"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("ranking closest dates43") { + test("set_default_exact_single_word_query111") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - ranking = Some( - Seq("asc(date_timestamp)", "typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom") - ) + exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")) ) ) @@ -5623,19 +9106,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse( - """{"ranking":["asc(date_timestamp)","typo","geo","words","filters","proximity","attribute","exact","custom"]}""" - ) + val expectedBody = parse("""{"exactOnSingleWordQuery":"attribute"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributes item variation44") { + test("set_default_aternative_as_exact112") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("design", "type", "color")) + alternativesAsExact = + Some(Seq(AlternativesAsExact.withName("ignorePlurals"), AlternativesAsExact.withName("singleWordSynonym"))) ) ) @@ -5644,18 +9126,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["design","type","color"]}""") + val expectedBody = parse("""{"alternativesAsExact":["ignorePlurals","singleWordSynonym"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributes around location45") { + test("enable_advanced_syntax_by_default113") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), - customRanking = Some(Seq("desc(links_count)")) + advancedSyntax = Some(true) ) ) @@ -5664,19 +9145,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = - parse("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""") + val expectedBody = parse("""{"advancedSyntax":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributes around location46") { + test("set_numeric_attributes_for_filtering114") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "country", "code", "iata_code")), - customRanking = Some(Seq("desc(links_count)")) + numericAttributesForFiltering = Some(Seq("quantity", "popularity")) ) ) @@ -5685,18 +9164,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = - parse("""{"searchableAttributes":["name","country","code","iata_code"],"customRanking":["desc(links_count)"]}""") + val expectedBody = parse("""{"numericAttributesForFiltering":["quantity","popularity"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("disableTypoToleranceOnAttributes47") { + test("enable_compression_of_integer_array115") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + allowCompressionOfIntegerArray = Some(true) ) ) @@ -5705,101 +9183,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"disableTypoToleranceOnAttributes":["serial_number"]}""") + val expectedBody = parse("""{"allowCompressionOfIntegerArray":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("everything48") { + test("set_attributes_for_distinct116") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - advancedSyntax = Some(true), - advancedSyntaxFeatures = Some(Seq(AdvancedSyntaxFeatures.withName("exactPhrase"))), - allowCompressionOfIntegerArray = Some(true), - allowTyposOnNumericTokens = Some(true), - alternativesAsExact = Some(Seq(AlternativesAsExact.withName("singleWordSynonym"))), - attributeCriteriaComputedByMinProximity = Some(true), - attributeForDistinct = Some("test"), - attributesForFaceting = Some(Seq("algolia")), - attributesToHighlight = Some(Seq("algolia")), - attributesToRetrieve = Some(Seq("algolia")), - attributesToSnippet = Some(Seq("algolia")), - attributesToTransliterate = Some(Seq("algolia")), - camelCaseAttributes = Some(Seq("algolia")), - customNormalization = Some(Map("algolia" -> Map("aloglia" -> "aglolia"))), - customRanking = Some(Seq("algolia")), - decompoundQuery = Some(false), - decompoundedAttributes = Some(JObject(List(JField("algolia", JString("aloglia"))))), - disableExactOnAttributes = Some(Seq("algolia")), - disablePrefixOnAttributes = Some(Seq("algolia")), - disableTypoToleranceOnAttributes = Some(Seq("algolia")), - disableTypoToleranceOnWords = Some(Seq("algolia")), - distinct = Some(Distinct(3)), - enablePersonalization = Some(true), - enableReRanking = Some(false), - enableRules = Some(true), - exactOnSingleWordQuery = Some(ExactOnSingleWordQuery.withName("attribute")), - highlightPreTag = Some(""), - highlightPostTag = Some(""), - hitsPerPage = Some(10), - ignorePlurals = Some(IgnorePlurals(false)), - indexLanguages = Some(Seq(SupportedLanguage.withName("fr"))), - keepDiacriticsOnCharacters = Some("abc"), - maxFacetHits = Some(20), - maxValuesPerFacet = Some(30), - minProximity = Some(6), - minWordSizefor1Typo = Some(5), - minWordSizefor2Typos = Some(11), - mode = Some(Mode.withName("neuralSearch")), - numericAttributesForFiltering = Some(Seq("algolia")), - optionalWords = Some(OptionalWords(Seq("myspace"))), - paginationLimitedTo = Some(0), - queryLanguages = Some(Seq(SupportedLanguage.withName("fr"))), - queryType = Some(QueryType.withName("prefixLast")), - ranking = Some(Seq("geo")), - reRankingApplyFilter = Some(ReRankingApplyFilter("mySearch:filters")), - relevancyStrictness = Some(10), - removeStopWords = Some(RemoveStopWords(false)), - removeWordsIfNoResults = Some(RemoveWordsIfNoResults.withName("lastWords")), - renderingContent = Some( - RenderingContent( - facetOrdering = Some( - FacetOrdering( - facets = Some( - Facets( - order = Some(Seq("a", "b")) - ) - ), - values = Some( - Map( - "a" -> Value( - order = Some(Seq("b")), - sortRemainingBy = Some(SortRemainingBy.withName("count")) - ) - ) - ) - ) - ) - ) - ), - replaceSynonymsInHighlight = Some(true), - replicas = Some(Seq("")), - responseFields = Some(Seq("algolia")), - restrictHighlightAndSnippetArrays = Some(true), - searchableAttributes = Some(Seq("foo")), - semanticSearch = Some( - SemanticSearch( - eventSources = Some(Seq("foo")) - ) - ), - separatorsToIndex = Some("bar"), - snippetEllipsisText = Some("---"), - sortFacetValuesBy = Some("date"), - typoTolerance = Some(TypoTolerance(false)), - unretrievableAttributes = Some(Seq("foo")), - userData = Some(JObject(List(JField("user", JString("data"))))) + attributeForDistinct = Some("url") ) ) @@ -5808,21 +9202,18 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse( - """{"advancedSyntax":true,"advancedSyntaxFeatures":["exactPhrase"],"allowCompressionOfIntegerArray":true,"allowTyposOnNumericTokens":true,"alternativesAsExact":["singleWordSynonym"],"attributeCriteriaComputedByMinProximity":true,"attributeForDistinct":"test","attributesForFaceting":["algolia"],"attributesToHighlight":["algolia"],"attributesToRetrieve":["algolia"],"attributesToSnippet":["algolia"],"attributesToTransliterate":["algolia"],"camelCaseAttributes":["algolia"],"customNormalization":{"algolia":{"aloglia":"aglolia"}},"customRanking":["algolia"],"decompoundQuery":false,"decompoundedAttributes":{"algolia":"aloglia"},"disableExactOnAttributes":["algolia"],"disablePrefixOnAttributes":["algolia"],"disableTypoToleranceOnAttributes":["algolia"],"disableTypoToleranceOnWords":["algolia"],"distinct":3,"enablePersonalization":true,"enableReRanking":false,"enableRules":true,"exactOnSingleWordQuery":"attribute","highlightPreTag":"","highlightPostTag":"","hitsPerPage":10,"ignorePlurals":false,"indexLanguages":["fr"],"keepDiacriticsOnCharacters":"abc","maxFacetHits":20,"maxValuesPerFacet":30,"minProximity":6,"minWordSizefor1Typo":5,"minWordSizefor2Typos":11,"mode":"neuralSearch","numericAttributesForFiltering":["algolia"],"optionalWords":["myspace"],"paginationLimitedTo":0,"queryLanguages":["fr"],"queryType":"prefixLast","ranking":["geo"],"reRankingApplyFilter":"mySearch:filters","relevancyStrictness":10,"removeStopWords":false,"removeWordsIfNoResults":"lastWords","renderingContent":{"facetOrdering":{"facets":{"order":["a","b"]},"values":{"a":{"order":["b"],"sortRemainingBy":"count"}}}},"replaceSynonymsInHighlight":true,"replicas":[""],"responseFields":["algolia"],"restrictHighlightAndSnippetArrays":true,"searchableAttributes":["foo"],"semanticSearch":{"eventSources":["foo"]},"separatorsToIndex":"bar","snippetEllipsisText":"---","sortFacetValuesBy":"date","typoTolerance":false,"unretrievableAttributes":["foo"],"userData":{"user":"data"}}""" - ) + val expectedBody = parse("""{"attributeForDistinct":"url"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributesWithCustomRankingsAndAttributesForFaceting49") { + test("set_distinct117") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("brand", "name", "categories", "unordered(description)")), - customRanking = Some(Seq("desc(popularity)")), - attributesForFaceting = Some(Seq("searchable(brand)", "type", "categories", "price")) + distinct = Some(Distinct(1)), + attributeForDistinct = Some("url") ) ) @@ -5831,19 +9222,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse( - """{"searchableAttributes":["brand","name","categories","unordered(description)"],"customRanking":["desc(popularity)"],"attributesForFaceting":["searchable(brand)","type","categories","price"]}""" - ) + val expectedBody = parse("""{"distinct":1,"attributeForDistinct":"url"}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributesProductReferenceSuffixes50") { + test("set_replace_synonyms_in_highlights118") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("name", "product_reference", "product_reference_suffixes")) + replaceSynonymsInHighlight = Some(false) ) ) @@ -5852,18 +9241,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["name","product_reference","product_reference_suffixes"]}""") + val expectedBody = parse("""{"replaceSynonymsInHighlight":false}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("queryLanguageAndIgnorePlurals51") { + test("set_min_proximity119") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - queryLanguages = Some(Seq(SupportedLanguage.withName("en"))), - ignorePlurals = Some(IgnorePlurals(true)) + minProximity = Some(1) ) ) @@ -5872,36 +9260,36 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"queryLanguages":["en"],"ignorePlurals":true}""") + val expectedBody = parse("""{"minProximity":1}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributesInMovies52") { + test("set_default_field120") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "movies", + indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("title_eng", "title_fr", "title_es")) + responseFields = Some(Seq("hits", "hitsPerPage", "nbPages", "page")) ) ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/movies/settings") + assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["title_eng","title_fr","title_es"]}""") + val expectedBody = parse("""{"responseFields":["hits","hitsPerPage","nbPages","page"]}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("disablePrefixOnAttributes53") { + test("set_max_facet_hits121") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disablePrefixOnAttributes = Some(Seq("serial_number")) + maxFacetHits = Some(10) ) ) @@ -5910,17 +9298,17 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"disablePrefixOnAttributes":["serial_number"]}""") + val expectedBody = parse("""{"maxFacetHits":10}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("disableTypoToleranceOnAttributes54") { + test("set_attribute_criteria_computed_by_min_proximity122") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - disableTypoToleranceOnAttributes = Some(Seq("serial_number")) + attributeCriteriaComputedByMinProximity = Some(true) ) ) @@ -5929,17 +9317,19 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"disableTypoToleranceOnAttributes":["serial_number"]}""") + val expectedBody = parse("""{"attributeCriteriaComputedByMinProximity":true}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributesSimpleExample55") { + test("set_user_data123") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("serial_number")) + userData = Some( + JObject(List(JField("extraData", JString("This is the custom data that you want to store in your index")))) + ) ) ) @@ -5948,17 +9338,43 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["serial_number"]}""") + val expectedBody = + parse("""{"userData":{"extraData":"This is the custom data that you want to store in your index"}}""") val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } - test("searchableAttributesSimpleExampleAlt56") { + test("set_rendering_content124") { val (client, echo) = testClient() val future = client.setSettings( indexName = "theIndexName", indexSettings = IndexSettings( - searchableAttributes = Some(Seq("serial_number", "serial_number_suffixes")) + renderingContent = Some( + RenderingContent( + facetOrdering = Some( + FacetOrdering( + facets = Some( + Facets( + order = Some(Seq("size", "brand")) + ) + ), + values = Some( + Map( + "brand" -> Value( + order = Some(Seq("uniqlo")), + hide = Some(Seq("muji")), + sortRemainingBy = Some(SortRemainingBy.withName("count")) + ), + "size" -> Value( + order = Some(Seq("S", "M", "L")), + sortRemainingBy = Some(SortRemainingBy.withName("hidden")) + ) + ) + ) + ) + ) + ) + ) ) ) @@ -5967,7 +9383,9 @@ class SearchTest extends AnyFunSuite { assert(res.path == "/1/indexes/theIndexName/settings") assert(res.method == "PUT") - val expectedBody = parse("""{"searchableAttributes":["serial_number","serial_number_suffixes"]}""") + val expectedBody = parse( + """{"renderingContent":{"facetOrdering":{"facets":{"order":["size","brand"]},"values":{"brand":{"order":["uniqlo"],"hide":["muji"],"sortRemainingBy":"count"},"size":{"order":["S","M","L"],"sortRemainingBy":"hidden"}}}}}""" + ) val actualBody = parse(res.body.get) assert(actualBody == expectedBody) } diff --git a/tests/output/swift/Tests/requests/SearchTests.swift b/tests/output/swift/Tests/requests/SearchTests.swift index d34446c228..ab913b8d38 100644 --- a/tests/output/swift/Tests/requests/SearchTests.swift +++ b/tests/output/swift/Tests/requests/SearchTests.swift @@ -5146,7 +5146,7 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// facetFiltersNeg + /// facetFiltersBook func testSearchSingleIndexTest14() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, @@ -5155,6 +5155,155 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([SearchFacetFilters.string("category:Book")]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facetFilters\":[\"category:Book\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// facetFiltersAND + func testSearchSingleIndexTest15() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("author:John Doe"), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facetFilters\":[\"category:Book\",\"author:John Doe\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// facetFiltersOR + func testSearchSingleIndexTest16() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters + .arrayOfSearchFacetFilters([SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("author:John Doe"), + ])]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facetFilters\":[[\"category:Book\",\"author:John Doe\"]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// facetFiltersCombined + func testSearchSingleIndexTest17() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetFilters: SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("author:John Doe"), + SearchFacetFilters.arrayOfSearchFacetFilters([ + SearchFacetFilters.string("category:Book"), + SearchFacetFilters.string("category:Movie"), + ]), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"facetFilters\":[\"author:John Doe\",[\"category:Book\",\"category:Movie\"]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// facetFiltersNeg + func testSearchSingleIndexTest18() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( indexName: "indexName", searchParams: SearchSearchParams @@ -5181,7 +5330,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// filtersAndFacetFilters - func testSearchSingleIndexTest15() async throws { + func testSearchSingleIndexTest19() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5217,7 +5366,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// facet author genre - func testSearchSingleIndexTest16() async throws { + func testSearchSingleIndexTest20() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5250,7 +5399,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// facet wildcard - func testSearchSingleIndexTest17() async throws { + func testSearchSingleIndexTest21() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5280,7 +5429,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// maxValuesPerFacet - func testSearchSingleIndexTest18() async throws { + func testSearchSingleIndexTest22() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5310,7 +5459,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// aroundLatLng - func testSearchSingleIndexTest19() async throws { + func testSearchSingleIndexTest23() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5341,7 +5490,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// aroundLatLngViaIP - func testSearchSingleIndexTest20() async throws { + func testSearchSingleIndexTest24() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5371,7 +5520,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// aroundRadius - func testSearchSingleIndexTest21() async throws { + func testSearchSingleIndexTest25() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5404,7 +5553,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// insideBoundingBox - func testSearchSingleIndexTest22() async throws { + func testSearchSingleIndexTest26() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5445,7 +5594,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// insidePolygon - func testSearchSingleIndexTest23() async throws { + func testSearchSingleIndexTest27() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5490,7 +5639,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// insidePolygon - func testSearchSingleIndexTest24() async throws { + func testSearchSingleIndexTest28() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5535,7 +5684,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// optionalFilters - func testSearchSingleIndexTest25() async throws { + func testSearchSingleIndexTest29() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5569,7 +5718,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// optionalFiltersMany - func testSearchSingleIndexTest26() async throws { + func testSearchSingleIndexTest30() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5609,7 +5758,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// optionalFiltersSimple - func testSearchSingleIndexTest27() async throws { + func testSearchSingleIndexTest31() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5646,7 +5795,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// restrictSearchableAttributes - func testSearchSingleIndexTest28() async throws { + func testSearchSingleIndexTest32() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5677,7 +5826,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// getRankingInfo - func testSearchSingleIndexTest29() async throws { + func testSearchSingleIndexTest33() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5707,7 +5856,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// clickAnalytics - func testSearchSingleIndexTest30() async throws { + func testSearchSingleIndexTest34() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5737,7 +5886,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// clickAnalyticsUserToken - func testSearchSingleIndexTest31() async throws { + func testSearchSingleIndexTest35() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5770,7 +5919,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// enablePersonalization - func testSearchSingleIndexTest32() async throws { + func testSearchSingleIndexTest36() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5803,7 +5952,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// userToken - func testSearchSingleIndexTest33() async throws { + func testSearchSingleIndexTest37() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5832,8 +5981,41 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } + /// userToken1234 + func testSearchSingleIndexTest38() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "user-1234" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"userToken\":\"user-1234\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + /// analyticsTag - func testSearchSingleIndexTest34() async throws { + func testSearchSingleIndexTest39() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5864,7 +6046,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// facetFiltersUsers - func testSearchSingleIndexTest35() async throws { + func testSearchSingleIndexTest40() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5901,7 +6083,7 @@ final class SearchClientRequestsTests: XCTestCase { } /// buildTheQuery - func testSearchSingleIndexTest36() async throws { + func testSearchSingleIndexTest41() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5936,8 +6118,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchSynonyms with minimal parameters - func testSearchSynonymsTest() async throws { + /// attributesToHighlightOverride + func testSearchSingleIndexTest42() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5945,26 +6127,33 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) - let response = try await client.searchSynonymsWithHTTPInfo(indexName: "indexName") + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToHighlight: ["title", "content"] + )) + ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{}".data(using: .utf8) + let expectedBodyData = "{\"query\":\"query\",\"attributesToHighlight\":[\"title\",\"content\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/synonyms/search") + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") XCTAssertEqual(echoResponse.method, HTTPMethod.post) XCTAssertNil(echoResponse.queryParameters) } - /// searchSynonyms with all parameters - func testSearchSynonymsTest1() async throws { + /// disableTypoToleranceOnAttributes + func testSearchSingleIndexTest43() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -5972,14 +6161,12 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) - let response = try await client.searchSynonymsWithHTTPInfo( + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( indexName: "indexName", - searchSynonymsParams: SearchSynonymsParams( - query: "myQuery", - type: SynonymType.altcorrection1, - page: 10, - hitsPerPage: 10 - ) + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + disableTypoToleranceOnAttributes: ["serial_number"] + )) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -5987,20 +6174,20 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}" + let expectedBodyData = "{\"query\":\"query\",\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}" .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/synonyms/search") + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") XCTAssertEqual(echoResponse.method, HTTPMethod.post) XCTAssertNil(echoResponse.queryParameters) } - /// searchUserIds - func testSearchUserIdsTest() async throws { + /// search_a_query + func testSearchSingleIndexTest44() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6008,32 +6195,29 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) - let response = try await client.searchUserIdsWithHTTPInfo(searchUserIdsParams: SearchUserIdsParams( - query: "test", - clusterName: "theClusterName", - page: 5, - hitsPerPage: 10 - )) + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "shirt")) + ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}" - .data(using: .utf8) + let expectedBodyData = "{\"query\":\"shirt\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/clusters/mapping/search") + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") XCTAssertEqual(echoResponse.method, HTTPMethod.post) XCTAssertNil(echoResponse.queryParameters) } - /// get setDictionarySettings results with minimal parameters - func testSetDictionarySettingsTest() async throws { + /// search_everything + func testSearchSingleIndexTest45() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6041,28 +6225,2943 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) - let response = try await client - .setDictionarySettingsWithHTTPInfo( - dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries(plurals: [ - "fr": false, - "en": false, - "ru": true, - ])) - ) + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "")) + ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}" - .data(using: .utf8) + let expectedBodyData = "{\"query\":\"\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/dictionaries/*/settings") - XCTAssertEqual(echoResponse.method, HTTPMethod.put) + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// api_filtering_range_example + func testSearchSingleIndexTest46() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "books", + filters: "price:10 TO 20" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"books\",\"filters\":\"price:10 TO 20\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_a_query + func testSearchSingleIndexTest47() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + similarQuery: "Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen", + filters: "year:1991 TO 2001" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"\",\"similarQuery\":\"Comedy Drama Crime McDormand Macy Buscemi Stormare Presnell Coen\",\"filters\":\"year:1991 TO 2001\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_retrievable_attributes + func testSearchSingleIndexTest48() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToRetrieve: ["title", "content"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"attributesToRetrieve\":[\"title\",\"content\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// restrict_searchable_attributes + func testSearchSingleIndexTest49() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + restrictSearchableAttributes: ["title", "author"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"restrictSearchableAttributes\":[\"title\",\"author\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_relevancy + func testSearchSingleIndexTest50() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + relevancyStrictness: 70 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"relevancyStrictness\":70}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_filters + func testSearchSingleIndexTest51() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "(category:Book OR category:Ebook) AND _tags:published" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"filters\":\"(category:Book OR category:Ebook) AND _tags:published\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_all_filters + func testSearchSingleIndexTest52() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + 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\"" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"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\\\"\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// escape_spaces + func testSearchSingleIndexTest53() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "category:\"Books and Comics\"" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"filters\":\"category:\\\"Books and Comics\\\"\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// escape_keywords + func testSearchSingleIndexTest54() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "keyword:\"OR\"" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"filters\":\"keyword:\\\"OR\\\"\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// escape_single_quotes + func testSearchSingleIndexTest55() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "content:\"It's a wonderful day\"" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"filters\":\"content:\\\"It's a wonderful day\\\"\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// escape_double_quotes + func testSearchSingleIndexTest56() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + filters: "content:\"She said \"Hello World\"" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"filters\":\"content:\\\"She said \\\"Hello World\\\"\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_filters + func testSearchSingleIndexTest57() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalFilters: SearchOptionalFilters.arrayOfSearchOptionalFilters([ + SearchOptionalFilters.string("category:Book"), + SearchOptionalFilters.string("author:John Doe"), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:John Doe\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_negative_filters + func testSearchSingleIndexTest58() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalFilters: SearchOptionalFilters.arrayOfSearchOptionalFilters([ + SearchOptionalFilters.string("category:Book"), + SearchOptionalFilters.string("author:-John Doe"), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"optionalFilters\":[\"category:Book\",\"author:-John Doe\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_numeric_filters + func testSearchSingleIndexTest59() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + numericFilters: SearchNumericFilters.arrayOfSearchNumericFilters([ + SearchNumericFilters.string("price < 1000"), + SearchNumericFilters.arrayOfSearchNumericFilters([ + SearchNumericFilters.string("inStock = 1"), + SearchNumericFilters.string("deliveryDate < 1441755506"), + ]), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"numericFilters\":[\"price < 1000\",[\"inStock = 1\",\"deliveryDate < 1441755506\"]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_tag_filters + func testSearchSingleIndexTest60() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + tagFilters: SearchTagFilters.arrayOfSearchTagFilters([ + SearchTagFilters.string("SciFi"), + SearchTagFilters.arrayOfSearchTagFilters([ + SearchTagFilters.string("Book"), + SearchTagFilters.string("Movie"), + ]), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"tagFilters\":[\"SciFi\",[\"Book\",\"Movie\"]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// apply_filters + func testSearchSingleIndexTest61() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + sumOrFiltersScores: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"sumOrFiltersScores\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// facets_all + func testSearchSingleIndexTest62() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facets: ["*"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facets\":[\"*\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// retrieve_only_some_facets + func testSearchSingleIndexTest63() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facets: ["category", "author"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facets\":[\"category\",\"author\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_max_values_per_facet + func testSearchSingleIndexTest64() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + maxValuesPerFacet: 20 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"maxValuesPerFacet\":20}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_faceting_after_distinct + func testSearchSingleIndexTest65() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + facetingAfterDistinct: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"facetingAfterDistinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// sort_facet_values_alphabetically + func testSearchSingleIndexTest66() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + sortFacetValuesBy: "count" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"sortFacetValuesBy\":\"count\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_attributes_to_snippet + func testSearchSingleIndexTest67() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + attributesToSnippet: ["title", "content:80"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"attributesToSnippet\":[\"title\",\"content:80\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_highlight_pre_tag + func testSearchSingleIndexTest68() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + highlightPreTag: "" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"highlightPreTag\":\"\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_highlight_post_tag + func testSearchSingleIndexTest69() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + highlightPostTag: "" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"highlightPostTag\":\"\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_snippet_ellipsis_text + func testSearchSingleIndexTest70() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + snippetEllipsisText: "" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"snippetEllipsisText\":\"\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_restrict_highlight_and_snippet_arrays + func testSearchSingleIndexTest71() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + restrictHighlightAndSnippetArrays: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"restrictHighlightAndSnippetArrays\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// access_page + func testSearchSingleIndexTest72() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "query", page: 0)) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"page\":0}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_hits_per_page + func testSearchSingleIndexTest73() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + hitsPerPage: 10 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"hitsPerPage\":10}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// get_nth_hit + func testSearchSingleIndexTest74() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + offset: 4 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"offset\":4}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// get_n_results + func testSearchSingleIndexTest75() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + length: 4 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"length\":4}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_min_word_size_for_one_typo + func testSearchSingleIndexTest76() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minWordSizefor1Typo: 2 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"minWordSizefor1Typo\":2}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_min_word_size_for_two_typos + func testSearchSingleIndexTest77() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minWordSizefor2Typos: 2 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"minWordSizefor2Typos\":2}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_typo_tolerance_mode + func testSearchSingleIndexTest78() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + typoTolerance: SearchTypoTolerance.bool(false) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"typoTolerance\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disable_typos_on_numeric_tokens_at_search_time + func testSearchSingleIndexTest79() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + allowTyposOnNumericTokens: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"allowTyposOnNumericTokens\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_around_a_position + func testSearchSingleIndexTest80() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundLatLng: "40.71, -74.01" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"aroundLatLng\":\"40.71, -74.01\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_around_server_ip + func testSearchSingleIndexTest81() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundLatLngViaIP: true + )), + requestOptions: RequestOptions( + headers: [ + "x-forwarded-for": "94.228.178.246 // should be replaced with the actual IP you would like to search around", + ] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"aroundLatLngViaIP\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + + let expectedHeaders = + try XCTUnwrap( + "{\"x-forwarded-for\":\"94.228.178.246 // should be replaced with the actual IP you would like to search around\"}" + .data(using: .utf8) + ) + let expectedHeadersMap = try CodableHelper.jsonDecoder.decode([String: String?].self, from: expectedHeaders) + + let echoResponseHeaders = try XCTUnwrap(echoResponse.headers) + for header in expectedHeadersMap { + XCTAssertEqual(echoResponseHeaders[header.key.capitalized], header.value) + } + } + + /// set_around_radius + func testSearchSingleIndexTest82() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundRadius: SearchAroundRadius.int(1000) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"aroundRadius\":1000}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disable_automatic_radius + func testSearchSingleIndexTest83() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundRadius: SearchAroundRadius.searchAroundRadiusAll(SearchAroundRadiusAll.all) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"aroundRadius\":\"all\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_geo_search_precision + func testSearchSingleIndexTest84() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundPrecision: SearchAroundPrecision.int(100) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"aroundPrecision\":100}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_geo_search_precision_non_linear + func testSearchSingleIndexTest85() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + aroundPrecision: SearchAroundPrecision.arrayOfSearchRange([ + SearchRange(from: 0, value: 25), + SearchRange(from: 2000, value: 1000), + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"aroundPrecision\":[{\"from\":0,\"value\":25},{\"from\":2000,\"value\":1000}]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_minimum_geo_search_radius + func testSearchSingleIndexTest86() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minimumAroundRadius: 1000 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"minimumAroundRadius\":1000}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_inside_rectangular_area + func testSearchSingleIndexTest87() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([[ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + ]]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_inside_multiple_rectangular_areas + func testSearchSingleIndexTest88() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insideBoundingBox: SearchInsideBoundingBox.arrayOfArrayOfDouble([ + [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625], + [49.62625916704081, 4.6181640625, 47.715070300900194, 0.482421875], + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"insideBoundingBox\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625],[49.62625916704081,4.6181640625,47.715070300900194,0.482421875]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_inside_polygon_area + func testSearchSingleIndexTest89() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + insidePolygon: [[ + 46.650828100116044, + 7.123046875, + 45.17210966999772, + 1.009765625, + 49.62625916704081, + 4.6181640625, + ]] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"insidePolygon\":[[46.650828100116044,7.123046875,45.17210966999772,1.009765625,49.62625916704081,4.6181640625]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// search_inside_multiple_polygon_areas + func testSearchSingleIndexTest90() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + 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, + ], + ] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"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]]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_querylanguages_override + func testSearchSingleIndexTest91() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + ignorePlurals: SearchIgnorePlurals.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"ignorePlurals\":[\"ca\",\"es\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_querylanguages_override + func testSearchSingleIndexTest92() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeStopWords: SearchRemoveStopWords.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_querylanguages_override + func testSearchSingleIndexTest93() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeStopWords: SearchRemoveStopWords.arrayOfSearchSupportedLanguage([ + SearchSupportedLanguage.ca, + SearchSupportedLanguage.es, + ]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"removeStopWords\":[\"ca\",\"es\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_querylanguages_with_japanese_query + func testSearchSingleIndexTest94() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + queryLanguages: [SearchSupportedLanguage.ja, SearchSupportedLanguage.en] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"queryLanguages\":[\"ja\",\"en\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_natural_languages + func testSearchSingleIndexTest95() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + naturalLanguages: [SearchSupportedLanguage.fr] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"\",\"naturalLanguages\":[\"fr\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_natural_languages_with_query + func testSearchSingleIndexTest96() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "", + naturalLanguages: [SearchSupportedLanguage.fr], + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.firstWords + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"\",\"naturalLanguages\":[\"fr\"],\"removeWordsIfNoResults\":\"firstWords\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_decompound_query_search_time + func testSearchSingleIndexTest97() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + decompoundQuery: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"decompoundQuery\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_rules_search_time + func testSearchSingleIndexTest98() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableRules: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enableRules\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_rule_contexts + func testSearchSingleIndexTest99() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + ruleContexts: ["front_end", "website2"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"ruleContexts\":[\"front_end\",\"website2\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_personalization + func testSearchSingleIndexTest100() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enablePersonalization: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enablePersonalization\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_personalization_with_user_token + func testSearchSingleIndexTest101() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456", + enablePersonalization: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// personalization_impact + func testSearchSingleIndexTest102() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + personalizationImpact: 20 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"personalizationImpact\":20}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_user_token + func testSearchSingleIndexTest103() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456" + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"userToken\":\"123456\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_user_token_with_personalization + func testSearchSingleIndexTest104() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + userToken: "123456", + enablePersonalization: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enablePersonalization\":true,\"userToken\":\"123456\"}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_query_type + func testSearchSingleIndexTest105() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + queryType: SearchQueryType.prefixAll + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"queryType\":\"prefixAll\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_remove_words_if_no_results + func testSearchSingleIndexTest106() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"removeWordsIfNoResults\":\"lastWords\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_advanced_syntax_search_time + func testSearchSingleIndexTest107() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"advancedSyntax\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// overide_default_optional_words + func testSearchSingleIndexTest108() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + optionalWords: SearchOptionalWords.arrayOfString(["toyota", "2020 2021"]) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"optionalWords\":[\"toyota\",\"2020 2021\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disabling_exact_for_some_attributes_search_time + func testSearchSingleIndexTest109() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + disableExactOnAttributes: ["description"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"disableExactOnAttributes\":[\"description\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_exact_single_word_query + func testSearchSingleIndexTest110() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + exactOnSingleWordQuery: SearchExactOnSingleWordQuery.`none` + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"exactOnSingleWordQuery\":\"none\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_aternative_as_exact + func testSearchSingleIndexTest111() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + alternativesAsExact: [SearchAlternativesAsExact.multiWordsSynonym] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"alternativesAsExact\":[\"multiWordsSynonym\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_advanced_syntax_exact_phrase + func testSearchSingleIndexTest112() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_advanced_syntax_exclude_words + func testSearchSingleIndexTest113() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + advancedSyntax: true, + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.excludeWords] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"query\":\"query\",\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"excludeWords\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_distinct + func testSearchSingleIndexTest114() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + distinct: SearchDistinct.int(0) + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"distinct\":0}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// get_ranking_info + func testSearchSingleIndexTest115() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + getRankingInfo: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"getRankingInfo\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disable_click_analytics + func testSearchSingleIndexTest116() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + clickAnalytics: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"clickAnalytics\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// enable_click_analytics + func testSearchSingleIndexTest117() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + clickAnalytics: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"clickAnalytics\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disable_analytics + func testSearchSingleIndexTest118() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + analytics: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"analytics\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// add_analytics_tags + func testSearchSingleIndexTest119() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + analyticsTags: ["front_end", "website2"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"analyticsTags\":[\"front_end\",\"website2\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disable_synonyms + func testSearchSingleIndexTest120() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + synonyms: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"synonyms\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_replace_synonyms_in_highlights + func testSearchSingleIndexTest121() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + replaceSynonymsInHighlight: true + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"replaceSynonymsInHighlight\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_min_proximity + func testSearchSingleIndexTest122() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + minProximity: 2 + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"minProximity\":2}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_default_field + func testSearchSingleIndexTest123() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + responseFields: ["hits", "facets"] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"responseFields\":[\"hits\",\"facets\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// override_percentile_computation + func testSearchSingleIndexTest124() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + percentileComputation: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"percentileComputation\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_ab_test + func testSearchSingleIndexTest125() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableABTest: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enableABTest\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_enable_re_ranking + func testSearchSingleIndexTest126() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response: Response> = try await client.searchSingleIndexWithHTTPInfo( + indexName: "indexName", + searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject( + query: "query", + enableReRanking: false + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"query\",\"enableReRanking\":false}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/query") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchSynonyms with minimal parameters + func testSearchSynonymsTest() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.searchSynonymsWithHTTPInfo(indexName: "indexName") + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/synonyms/search") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchSynonyms with all parameters + func testSearchSynonymsTest1() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.searchSynonymsWithHTTPInfo( + indexName: "indexName", + searchSynonymsParams: SearchSynonymsParams( + query: "myQuery", + type: SynonymType.altcorrection1, + page: 10, + hitsPerPage: 10 + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"myQuery\",\"type\":\"altcorrection1\",\"page\":10,\"hitsPerPage\":10}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/indexName/synonyms/search") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchUserIds + func testSearchUserIdsTest() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.searchUserIdsWithHTTPInfo(searchUserIdsParams: SearchUserIdsParams( + query: "test", + clusterName: "theClusterName", + page: 5, + hitsPerPage: 10 + )) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/clusters/mapping/search") + XCTAssertEqual(echoResponse.method, HTTPMethod.post) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// get setDictionarySettings results with minimal parameters + func testSetDictionarySettingsTest() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client + .setDictionarySettingsWithHTTPInfo( + dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries(plurals: [ + "fr": false, + "en": false, + "ru": true, + ])) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/dictionaries/*/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } @@ -6076,14 +9175,2122 @@ final class SearchClientRequestsTests: XCTestCase { let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) let client = SearchClient(configuration: configuration, transporter: transporter) - let response = try await client - .setDictionarySettingsWithHTTPInfo( - dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries( - plurals: ["fr": false, "en": false, "ru": true], - stopwords: ["fr": false], - compounds: ["ru": true] - )) - ) + let response = try await client + .setDictionarySettingsWithHTTPInfo( + dictionarySettingsParams: DictionarySettingsParams(disableStandardEntries: StandardEntries( + plurals: ["fr": false, "en": false, "ru": true], + stopwords: ["fr": false], + compounds: ["ru": true] + )) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/dictionaries/*/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// minimal parameters + func testSetSettingsTest() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "cts_e2e_settings", + indexSettings: IndexSettings(paginationLimitedTo: 10), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"paginationLimitedTo\":10}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/cts_e2e_settings/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// boolean typoTolerance + func testSetSettingsTest1() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"typoTolerance\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// enum typoTolerance + func testSetSettingsTest2() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + typoTolerance: SearchTypoTolerance + .searchTypoToleranceEnum(SearchTypoToleranceEnum.min) + ), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"typoTolerance\":\"min\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// ignorePlurals + func testSetSettingsTest3() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ignorePlurals: SearchIgnorePlurals.bool(true)), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"ignorePlurals\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// list of string ignorePlurals + func testSetSettingsTest4() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals + .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) + ), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"ignorePlurals\":[\"fr\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// removeStopWords boolean + func testSetSettingsTest5() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(removeStopWords: SearchRemoveStopWords.bool(true)), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"removeStopWords\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// removeStopWords list of string + func testSetSettingsTest6() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + removeStopWords: SearchRemoveStopWords + .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) + ), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"removeStopWords\":[\"fr\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// boolean distinct + func testSetSettingsTest7() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"distinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// integer distinct + func testSetSettingsTest8() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(distinct: SearchDistinct.int(1)), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"distinct\":1}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// distinct company + func testSetSettingsTest9() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributeForDistinct: "company", distinct: SearchDistinct.bool(true)) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributeForDistinct\":\"company\",\"distinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// distinct design + func testSetSettingsTest10() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributeForDistinct: "design", distinct: SearchDistinct.bool(true)) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributeForDistinct\":\"design\",\"distinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// distinct true + func testSetSettingsTest11() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"distinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// distinct section + func testSetSettingsTest12() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributeForDistinct: "section", distinct: SearchDistinct.bool(true)) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributeForDistinct\":\"section\",\"distinct\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting allergens + func testSetSettingsTest13() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["allergens"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"allergens\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// api_attributes_for_faceting + func testSetSettingsTest14() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["genre", "author"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"genre\",\"author\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// api_attributes_for_faceting_searchable + func testSetSettingsTest15() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["genre", "searchable(author)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"genre\",\"searchable(author)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// api_attributes_for_filter_only + func testSetSettingsTest16() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(genre)", "author"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"filterOnly(genre)\",\"author\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting categoryPageId + func testSetSettingsTest17() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["searchable(categoryPageId)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// unretrievableAttributes + func testSetSettingsTest18() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(unretrievableAttributes: ["visible_by"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"unretrievableAttributes\":[\"visible_by\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting user restricted data + func testSetSettingsTest19() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(visible_by)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting optional filters + func testSetSettingsTest20() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["can_deliver_quickly", "restaurant"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting redirect index + func testSetSettingsTest21() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["query_terms"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"query_terms\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting multiple consequences + func testSetSettingsTest22() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["director"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"director\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting in-depth optional filters + func testSetSettingsTest23() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(brand)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesForFaceting\":[\"filterOnly(brand)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// mode neuralSearch + func testSetSettingsTest24() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(mode: SearchMode.neuralSearch) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"mode\":\"neuralSearch\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// mode keywordSearch + func testSetSettingsTest25() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(mode: SearchMode.keywordSearch) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"mode\":\"keywordSearch\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributes same priority + func testSetSettingsTest26() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["title,comments", "ingredients"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributes higher priority + func testSetSettingsTest27() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["title", "ingredients"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"title\",\"ingredients\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking retweets + func testSetSettingsTest28() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(retweets)", "desc(likes)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking boosted + func testSetSettingsTest29() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(boosted)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(boosted)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking pageviews + func testSetSettingsTest30() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(pageviews)", "desc(comments)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking applying search parameters for a specific query + func testSetSettingsTest31() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesForFaceting: ["city, country"], + customRanking: ["desc(nb_airline_liaisons)"] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking rounded pageviews + func testSetSettingsTest32() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(rounded_pageviews)", "desc(comments)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking price + func testSetSettingsTest33() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(price)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(price)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// ranking exhaustive + func testSetSettingsTest34() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// ranking standard replica + func testSetSettingsTest35() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ranking: ["desc(post_date_timestamp)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"ranking\":[\"desc(post_date_timestamp)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// ranking virtual replica + func testSetSettingsTest36() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["desc(post_date_timestamp)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"desc(post_date_timestamp)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// customRanking and ranking sort alphabetically + func testSetSettingsTest37() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + customRanking: ["asc(textual_attribute)"], + ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// relevancyStrictness + func testSetSettingsTest38() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customRanking: ["asc(textual_attribute)"], relevancyStrictness: 0) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// create replica index + func testSetSettingsTest39() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(replicas: ["products_price_desc"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"replicas\":[\"products_price_desc\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// create replica index articles + func testSetSettingsTest40() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(replicas: ["articles_date_desc"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"replicas\":[\"articles_date_desc\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// create virtual replica index + func testSetSettingsTest41() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(replicas: ["virtual(products_price_desc)"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"replicas\":[\"virtual(products_price_desc)\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// unlink replica index + func testSetSettingsTest42() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(replicas: [""]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"replicas\":[\"\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// forwardToReplicas + func testSetSettingsTest43() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["name", "description"]), + forwardToReplicas: true + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"name\",\"description\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) + let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( + [String: String?].self, + from: expectedQueryParameters + ) + + XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + } + + /// maxValuesPerFacet + func testSetSettingsTest44() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(maxValuesPerFacet: 1000) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"maxValuesPerFacet\":1000}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// maxFacetHits + func testSetSettingsTest45() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(maxFacetHits: 1000) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"maxFacetHits\":1000}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesForFaceting complex + func testSetSettingsTest46() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "", + indexSettings: IndexSettings(attributesForFaceting: [ + "actor", + "filterOnly(category)", + "searchable(publisher)", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// ranking closest dates + func testSetSettingsTest47() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ranking: [ + "asc(date_timestamp)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributes item variation + func testSetSettingsTest48() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["design", "type", "color"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributes around location + func testSetSettingsTest49() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + searchableAttributes: ["name", "country", "code", "iata_code"], + customRanking: ["desc(links_count)"] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesToHighlight + func testSetSettingsTest50() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributesToHighlight: ["author", "title", "content"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesToHighlight\":[\"author\",\"title\",\"content\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// attributesToHighlightStar + func testSetSettingsTest51() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributesToHighlight: ["*"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesToHighlight\":[\"*\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// everything + func testSetSettingsTest52() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesForFaceting: ["algolia"], + replicas: [""], + paginationLimitedTo: 0, + unretrievableAttributes: ["foo"], + disableTypoToleranceOnWords: ["algolia"], + attributesToTransliterate: ["algolia"], + camelCaseAttributes: ["algolia"], + decompoundedAttributes: ["algolia": "aloglia"], + indexLanguages: [SearchSupportedLanguage.fr], + disablePrefixOnAttributes: ["algolia"], + allowCompressionOfIntegerArray: true, + numericAttributesForFiltering: ["algolia"], + separatorsToIndex: "bar", + searchableAttributes: ["foo"], + userData: ["user": "data"], + customNormalization: ["algolia": ["aloglia": "aglolia"]], + attributeForDistinct: "test", + maxFacetHits: 20, + keepDiacriticsOnCharacters: "abc", + customRanking: ["algolia"], + attributesToRetrieve: ["algolia"], + ranking: ["geo"], + relevancyStrictness: 10, + attributesToHighlight: ["algolia"], + attributesToSnippet: ["algolia"], + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "---", + restrictHighlightAndSnippetArrays: true, + hitsPerPage: 10, + minWordSizefor1Typo: 5, + minWordSizefor2Typos: 11, + typoTolerance: SearchTypoTolerance.bool(false), + allowTyposOnNumericTokens: true, + disableTypoToleranceOnAttributes: ["algolia"], + ignorePlurals: SearchIgnorePlurals.bool(false), + removeStopWords: SearchRemoveStopWords.bool(false), + queryLanguages: [SearchSupportedLanguage.fr], + decompoundQuery: false, + enableRules: true, + enablePersonalization: true, + queryType: SearchQueryType.prefixLast, + removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords, + mode: SearchMode.neuralSearch, + semanticSearch: SearchSemanticSearch(eventSources: ["foo"]), + advancedSyntax: true, + optionalWords: SearchOptionalWords.arrayOfString(["myspace"]), + disableExactOnAttributes: ["algolia"], + exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute, + alternativesAsExact: [SearchAlternativesAsExact.singleWordSynonym], + advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase], + distinct: SearchDistinct.int(3), + replaceSynonymsInHighlight: true, + minProximity: 6, + responseFields: ["algolia"], + maxValuesPerFacet: 30, + sortFacetValuesBy: "date", + attributeCriteriaComputedByMinProximity: true, + renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( + facets: SearchFacets(order: ["a", "b"]), + values: ["a": SearchValue(order: ["b"], sortRemainingBy: SearchSortRemainingBy.count)] + )), + enableReRanking: false, + reRankingApplyFilter: SearchReRankingApplyFilter.string("mySearch:filters") + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesWithCustomRankingsAndAttributesForFaceting + func testSetSettingsTest53() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + attributesForFaceting: ["searchable(brand)", "type", "categories", "price"], + searchableAttributes: ["brand", "name", "categories", "unordered(description)"], + customRanking: ["desc(popularity)"] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesOrdering + func testSetSettingsTest54() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["unordered(title)", "cast"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"unordered(title)\",\"cast\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesProductReferenceSuffixes + func testSetSettingsTest55() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: [ + "name", + "product_reference", + "product_reference_suffixes", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// queryLanguageAndIgnorePlurals + func testSetSettingsTest56() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + queryLanguages: [SearchSupportedLanguage.en] + ) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesInMovies + func testSetSettingsTest57() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "movies", + indexSettings: IndexSettings(searchableAttributes: ["title_eng", "title_fr", "title_es"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/movies/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disablePrefixOnAttributes + func testSetSettingsTest58() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(disablePrefixOnAttributes: ["serial_number"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"disablePrefixOnAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// disableTypoToleranceOnAttributes + func testSetSettingsTest59() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesSimpleExample + func testSetSettingsTest60() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["serial_number"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// searchableAttributesSimpleExampleAlt + func testSetSettingsTest61() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: ["serial_number", "serial_number_suffixes"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_searchable_attributes + func testSetSettingsTest62() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(searchableAttributes: [ + "title,alternative_title", + "author", + "unordered(text)", + "emails.personal", + ]) + ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6091,20 +11298,20 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) let expectedBodyData = - "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}" + "{\"searchableAttributes\":[\"title,alternative_title\",\"author\",\"unordered(text)\",\"emails.personal\"]}" .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/dictionaries/*/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// minimal parameters - func testSetSettingsTest() async throws { + /// set_searchable_attributes + func testSetSettingsTest63() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6113,9 +11320,14 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "cts_e2e_settings", - indexSettings: IndexSettings(paginationLimitedTo: 10), - forwardToReplicas: true + indexName: "theIndexName", + indexSettings: IndexSettings(attributesForFaceting: [ + "author", + "filterOnly(isbn)", + "searchable(edition)", + "afterDistinct(category)", + "afterDistinct(searchable(publisher))", + ]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6123,25 +11335,51 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"paginationLimitedTo\":10}".data(using: .utf8) + let expectedBodyData = + "{\"attributesForFaceting\":[\"author\",\"filterOnly(isbn)\",\"searchable(edition)\",\"afterDistinct(category)\",\"afterDistinct(searchable(publisher))\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/cts_e2e_settings/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters + XCTAssertNil(echoResponse.queryParameters) + } + + /// unretrievable_attributes + func testSetSettingsTest64() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(unretrievableAttributes: ["total_number_of_sales"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"unretrievableAttributes\":[\"total_number_of_sales\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) } - /// boolean typoTolerance - func testSetSettingsTest1() async throws { + /// set_retrievable_attributes + func testSetSettingsTest65() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6151,8 +11389,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(attributesToRetrieve: ["author", "title", "content"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6160,7 +11397,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"typoTolerance\":true}".data(using: .utf8) + let expectedBodyData = "{\"attributesToRetrieve\":[\"author\",\"title\",\"content\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6168,17 +11405,41 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_all_attributes_as_retrievable + func testSetSettingsTest66() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(attributesToRetrieve: ["*"]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"attributesToRetrieve\":[\"*\"]}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) } - /// enum typoTolerance - func testSetSettingsTest2() async throws { + /// specify_attributes_not_to_retrieve + func testSetSettingsTest67() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6188,11 +11449,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - typoTolerance: SearchTypoTolerance - .searchTypoToleranceEnum(SearchTypoToleranceEnum.min) - ), - forwardToReplicas: true + indexSettings: IndexSettings(attributesToRetrieve: ["*", "-SKU", "-internal_desc"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6200,7 +11457,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"typoTolerance\":\"min\"}".data(using: .utf8) + let expectedBodyData = "{\"attributesToRetrieve\":[\"*\",\"-SKU\",\"-internal_desc\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6208,17 +11465,41 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters + XCTAssertNil(echoResponse.queryParameters) + } + + /// neural_search + func testSetSettingsTest68() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(mode: SearchMode.neuralSearch) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = "{\"mode\":\"neuralSearch\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) } - /// ignorePlurals - func testSetSettingsTest3() async throws { + /// keyword_search + func testSetSettingsTest69() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6228,8 +11509,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(ignorePlurals: SearchIgnorePlurals.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(mode: SearchMode.keywordSearch) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6237,7 +11517,90 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"ignorePlurals\":true}".data(using: .utf8) + let expectedBodyData = "{\"mode\":\"keywordSearch\"}".data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_default_ranking + func testSetSettingsTest70() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ranking: [ + "typo", + "geo", + "words", + "filters", + "attribute", + "proximity", + "exact", + "custom", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"ranking\":[\"typo\",\"geo\",\"words\",\"filters\",\"attribute\",\"proximity\",\"exact\",\"custom\"]}" + .data(using: .utf8) + let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) + + XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) + + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") + XCTAssertEqual(echoResponse.method, HTTPMethod.put) + + XCTAssertNil(echoResponse.queryParameters) + } + + /// set_ranking_by_attribute_asc + func testSetSettingsTest71() async throws { + let configuration = try SearchClientConfiguration( + appID: SearchClientRequestsTests.APPLICATION_ID, + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(ranking: [ + "asc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) + ) + let responseBodyData = try XCTUnwrap(response.bodyData) + let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) + + let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) + let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) + + let expectedBodyData = + "{\"ranking\":[\"asc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6245,17 +11608,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// list of string ignorePlurals - func testSetSettingsTest4() async throws { + /// set_ranking_by_attribute_desc + func testSetSettingsTest72() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6265,11 +11622,17 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - ignorePlurals: SearchIgnorePlurals - .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) - ), - forwardToReplicas: true + indexSettings: IndexSettings(ranking: [ + "desc(price)", + "typo", + "geo", + "words", + "filters", + "proximity", + "attribute", + "exact", + "custom", + ]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6277,7 +11640,9 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"ignorePlurals\":[\"fr\"]}".data(using: .utf8) + let expectedBodyData = + "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6285,17 +11650,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// removeStopWords boolean - func testSetSettingsTest5() async throws { + /// restrict_searchable_attributes + func testSetSettingsTest73() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6305,8 +11664,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(removeStopWords: SearchRemoveStopWords.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(customRanking: ["desc(popularity)", "asc(price)"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6314,7 +11672,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"removeStopWords\":true}".data(using: .utf8) + let expectedBodyData = "{\"customRanking\":[\"desc(popularity)\",\"asc(price)\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6322,17 +11680,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// removeStopWords list of string - func testSetSettingsTest6() async throws { + /// set_default_relevancy + func testSetSettingsTest74() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6342,11 +11694,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - removeStopWords: SearchRemoveStopWords - .arrayOfSearchSupportedLanguage([SearchSupportedLanguage.fr]) - ), - forwardToReplicas: true + indexSettings: IndexSettings(relevancyStrictness: 90) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6354,7 +11702,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"removeStopWords\":[\"fr\"]}".data(using: .utf8) + let expectedBodyData = "{\"relevancyStrictness\":90}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6362,17 +11710,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// boolean distinct - func testSetSettingsTest7() async throws { + /// set_replicas + func testSetSettingsTest75() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6382,8 +11724,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)), - forwardToReplicas: true + indexSettings: IndexSettings(replicas: ["name_of_replica_index1", "name_of_replica_index2"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6391,7 +11732,8 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"distinct\":true}".data(using: .utf8) + let expectedBodyData = "{\"replicas\":[\"name_of_replica_index1\",\"name_of_replica_index2\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6399,17 +11741,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// integer distinct - func testSetSettingsTest8() async throws { + /// set_default_max_values_per_facet + func testSetSettingsTest76() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6419,8 +11755,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(distinct: SearchDistinct.int(1)), - forwardToReplicas: true + indexSettings: IndexSettings(maxValuesPerFacet: 100) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6428,7 +11763,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"distinct\":1}".data(using: .utf8) + let expectedBodyData = "{\"maxValuesPerFacet\":100}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6436,17 +11771,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// distinct company - func testSetSettingsTest9() async throws { + /// set_default_sort_facet_values_by + func testSetSettingsTest77() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6456,7 +11785,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(attributeForDistinct: "company", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(sortFacetValuesBy: "alpha") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6464,7 +11793,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributeForDistinct\":\"company\",\"distinct\":true}".data(using: .utf8) + let expectedBodyData = "{\"sortFacetValuesBy\":\"alpha\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6475,8 +11804,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// distinct design - func testSetSettingsTest10() async throws { + /// set_attributes_to_snippet + func testSetSettingsTest78() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6486,7 +11815,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(attributeForDistinct: "design", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(attributesToSnippet: ["content:80", "description"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6494,7 +11823,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributeForDistinct\":\"design\",\"distinct\":true}".data(using: .utf8) + let expectedBodyData = "{\"attributesToSnippet\":[\"content:80\",\"description\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6505,8 +11834,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// distinct true - func testSetSettingsTest11() async throws { + /// set_all_attributes_to_snippet + func testSetSettingsTest79() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6516,7 +11845,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(attributesToSnippet: ["*:80"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6524,7 +11853,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"distinct\":true}".data(using: .utf8) + let expectedBodyData = "{\"attributesToSnippet\":[\"*:80\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6535,8 +11864,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// distinct section - func testSetSettingsTest12() async throws { + /// set_default_highlight_pre_tag + func testSetSettingsTest80() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6546,7 +11875,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(attributeForDistinct: "section", distinct: SearchDistinct.bool(true)) + indexSettings: IndexSettings(highlightPreTag: "") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6554,7 +11883,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributeForDistinct\":\"section\",\"distinct\":true}".data(using: .utf8) + let expectedBodyData = "{\"highlightPreTag\":\"\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6565,8 +11894,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting allergens - func testSetSettingsTest13() async throws { + /// set_default_highlight_post_tag + func testSetSettingsTest81() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6575,8 +11904,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["allergens"]) + indexName: "theIndexName", + indexSettings: IndexSettings(highlightPostTag: "") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6584,19 +11913,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"allergens\"]}".data(using: .utf8) + let expectedBodyData = "{\"highlightPostTag\":\"\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting categoryPageId - func testSetSettingsTest14() async throws { + /// set_default_snippet_ellipsis_text + func testSetSettingsTest82() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6605,8 +11934,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["searchable(categoryPageId)"]) + indexName: "theIndexName", + indexSettings: IndexSettings(snippetEllipsisText: "…") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6614,19 +11943,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"searchable(categoryPageId)\"]}".data(using: .utf8) + let expectedBodyData = "{\"snippetEllipsisText\":\"…\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// unretrievableAttributes - func testSetSettingsTest15() async throws { + /// enable_restrict_highlight_and_snippet_arrays_by_default + func testSetSettingsTest83() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6635,8 +11964,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(unretrievableAttributes: ["visible_by"]) + indexName: "theIndexName", + indexSettings: IndexSettings(restrictHighlightAndSnippetArrays: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6644,19 +11973,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"unretrievableAttributes\":[\"visible_by\"]}".data(using: .utf8) + let expectedBodyData = "{\"restrictHighlightAndSnippetArrays\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting user restricted data - func testSetSettingsTest16() async throws { + /// set_default_hits_per_page + func testSetSettingsTest84() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6665,8 +11994,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(visible_by)"]) + indexName: "theIndexName", + indexSettings: IndexSettings(hitsPerPage: 20) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6674,19 +12003,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"filterOnly(visible_by)\"]}".data(using: .utf8) + let expectedBodyData = "{\"hitsPerPage\":20}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting optional filters - func testSetSettingsTest17() async throws { + /// set_pagination_limit + func testSetSettingsTest85() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6695,8 +12024,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["can_deliver_quickly", "restaurant"]) + indexName: "theIndexName", + indexSettings: IndexSettings(paginationLimitedTo: 1000) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6704,20 +12033,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"can_deliver_quickly\",\"restaurant\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"paginationLimitedTo\":1000}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting redirect index - func testSetSettingsTest18() async throws { + /// set_default_min_word_size_for_one_typo + func testSetSettingsTest86() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6726,8 +12054,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["query_terms"]) + indexName: "theIndexName", + indexSettings: IndexSettings(minWordSizefor1Typo: 4) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6735,19 +12063,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"query_terms\"]}".data(using: .utf8) + let expectedBodyData = "{\"minWordSizefor1Typo\":4}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting multiple consequences - func testSetSettingsTest19() async throws { + /// set_default_min_word_size_for_two_typos + func testSetSettingsTest87() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6756,8 +12084,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["director"]) + indexName: "theIndexName", + indexSettings: IndexSettings(minWordSizefor2Typos: 4) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6765,19 +12093,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"director\"]}".data(using: .utf8) + let expectedBodyData = "{\"minWordSizefor2Typos\":4}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting in-depth optional filters - func testSetSettingsTest20() async throws { + /// set_default_typo_tolerance_mode + func testSetSettingsTest88() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6786,8 +12114,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: ["filterOnly(brand)"]) + indexName: "theIndexName", + indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true)) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6795,19 +12123,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"attributesForFaceting\":[\"filterOnly(brand)\"]}".data(using: .utf8) + let expectedBodyData = "{\"typoTolerance\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// mode neuralSearch - func testSetSettingsTest21() async throws { + /// disable_typos_on_numeric_tokens_by_default + func testSetSettingsTest89() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6817,7 +12145,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(mode: SearchMode.neuralSearch) + indexSettings: IndexSettings(allowTyposOnNumericTokens: false) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6825,7 +12153,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"mode\":\"neuralSearch\"}".data(using: .utf8) + let expectedBodyData = "{\"allowTyposOnNumericTokens\":false}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6836,8 +12164,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// mode keywordSearch - func testSetSettingsTest22() async throws { + /// disable_typo_tolerance_for_words + func testSetSettingsTest90() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6847,7 +12175,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(mode: SearchMode.keywordSearch) + indexSettings: IndexSettings(disableTypoToleranceOnWords: ["wheel", "1X2BCD"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6855,7 +12183,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"mode\":\"keywordSearch\"}".data(using: .utf8) + let expectedBodyData = "{\"disableTypoToleranceOnWords\":[\"wheel\",\"1X2BCD\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6866,8 +12194,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributes same priority - func testSetSettingsTest23() async throws { + /// set_separators_to_index + func testSetSettingsTest91() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6877,7 +12205,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["title,comments", "ingredients"]) + indexSettings: IndexSettings(separatorsToIndex: "+#") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6885,7 +12213,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"title,comments\",\"ingredients\"]}".data(using: .utf8) + let expectedBodyData = "{\"separatorsToIndex\":\"+#\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6896,8 +12224,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributes higher priority - func testSetSettingsTest24() async throws { + /// set_languages_using_querylanguages + func testSetSettingsTest92() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6907,7 +12235,10 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["title", "ingredients"]) + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6915,7 +12246,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"title\",\"ingredients\"]}".data(using: .utf8) + let expectedBodyData = "{\"queryLanguages\":[\"es\"],\"ignorePlurals\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6926,8 +12257,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking retweets - func testSetSettingsTest25() async throws { + /// set_attributes_to_transliterate + func testSetSettingsTest93() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6937,7 +12268,10 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(retweets)", "desc(likes)"]) + indexSettings: IndexSettings( + attributesToTransliterate: ["name", "description"], + indexLanguages: [SearchSupportedLanguage.ja] + ) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6945,7 +12279,9 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(retweets)\",\"desc(likes)\"]}".data(using: .utf8) + let expectedBodyData = + "{\"indexLanguages\":[\"ja\"],\"attributesToTransliterate\":[\"name\",\"description\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6956,8 +12292,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking boosted - func testSetSettingsTest26() async throws { + /// set_languages_using_querylanguages + func testSetSettingsTest94() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6967,7 +12303,10 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(boosted)"]) + indexSettings: IndexSettings( + removeStopWords: SearchRemoveStopWords.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -6975,7 +12314,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(boosted)\"]}".data(using: .utf8) + let expectedBodyData = "{\"queryLanguages\":[\"es\"],\"removeStopWords\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -6986,8 +12325,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking pageviews - func testSetSettingsTest27() async throws { + /// set_camel_case_attributes + func testSetSettingsTest95() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -6997,7 +12336,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(pageviews)", "desc(comments)"]) + indexSettings: IndexSettings(camelCaseAttributes: ["description"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7005,7 +12344,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(pageviews)\",\"desc(comments)\"]}".data(using: .utf8) + let expectedBodyData = "{\"camelCaseAttributes\":[\"description\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7016,8 +12355,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking applying search parameters for a specific query - func testSetSettingsTest28() async throws { + /// set_decompounded_attributes + func testSetSettingsTest96() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7027,10 +12366,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - attributesForFaceting: ["city, country"], - customRanking: ["desc(nb_airline_liaisons)"] - ) + indexSettings: IndexSettings(decompoundedAttributes: ["de": ["name"]]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7038,9 +12374,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"customRanking\":[\"desc(nb_airline_liaisons)\"],\"attributesForFaceting\":[\"city, country\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"decompoundedAttributes\":{\"de\":[\"name\"]}}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7051,8 +12385,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking rounded pageviews - func testSetSettingsTest29() async throws { + /// set_decompounded_multiple_attributes + func testSetSettingsTest97() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7062,7 +12396,10 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(rounded_pageviews)", "desc(comments)"]) + indexSettings: IndexSettings(decompoundedAttributes: [ + "de": ["name_de", "description_de"], + "fi": ["name_fi", "description_fi"], + ]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7070,8 +12407,9 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(rounded_pageviews)\",\"desc(comments)\"]}" - .data(using: .utf8) + let expectedBodyData = + "{\"decompoundedAttributes\":{\"de\":[\"name_de\",\"description_de\"],\"fi\":[\"name_fi\",\"description_fi\"]}}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7082,8 +12420,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking price - func testSetSettingsTest30() async throws { + /// set_keep_diacritics_on_characters + func testSetSettingsTest98() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7093,7 +12431,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(price)"]) + indexSettings: IndexSettings(keepDiacriticsOnCharacters: "øé") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7101,7 +12439,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(price)\"]}".data(using: .utf8) + let expectedBodyData = "{\"keepDiacriticsOnCharacters\":\"øé\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7112,28 +12450,18 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// ranking exhaustive - func testSetSettingsTest31() async throws { + /// set_custom_normalization + func testSetSettingsTest99() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, - apiKey: SearchClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = SearchClient(configuration: configuration, transporter: transporter) - - let response = try await client.setSettingsWithHTTPInfo( - indexName: "theIndexName", - indexSettings: IndexSettings(ranking: [ - "desc(price)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ]) + apiKey: SearchClientRequestsTests.API_KEY + ) + let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) + let client = SearchClient(configuration: configuration, transporter: transporter) + + let response = try await client.setSettingsWithHTTPInfo( + indexName: "theIndexName", + indexSettings: IndexSettings(customNormalization: ["default": ["ä": "ae"]]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7141,9 +12469,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"ranking\":[\"desc(price)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"customNormalization\":{\"default\":{\"ä\":\"ae\"}}}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7154,8 +12480,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// ranking standard replica - func testSetSettingsTest32() async throws { + /// set_languages_using_querylanguages + func testSetSettingsTest100() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7165,7 +12491,11 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(ranking: ["desc(post_date_timestamp)"]) + indexSettings: IndexSettings( + ignorePlurals: SearchIgnorePlurals.bool(true), + removeStopWords: SearchRemoveStopWords.bool(true), + queryLanguages: [SearchSupportedLanguage.es] + ) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7173,7 +12503,8 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"ranking\":[\"desc(post_date_timestamp)\"]}".data(using: .utf8) + let expectedBodyData = "{\"queryLanguages\":[\"es\"],\"removeStopWords\":true,\"ignorePlurals\":true}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7184,8 +12515,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// ranking virtual replica - func testSetSettingsTest33() async throws { + /// set_indexlanguages + func testSetSettingsTest101() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7195,7 +12526,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["desc(post_date_timestamp)"]) + indexSettings: IndexSettings(indexLanguages: [SearchSupportedLanguage.ja]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7203,7 +12534,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"desc(post_date_timestamp)\"]}".data(using: .utf8) + let expectedBodyData = "{\"indexLanguages\":[\"ja\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7214,8 +12545,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// customRanking and ranking sort alphabetically - func testSetSettingsTest34() async throws { + /// enable_decompound_query_by_default + func testSetSettingsTest102() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7225,10 +12556,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - customRanking: ["asc(textual_attribute)"], - ranking: ["custom", "typo", "geo", "words", "filters", "proximity", "attribute", "exact"] - ) + indexSettings: IndexSettings(decompoundQuery: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7236,9 +12564,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"customRanking\":[\"asc(textual_attribute)\"],\"ranking\":[\"custom\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"decompoundQuery\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7249,8 +12575,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// relevancyStrictness - func testSetSettingsTest35() async throws { + /// enable_rules_syntax_by_default + func testSetSettingsTest103() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7260,7 +12586,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(customRanking: ["asc(textual_attribute)"], relevancyStrictness: 0) + indexSettings: IndexSettings(enableRules: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7268,8 +12594,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"customRanking\":[\"asc(textual_attribute)\"],\"relevancyStrictness\":0}" - .data(using: .utf8) + let expectedBodyData = "{\"enableRules\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7280,8 +12605,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// create replica index - func testSetSettingsTest36() async throws { + /// enable_personalization_settings + func testSetSettingsTest104() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7291,7 +12616,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(replicas: ["products_price_desc"]) + indexSettings: IndexSettings(enablePersonalization: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7299,7 +12624,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"replicas\":[\"products_price_desc\"]}".data(using: .utf8) + let expectedBodyData = "{\"enablePersonalization\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7310,8 +12635,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// create virtual replica index - func testSetSettingsTest37() async throws { + /// set_default_query_type + func testSetSettingsTest105() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7321,7 +12646,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(replicas: ["virtual(products_price_desc)"]) + indexSettings: IndexSettings(queryType: SearchQueryType.prefixLast) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7329,7 +12654,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"replicas\":[\"virtual(products_price_desc)\"]}".data(using: .utf8) + let expectedBodyData = "{\"queryType\":\"prefixLast\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7340,8 +12665,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// unlink replica index - func testSetSettingsTest38() async throws { + /// set_default_remove_words_if_no_result + func testSetSettingsTest106() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7351,7 +12676,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(replicas: [""]) + indexSettings: IndexSettings(removeWordsIfNoResults: SearchRemoveWordsIfNoResults.`none`) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7359,7 +12684,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"replicas\":[\"\"]}".data(using: .utf8) + let expectedBodyData = "{\"removeWordsIfNoResults\":\"none\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7370,8 +12695,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// forwardToReplicas - func testSetSettingsTest39() async throws { + /// enable_advanced_syntax_by_default + func testSetSettingsTest107() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7381,8 +12706,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["name", "description"]), - forwardToReplicas: true + indexSettings: IndexSettings(advancedSyntax: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7390,7 +12714,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"name\",\"description\"]}".data(using: .utf8) + let expectedBodyData = "{\"advancedSyntax\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7398,17 +12722,11 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) - let expectedQueryParameters = try XCTUnwrap("{\"forwardToReplicas\":\"true\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) + XCTAssertNil(echoResponse.queryParameters) } - /// maxValuesPerFacet - func testSetSettingsTest40() async throws { + /// set_default_optional_words + func testSetSettingsTest108() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7418,7 +12736,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(maxValuesPerFacet: 1000) + indexSettings: IndexSettings(optionalWords: SearchOptionalWords.arrayOfString(["blue", "iphone case"])) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7426,7 +12744,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"maxValuesPerFacet\":1000}".data(using: .utf8) + let expectedBodyData = "{\"optionalWords\":[\"blue\",\"iphone case\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7437,8 +12755,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// maxFacetHits - func testSetSettingsTest41() async throws { + /// disabling_prefix_search_for_some_attributes_by_default + func testSetSettingsTest109() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7448,7 +12766,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(maxFacetHits: 1000) + indexSettings: IndexSettings(disablePrefixOnAttributes: ["sku"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7456,7 +12774,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"maxFacetHits\":1000}".data(using: .utf8) + let expectedBodyData = "{\"disablePrefixOnAttributes\":[\"sku\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7467,8 +12785,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// attributesForFaceting complex - func testSetSettingsTest42() async throws { + /// disabling_exact_for_some_attributes_by_default + func testSetSettingsTest110() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7477,12 +12795,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "", - indexSettings: IndexSettings(attributesForFaceting: [ - "actor", - "filterOnly(category)", - "searchable(publisher)", - ]) + indexName: "theIndexName", + indexSettings: IndexSettings(disableExactOnAttributes: ["description"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7490,21 +12804,19 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"attributesForFaceting\":[\"actor\",\"filterOnly(category)\",\"searchable(publisher)\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"disableExactOnAttributes\":[\"description\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/%3CYOUR_INDEX_NAME%3E/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// ranking closest dates - func testSetSettingsTest43() async throws { + /// set_default_exact_single_word_query + func testSetSettingsTest111() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7514,17 +12826,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(ranking: [ - "asc(date_timestamp)", - "typo", - "geo", - "words", - "filters", - "proximity", - "attribute", - "exact", - "custom", - ]) + indexSettings: IndexSettings(exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7532,9 +12834,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"ranking\":[\"asc(date_timestamp)\",\"typo\",\"geo\",\"words\",\"filters\",\"proximity\",\"attribute\",\"exact\",\"custom\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"exactOnSingleWordQuery\":\"attribute\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7545,8 +12845,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributes item variation - func testSetSettingsTest44() async throws { + /// set_default_aternative_as_exact + func testSetSettingsTest112() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7556,7 +12856,10 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["design", "type", "color"]) + indexSettings: IndexSettings(alternativesAsExact: [ + SearchAlternativesAsExact.ignorePlurals, + SearchAlternativesAsExact.singleWordSynonym, + ]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7564,7 +12867,8 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"design\",\"type\",\"color\"]}".data(using: .utf8) + let expectedBodyData = "{\"alternativesAsExact\":[\"ignorePlurals\",\"singleWordSynonym\"]}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7575,8 +12879,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributes around location - func testSetSettingsTest45() async throws { + /// enable_advanced_syntax_by_default + func testSetSettingsTest113() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7586,10 +12890,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - searchableAttributes: ["name", "country", "code", "iata_code"], - customRanking: ["desc(links_count)"] - ) + indexSettings: IndexSettings(advancedSyntax: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7597,9 +12898,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"advancedSyntax\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7610,8 +12909,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributes around location - func testSetSettingsTest46() async throws { + /// set_numeric_attributes_for_filtering + func testSetSettingsTest114() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7621,10 +12920,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - searchableAttributes: ["name", "country", "code", "iata_code"], - customRanking: ["desc(links_count)"] - ) + indexSettings: IndexSettings(numericAttributesForFiltering: ["quantity", "popularity"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7632,9 +12928,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"searchableAttributes\":[\"name\",\"country\",\"code\",\"iata_code\"],\"customRanking\":[\"desc(links_count)\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"numericAttributesForFiltering\":[\"quantity\",\"popularity\"]}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7645,8 +12939,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// disableTypoToleranceOnAttributes - func testSetSettingsTest47() async throws { + /// enable_compression_of_integer_array + func testSetSettingsTest115() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7656,7 +12950,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(allowCompressionOfIntegerArray: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7664,7 +12958,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyData = "{\"allowCompressionOfIntegerArray\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7675,8 +12969,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// everything - func testSetSettingsTest48() async throws { + /// set_attributes_for_distinct + func testSetSettingsTest116() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7686,72 +12980,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - attributesForFaceting: ["algolia"], - replicas: [""], - paginationLimitedTo: 0, - unretrievableAttributes: ["foo"], - disableTypoToleranceOnWords: ["algolia"], - attributesToTransliterate: ["algolia"], - camelCaseAttributes: ["algolia"], - decompoundedAttributes: ["algolia": "aloglia"], - indexLanguages: [SearchSupportedLanguage.fr], - disablePrefixOnAttributes: ["algolia"], - allowCompressionOfIntegerArray: true, - numericAttributesForFiltering: ["algolia"], - separatorsToIndex: "bar", - searchableAttributes: ["foo"], - userData: ["user": "data"], - customNormalization: ["algolia": ["aloglia": "aglolia"]], - attributeForDistinct: "test", - maxFacetHits: 20, - keepDiacriticsOnCharacters: "abc", - customRanking: ["algolia"], - attributesToRetrieve: ["algolia"], - ranking: ["geo"], - relevancyStrictness: 10, - attributesToHighlight: ["algolia"], - attributesToSnippet: ["algolia"], - highlightPreTag: "", - highlightPostTag: "", - snippetEllipsisText: "---", - restrictHighlightAndSnippetArrays: true, - hitsPerPage: 10, - minWordSizefor1Typo: 5, - minWordSizefor2Typos: 11, - typoTolerance: SearchTypoTolerance.bool(false), - allowTyposOnNumericTokens: true, - disableTypoToleranceOnAttributes: ["algolia"], - ignorePlurals: SearchIgnorePlurals.bool(false), - removeStopWords: SearchRemoveStopWords.bool(false), - queryLanguages: [SearchSupportedLanguage.fr], - decompoundQuery: false, - enableRules: true, - enablePersonalization: true, - queryType: SearchQueryType.prefixLast, - removeWordsIfNoResults: SearchRemoveWordsIfNoResults.lastWords, - mode: SearchMode.neuralSearch, - semanticSearch: SearchSemanticSearch(eventSources: ["foo"]), - advancedSyntax: true, - optionalWords: SearchOptionalWords.arrayOfString(["myspace"]), - disableExactOnAttributes: ["algolia"], - exactOnSingleWordQuery: SearchExactOnSingleWordQuery.attribute, - alternativesAsExact: [SearchAlternativesAsExact.singleWordSynonym], - advancedSyntaxFeatures: [SearchAdvancedSyntaxFeatures.exactPhrase], - distinct: SearchDistinct.int(3), - replaceSynonymsInHighlight: true, - minProximity: 6, - responseFields: ["algolia"], - maxValuesPerFacet: 30, - sortFacetValuesBy: "date", - attributeCriteriaComputedByMinProximity: true, - renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( - facets: SearchFacets(order: ["a", "b"]), - values: ["a": SearchValue(order: ["b"], sortRemainingBy: SearchSortRemainingBy.count)] - )), - enableReRanking: false, - reRankingApplyFilter: SearchReRankingApplyFilter.string("mySearch:filters") - ) + indexSettings: IndexSettings(attributeForDistinct: "url") ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7759,9 +12988,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"advancedSyntax\":true,\"advancedSyntaxFeatures\":[\"exactPhrase\"],\"allowCompressionOfIntegerArray\":true,\"allowTyposOnNumericTokens\":true,\"alternativesAsExact\":[\"singleWordSynonym\"],\"attributeCriteriaComputedByMinProximity\":true,\"attributeForDistinct\":\"test\",\"attributesForFaceting\":[\"algolia\"],\"attributesToHighlight\":[\"algolia\"],\"attributesToRetrieve\":[\"algolia\"],\"attributesToSnippet\":[\"algolia\"],\"attributesToTransliterate\":[\"algolia\"],\"camelCaseAttributes\":[\"algolia\"],\"customNormalization\":{\"algolia\":{\"aloglia\":\"aglolia\"}},\"customRanking\":[\"algolia\"],\"decompoundQuery\":false,\"decompoundedAttributes\":{\"algolia\":\"aloglia\"},\"disableExactOnAttributes\":[\"algolia\"],\"disablePrefixOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnAttributes\":[\"algolia\"],\"disableTypoToleranceOnWords\":[\"algolia\"],\"distinct\":3,\"enablePersonalization\":true,\"enableReRanking\":false,\"enableRules\":true,\"exactOnSingleWordQuery\":\"attribute\",\"highlightPreTag\":\"\",\"highlightPostTag\":\"\",\"hitsPerPage\":10,\"ignorePlurals\":false,\"indexLanguages\":[\"fr\"],\"keepDiacriticsOnCharacters\":\"abc\",\"maxFacetHits\":20,\"maxValuesPerFacet\":30,\"minProximity\":6,\"minWordSizefor1Typo\":5,\"minWordSizefor2Typos\":11,\"mode\":\"neuralSearch\",\"numericAttributesForFiltering\":[\"algolia\"],\"optionalWords\":[\"myspace\"],\"paginationLimitedTo\":0,\"queryLanguages\":[\"fr\"],\"queryType\":\"prefixLast\",\"ranking\":[\"geo\"],\"reRankingApplyFilter\":\"mySearch:filters\",\"relevancyStrictness\":10,\"removeStopWords\":false,\"removeWordsIfNoResults\":\"lastWords\",\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"a\",\"b\"]},\"values\":{\"a\":{\"order\":[\"b\"],\"sortRemainingBy\":\"count\"}}}},\"replaceSynonymsInHighlight\":true,\"replicas\":[\"\"],\"responseFields\":[\"algolia\"],\"restrictHighlightAndSnippetArrays\":true,\"searchableAttributes\":[\"foo\"],\"semanticSearch\":{\"eventSources\":[\"foo\"]},\"separatorsToIndex\":\"bar\",\"snippetEllipsisText\":\"---\",\"sortFacetValuesBy\":\"date\",\"typoTolerance\":false,\"unretrievableAttributes\":[\"foo\"],\"userData\":{\"user\":\"data\"}}" - .data(using: .utf8) + let expectedBodyData = "{\"attributeForDistinct\":\"url\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7772,8 +12999,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributesWithCustomRankingsAndAttributesForFaceting - func testSetSettingsTest49() async throws { + /// set_distinct + func testSetSettingsTest117() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7783,11 +13010,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - attributesForFaceting: ["searchable(brand)", "type", "categories", "price"], - searchableAttributes: ["brand", "name", "categories", "unordered(description)"], - customRanking: ["desc(popularity)"] - ) + indexSettings: IndexSettings(attributeForDistinct: "url", distinct: SearchDistinct.int(1)) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7795,9 +13018,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"searchableAttributes\":[\"brand\",\"name\",\"categories\",\"unordered(description)\"],\"customRanking\":[\"desc(popularity)\"],\"attributesForFaceting\":[\"searchable(brand)\",\"type\",\"categories\",\"price\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"distinct\":1,\"attributeForDistinct\":\"url\"}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7808,8 +13029,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributesProductReferenceSuffixes - func testSetSettingsTest50() async throws { + /// set_replace_synonyms_in_highlights + func testSetSettingsTest118() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7819,11 +13040,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: [ - "name", - "product_reference", - "product_reference_suffixes", - ]) + indexSettings: IndexSettings(replaceSynonymsInHighlight: false) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7831,9 +13048,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = - "{\"searchableAttributes\":[\"name\",\"product_reference\",\"product_reference_suffixes\"]}" - .data(using: .utf8) + let expectedBodyData = "{\"replaceSynonymsInHighlight\":false}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7844,8 +13059,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// queryLanguageAndIgnorePlurals - func testSetSettingsTest51() async throws { + /// set_min_proximity + func testSetSettingsTest119() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7855,10 +13070,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings( - ignorePlurals: SearchIgnorePlurals.bool(true), - queryLanguages: [SearchSupportedLanguage.en] - ) + indexSettings: IndexSettings(minProximity: 1) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7866,7 +13078,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"queryLanguages\":[\"en\"],\"ignorePlurals\":true}".data(using: .utf8) + let expectedBodyData = "{\"minProximity\":1}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7877,8 +13089,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributesInMovies - func testSetSettingsTest52() async throws { + /// set_default_field + func testSetSettingsTest120() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7887,8 +13099,8 @@ final class SearchClientRequestsTests: XCTestCase { let client = SearchClient(configuration: configuration, transporter: transporter) let response = try await client.setSettingsWithHTTPInfo( - indexName: "movies", - indexSettings: IndexSettings(searchableAttributes: ["title_eng", "title_fr", "title_es"]) + indexName: "theIndexName", + indexSettings: IndexSettings(responseFields: ["hits", "hitsPerPage", "nbPages", "page"]) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7896,20 +13108,20 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"title_eng\",\"title_fr\",\"title_es\"]}" + let expectedBodyData = "{\"responseFields\":[\"hits\",\"hitsPerPage\",\"nbPages\",\"page\"]}" .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - XCTAssertEqual(echoResponse.path, "/1/indexes/movies/settings") + XCTAssertEqual(echoResponse.path, "/1/indexes/theIndexName/settings") XCTAssertEqual(echoResponse.method, HTTPMethod.put) XCTAssertNil(echoResponse.queryParameters) } - /// disablePrefixOnAttributes - func testSetSettingsTest53() async throws { + /// set_max_facet_hits + func testSetSettingsTest121() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7919,7 +13131,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(disablePrefixOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(maxFacetHits: 10) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7927,7 +13139,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"disablePrefixOnAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyData = "{\"maxFacetHits\":10}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7938,8 +13150,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// disableTypoToleranceOnAttributes - func testSetSettingsTest54() async throws { + /// set_attribute_criteria_computed_by_min_proximity + func testSetSettingsTest122() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7949,7 +13161,7 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(disableTypoToleranceOnAttributes: ["serial_number"]) + indexSettings: IndexSettings(attributeCriteriaComputedByMinProximity: true) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7957,7 +13169,7 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"disableTypoToleranceOnAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyData = "{\"attributeCriteriaComputedByMinProximity\":true}".data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7968,8 +13180,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributesSimpleExample - func testSetSettingsTest55() async throws { + /// set_user_data + func testSetSettingsTest123() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -7979,7 +13191,9 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["serial_number"]) + indexSettings: IndexSettings( + userData: ["extraData": "This is the custom data that you want to store in your index"] + ) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -7987,7 +13201,9 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"serial_number\"]}".data(using: .utf8) + let expectedBodyData = + "{\"userData\":{\"extraData\":\"This is the custom data that you want to store in your index\"}}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) @@ -7998,8 +13214,8 @@ final class SearchClientRequestsTests: XCTestCase { XCTAssertNil(echoResponse.queryParameters) } - /// searchableAttributesSimpleExampleAlt - func testSetSettingsTest56() async throws { + /// set_rendering_content + func testSetSettingsTest124() async throws { let configuration = try SearchClientConfiguration( appID: SearchClientRequestsTests.APPLICATION_ID, apiKey: SearchClientRequestsTests.API_KEY @@ -8009,7 +13225,14 @@ final class SearchClientRequestsTests: XCTestCase { let response = try await client.setSettingsWithHTTPInfo( indexName: "theIndexName", - indexSettings: IndexSettings(searchableAttributes: ["serial_number", "serial_number_suffixes"]) + indexSettings: IndexSettings(renderingContent: SearchRenderingContent(facetOrdering: SearchFacetOrdering( + facets: SearchFacets(order: ["size", "brand"]), + values: [ + "brand": SearchValue(order: ["uniqlo"], sortRemainingBy: SearchSortRemainingBy.count, + hide: ["muji"]), + "size": SearchValue(order: ["S", "M", "L"], sortRemainingBy: SearchSortRemainingBy.hidden), + ] + ))) ) let responseBodyData = try XCTUnwrap(response.bodyData) let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) @@ -8017,8 +13240,9 @@ final class SearchClientRequestsTests: XCTestCase { let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - let expectedBodyData = "{\"searchableAttributes\":[\"serial_number\",\"serial_number_suffixes\"]}" - .data(using: .utf8) + let expectedBodyData = + "{\"renderingContent\":{\"facetOrdering\":{\"facets\":{\"order\":[\"size\",\"brand\"]},\"values\":{\"brand\":{\"order\":[\"uniqlo\"],\"hide\":[\"muji\"],\"sortRemainingBy\":\"count\"},\"size\":{\"order\":[\"S\",\"M\",\"L\"],\"sortRemainingBy\":\"hidden\"}}}}}" + .data(using: .utf8) let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON)