algolia 2.3.3 → 3.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -89
- data/Gemfile +1 -14
- data/Gemfile.lock +64 -0
- data/README.md +4 -6
- data/Rakefile +0 -39
- data/algolia.gemspec +24 -39
- data/lib/algolia/api/abtesting_client.rb +418 -0
- data/lib/algolia/api/analytics_client.rb +1294 -0
- data/lib/algolia/api/ingestion_client.rb +1659 -0
- data/lib/algolia/api/insights_client.rb +252 -0
- data/lib/algolia/api/monitoring_client.rb +555 -0
- data/lib/algolia/api/personalization_client.rb +365 -0
- data/lib/algolia/api/query_suggestions_client.rb +491 -0
- data/lib/algolia/api/recommend_client.rb +460 -0
- data/lib/algolia/api/search_client.rb +2723 -0
- data/lib/algolia/api_client.rb +153 -0
- data/lib/algolia/api_error.rb +48 -0
- data/lib/algolia/configuration.rb +41 -0
- data/lib/algolia/logger_helper.rb +1 -1
- data/lib/algolia/models/abtesting/ab_test.rb +332 -0
- data/lib/algolia/models/abtesting/ab_test_response.rb +219 -0
- data/lib/algolia/models/abtesting/ab_tests_variant.rb +217 -0
- data/lib/algolia/models/abtesting/ab_tests_variant_search_params.rb +236 -0
- data/lib/algolia/models/abtesting/add_ab_tests_request.rb +239 -0
- data/lib/algolia/models/abtesting/add_ab_tests_variant.rb +96 -0
- data/lib/algolia/models/abtesting/currencies_value.rb +223 -0
- data/lib/algolia/models/abtesting/custom_search_params.rb +195 -0
- data/lib/algolia/models/abtesting/error_base.rb +196 -0
- data/lib/algolia/models/abtesting/filter_effects.rb +202 -0
- data/lib/algolia/models/abtesting/filter_effects_empty_search.rb +204 -0
- data/lib/algolia/models/abtesting/filter_effects_outliers.rb +204 -0
- data/lib/algolia/models/abtesting/list_ab_tests_response.rb +221 -0
- data/lib/algolia/models/abtesting/variant.rb +399 -0
- data/lib/algolia/models/analytics/average_click_event.rb +219 -0
- data/lib/algolia/models/analytics/click_position.rb +209 -0
- data/lib/algolia/models/analytics/click_through_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/conversion_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/direction.rb +33 -0
- data/lib/algolia/models/analytics/error_base.rb +196 -0
- data/lib/algolia/models/analytics/get_average_click_position_response.rb +221 -0
- data/lib/algolia/models/analytics/get_click_positions_response.rb +215 -0
- data/lib/algolia/models/analytics/get_click_through_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_conversation_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_click_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_no_results_rate_response.rb +251 -0
- data/lib/algolia/models/analytics/get_searches_count_response.rb +209 -0
- data/lib/algolia/models/analytics/get_searches_no_clicks_response.rb +197 -0
- data/lib/algolia/models/analytics/get_searches_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_status_response.rb +195 -0
- data/lib/algolia/models/analytics/get_top_countries_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_attribute.rb +207 -0
- data/lib/algolia/models/analytics/get_top_filter_attributes_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute.rb +231 -0
- data/lib/algolia/models/analytics/get_top_filter_for_attribute_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_response.rb +197 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_value.rb +219 -0
- data/lib/algolia/models/analytics/get_top_filters_no_results_values.rb +209 -0
- data/lib/algolia/models/analytics/get_top_hits_response.rb +96 -0
- data/lib/algolia/models/analytics/get_top_searches_response.rb +96 -0
- data/lib/algolia/models/analytics/get_users_count_response.rb +209 -0
- data/lib/algolia/models/analytics/no_click_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/no_results_rate_event.rb +249 -0
- data/lib/algolia/models/analytics/order_by.rb +35 -0
- data/lib/algolia/models/analytics/search_event.rb +207 -0
- data/lib/algolia/models/analytics/search_no_click_event.rb +219 -0
- data/lib/algolia/models/analytics/search_no_result_event.rb +219 -0
- data/lib/algolia/models/analytics/top_country.rb +207 -0
- data/lib/algolia/models/analytics/top_hit.rb +207 -0
- data/lib/algolia/models/analytics/top_hit_with_analytics.rb +285 -0
- data/lib/algolia/models/analytics/top_hits_response.rb +197 -0
- data/lib/algolia/models/analytics/top_hits_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/top_search.rb +219 -0
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +309 -0
- data/lib/algolia/models/analytics/top_searches_response.rb +197 -0
- data/lib/algolia/models/analytics/top_searches_response_with_analytics.rb +197 -0
- data/lib/algolia/models/analytics/user_with_date.rb +207 -0
- data/lib/algolia/models/ingestion/action_type.rb +34 -0
- data/lib/algolia/models/ingestion/auth_algolia.rb +207 -0
- data/lib/algolia/models/ingestion/auth_algolia_partial.rb +203 -0
- data/lib/algolia/models/ingestion/auth_api_key.rb +195 -0
- data/lib/algolia/models/ingestion/auth_api_key_partial.rb +193 -0
- data/lib/algolia/models/ingestion/auth_basic.rb +206 -0
- data/lib/algolia/models/ingestion/auth_basic_partial.rb +202 -0
- data/lib/algolia/models/ingestion/auth_google_service_account.rb +208 -0
- data/lib/algolia/models/ingestion/auth_google_service_account_partial.rb +204 -0
- data/lib/algolia/models/ingestion/auth_input.rb +99 -0
- data/lib/algolia/models/ingestion/auth_input_partial.rb +99 -0
- data/lib/algolia/models/ingestion/auth_o_auth.rb +220 -0
- data/lib/algolia/models/ingestion/auth_o_auth_partial.rb +214 -0
- data/lib/algolia/models/ingestion/authentication.rb +283 -0
- data/lib/algolia/models/ingestion/authentication_create.rb +249 -0
- data/lib/algolia/models/ingestion/authentication_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/authentication_search.rb +197 -0
- data/lib/algolia/models/ingestion/authentication_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_type.rb +36 -0
- data/lib/algolia/models/ingestion/authentication_update.rb +243 -0
- data/lib/algolia/models/ingestion/authentication_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/big_commerce_channel.rb +207 -0
- data/lib/algolia/models/ingestion/big_commerce_metafield.rb +207 -0
- data/lib/algolia/models/ingestion/big_query_data_type.rb +33 -0
- data/lib/algolia/models/ingestion/delete_response.rb +195 -0
- data/lib/algolia/models/ingestion/destination.rb +283 -0
- data/lib/algolia/models/ingestion/destination_create.rb +250 -0
- data/lib/algolia/models/ingestion/destination_create_response.rb +220 -0
- data/lib/algolia/models/ingestion/destination_index_name.rb +238 -0
- data/lib/algolia/models/ingestion/destination_index_prefix.rb +195 -0
- data/lib/algolia/models/ingestion/destination_input.rb +96 -0
- data/lib/algolia/models/ingestion/destination_search.rb +197 -0
- data/lib/algolia/models/ingestion/destination_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/destination_type.rb +34 -0
- data/lib/algolia/models/ingestion/destination_update.rb +243 -0
- data/lib/algolia/models/ingestion/destination_update_response.rb +220 -0
- data/lib/algolia/models/ingestion/docker_image_type.rb +34 -0
- data/lib/algolia/models/ingestion/docker_registry.rb +33 -0
- data/lib/algolia/models/ingestion/docker_source_discover.rb +207 -0
- data/lib/algolia/models/ingestion/docker_source_streams.rb +196 -0
- data/lib/algolia/models/ingestion/error_base.rb +196 -0
- data/lib/algolia/models/ingestion/event.rb +311 -0
- data/lib/algolia/models/ingestion/event_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/event_status.rb +37 -0
- data/lib/algolia/models/ingestion/event_type.rb +35 -0
- data/lib/algolia/models/ingestion/list_authentications_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_destinations_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_events_response.rb +218 -0
- data/lib/algolia/models/ingestion/list_sources_response.rb +207 -0
- data/lib/algolia/models/ingestion/list_tasks_response.rb +208 -0
- data/lib/algolia/models/ingestion/mapping_type_csv.rb +36 -0
- data/lib/algolia/models/ingestion/method_type.rb +33 -0
- data/lib/algolia/models/ingestion/on_demand_date_utils_input.rb +208 -0
- data/lib/algolia/models/ingestion/on_demand_trigger.rb +227 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_input.rb +217 -0
- data/lib/algolia/models/ingestion/on_demand_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/order_keys.rb +33 -0
- data/lib/algolia/models/ingestion/pagination.rb +227 -0
- data/lib/algolia/models/ingestion/platform.rb +33 -0
- data/lib/algolia/models/ingestion/platform_none.rb +32 -0
- data/lib/algolia/models/ingestion/platform_with_none.rb +96 -0
- data/lib/algolia/models/ingestion/record_type.rb +33 -0
- data/lib/algolia/models/ingestion/run.rb +359 -0
- data/lib/algolia/models/ingestion/run_list_response.rb +218 -0
- data/lib/algolia/models/ingestion/run_outcome.rb +34 -0
- data/lib/algolia/models/ingestion/run_progress.rb +201 -0
- data/lib/algolia/models/ingestion/run_reason_code.rb +38 -0
- data/lib/algolia/models/ingestion/run_response.rb +208 -0
- data/lib/algolia/models/ingestion/run_sort_keys.rb +34 -0
- data/lib/algolia/models/ingestion/run_status.rb +36 -0
- data/lib/algolia/models/ingestion/run_type.rb +34 -0
- data/lib/algolia/models/ingestion/schedule_date_utils_input.rb +214 -0
- data/lib/algolia/models/ingestion/schedule_trigger.rb +251 -0
- data/lib/algolia/models/ingestion/schedule_trigger_input.rb +229 -0
- data/lib/algolia/models/ingestion/schedule_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/source.rb +282 -0
- data/lib/algolia/models/ingestion/source_big_commerce.rb +235 -0
- data/lib/algolia/models/ingestion/source_big_query.rb +278 -0
- data/lib/algolia/models/ingestion/source_commercetools.rb +238 -0
- data/lib/algolia/models/ingestion/source_create.rb +248 -0
- data/lib/algolia/models/ingestion/source_create_response.rb +218 -0
- data/lib/algolia/models/ingestion/source_csv.rb +276 -0
- data/lib/algolia/models/ingestion/source_docker.rb +261 -0
- data/lib/algolia/models/ingestion/source_input.rb +100 -0
- data/lib/algolia/models/ingestion/source_json.rb +236 -0
- data/lib/algolia/models/ingestion/source_search.rb +196 -0
- data/lib/algolia/models/ingestion/source_sort_keys.rb +35 -0
- data/lib/algolia/models/ingestion/source_type.rb +37 -0
- data/lib/algolia/models/ingestion/source_update.rb +211 -0
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +207 -0
- data/lib/algolia/models/ingestion/source_update_docker.rb +246 -0
- data/lib/algolia/models/ingestion/source_update_input.rb +99 -0
- data/lib/algolia/models/ingestion/source_update_response.rb +218 -0
- data/lib/algolia/models/ingestion/subscription_trigger.rb +217 -0
- data/lib/algolia/models/ingestion/subscription_trigger_type.rb +32 -0
- data/lib/algolia/models/ingestion/task.rb +334 -0
- data/lib/algolia/models/ingestion/task_create.rb +299 -0
- data/lib/algolia/models/ingestion/task_create_response.rb +208 -0
- data/lib/algolia/models/ingestion/task_create_trigger.rb +97 -0
- data/lib/algolia/models/ingestion/task_input.rb +96 -0
- data/lib/algolia/models/ingestion/task_search.rb +196 -0
- data/lib/algolia/models/ingestion/task_sort_keys.rb +36 -0
- data/lib/algolia/models/ingestion/task_update.rb +250 -0
- data/lib/algolia/models/ingestion/task_update_response.rb +208 -0
- data/lib/algolia/models/ingestion/trigger.rb +97 -0
- data/lib/algolia/models/ingestion/trigger_type.rb +34 -0
- data/lib/algolia/models/ingestion/trigger_update_input.rb +196 -0
- data/lib/algolia/models/ingestion/window.rb +208 -0
- data/lib/algolia/models/insights/add_to_cart_event.rb +32 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids.rb +384 -0
- data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/click_event.rb +32 -0
- data/lib/algolia/models/insights/clicked_filters.rb +351 -0
- data/lib/algolia/models/insights/clicked_object_ids.rb +341 -0
- data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +418 -0
- data/lib/algolia/models/insights/conversion_event.rb +32 -0
- data/lib/algolia/models/insights/converted_filters.rb +350 -0
- data/lib/algolia/models/insights/converted_object_ids.rb +351 -0
- data/lib/algolia/models/insights/converted_object_ids_after_search.rb +386 -0
- data/lib/algolia/models/insights/discount.rb +97 -0
- data/lib/algolia/models/insights/error_base.rb +196 -0
- data/lib/algolia/models/insights/events_items.rb +106 -0
- data/lib/algolia/models/insights/events_response.rb +204 -0
- data/lib/algolia/models/insights/insights_events.rb +215 -0
- data/lib/algolia/models/insights/object_data.rb +211 -0
- data/lib/algolia/models/insights/object_data_after_search.rb +221 -0
- data/lib/algolia/models/insights/price.rb +97 -0
- data/lib/algolia/models/insights/purchase_event.rb +32 -0
- data/lib/algolia/models/insights/purchased_object_ids.rb +384 -0
- data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +419 -0
- data/lib/algolia/models/insights/view_event.rb +32 -0
- data/lib/algolia/models/insights/viewed_filters.rb +351 -0
- data/lib/algolia/models/insights/viewed_object_ids.rb +351 -0
- data/lib/algolia/models/monitoring/error_base.rb +196 -0
- data/lib/algolia/models/monitoring/get_inventory403_response.rb +192 -0
- data/lib/algolia/models/monitoring/incident.rb +225 -0
- data/lib/algolia/models/monitoring/incidents_inner.rb +202 -0
- data/lib/algolia/models/monitoring/incidents_response.rb +194 -0
- data/lib/algolia/models/monitoring/indexing_time_response.rb +192 -0
- data/lib/algolia/models/monitoring/indexing_time_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/infrastructure_response.rb +192 -0
- data/lib/algolia/models/monitoring/infrastructure_response_metrics.rb +243 -0
- data/lib/algolia/models/monitoring/inventory_response.rb +194 -0
- data/lib/algolia/models/monitoring/latency_response.rb +192 -0
- data/lib/algolia/models/monitoring/latency_response_metrics.rb +194 -0
- data/lib/algolia/models/monitoring/metric.rb +37 -0
- data/lib/algolia/models/monitoring/period.rb +36 -0
- data/lib/algolia/models/monitoring/probes_metric.rb +203 -0
- data/lib/algolia/models/monitoring/region.rb +46 -0
- data/lib/algolia/models/monitoring/server.rb +272 -0
- data/lib/algolia/models/monitoring/server_status.rb +32 -0
- data/lib/algolia/models/monitoring/status.rb +35 -0
- data/lib/algolia/models/monitoring/status_response.rb +194 -0
- data/lib/algolia/models/monitoring/time_inner.rb +203 -0
- data/lib/algolia/models/monitoring/type.rb +32 -0
- data/lib/algolia/models/personalization/delete_user_profile_response.rb +207 -0
- data/lib/algolia/models/personalization/error_base.rb +196 -0
- data/lib/algolia/models/personalization/event_scoring.rb +219 -0
- data/lib/algolia/models/personalization/facet_scoring.rb +207 -0
- data/lib/algolia/models/personalization/get_user_token_response.rb +219 -0
- data/lib/algolia/models/personalization/personalization_strategy_params.rb +223 -0
- data/lib/algolia/models/personalization/set_personalization_strategy_response.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_response.rb +223 -0
- data/lib/algolia/models/query-suggestions/base_query_suggestions_configuration_with_index.rb +195 -0
- data/lib/algolia/models/query-suggestions/base_response.rb +203 -0
- data/lib/algolia/models/query-suggestions/error_base.rb +196 -0
- data/lib/algolia/models/query-suggestions/facet.rb +204 -0
- data/lib/algolia/models/query-suggestions/get_config_status200_response.rb +233 -0
- data/lib/algolia/models/query-suggestions/get_log_file200_response.rb +244 -0
- data/lib/algolia/models/query-suggestions/languages.rb +97 -0
- data/lib/algolia/models/query-suggestions/log_level.rb +34 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration.rb +255 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_response.rb +315 -0
- data/lib/algolia/models/query-suggestions/query_suggestions_configuration_with_index.rb +275 -0
- data/lib/algolia/models/query-suggestions/source_index.rb +305 -0
- data/lib/algolia/models/recommend/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/recommend/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/recommend/anchoring.rb +35 -0
- data/lib/algolia/models/recommend/around_precision.rb +97 -0
- data/lib/algolia/models/recommend/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/recommend/around_radius.rb +97 -0
- data/lib/algolia/models/recommend/around_radius_all.rb +32 -0
- data/lib/algolia/models/recommend/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/recommend/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/base_recommend_request.rb +233 -0
- data/lib/algolia/models/recommend/base_recommendations_query.rb +246 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query.rb +234 -0
- data/lib/algolia/models/recommend/base_recommended_for_you_query_parameters.rb +195 -0
- data/lib/algolia/models/recommend/base_search_params.rb +564 -0
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/recommend/base_search_response.rb +517 -0
- data/lib/algolia/models/recommend/base_trending_facets_query.rb +226 -0
- data/lib/algolia/models/recommend/base_trending_items_query.rb +252 -0
- data/lib/algolia/models/recommend/condition.rb +244 -0
- data/lib/algolia/models/recommend/consequence.rb +239 -0
- data/lib/algolia/models/recommend/consequence_hide.rb +196 -0
- data/lib/algolia/models/recommend/consequence_params.rb +1121 -0
- data/lib/algolia/models/recommend/consequence_query.rb +97 -0
- data/lib/algolia/models/recommend/consequence_query_object.rb +207 -0
- data/lib/algolia/models/recommend/deleted_at_response.rb +208 -0
- data/lib/algolia/models/recommend/distinct.rb +97 -0
- data/lib/algolia/models/recommend/edit.rb +234 -0
- data/lib/algolia/models/recommend/edit_type.rb +33 -0
- data/lib/algolia/models/recommend/error_base.rb +196 -0
- data/lib/algolia/models/recommend/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/recommend/exhaustive.rb +234 -0
- data/lib/algolia/models/recommend/facet_filters.rb +97 -0
- data/lib/algolia/models/recommend/facet_ordering.rb +205 -0
- data/lib/algolia/models/recommend/facets.rb +196 -0
- data/lib/algolia/models/recommend/facets_stats.rb +223 -0
- data/lib/algolia/models/recommend/get_recommend_task_response.rb +216 -0
- data/lib/algolia/models/recommend/get_recommendations_params.rb +198 -0
- data/lib/algolia/models/recommend/get_recommendations_response.rb +194 -0
- data/lib/algolia/models/recommend/highlight_result.rb +96 -0
- data/lib/algolia/models/recommend/highlight_result_option.rb +253 -0
- data/lib/algolia/models/recommend/ignore_plurals.rb +97 -0
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/recommend/match_level.rb +34 -0
- data/lib/algolia/models/recommend/matched_geo_location.rb +213 -0
- data/lib/algolia/models/recommend/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/recommend/mode.rb +33 -0
- data/lib/algolia/models/recommend/numeric_filters.rb +97 -0
- data/lib/algolia/models/recommend/optional_filters.rb +97 -0
- data/lib/algolia/models/recommend/params.rb +220 -0
- data/lib/algolia/models/recommend/personalization.rb +213 -0
- data/lib/algolia/models/recommend/promote.rb +96 -0
- data/lib/algolia/models/recommend/promote_object_id.rb +208 -0
- data/lib/algolia/models/recommend/promote_object_ids.rb +210 -0
- data/lib/algolia/models/recommend/query_type.rb +34 -0
- data/lib/algolia/models/recommend/ranking_info.rb +328 -0
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/recommend/recommend_hit.rb +271 -0
- data/lib/algolia/models/recommend/recommend_models.rb +35 -0
- data/lib/algolia/models/recommend/recommendation_models.rb +33 -0
- data/lib/algolia/models/recommend/recommendations_hit.rb +96 -0
- data/lib/algolia/models/recommend/recommendations_hits.rb +216 -0
- data/lib/algolia/models/recommend/recommendations_query.rb +304 -0
- data/lib/algolia/models/recommend/recommendations_request.rb +98 -0
- data/lib/algolia/models/recommend/recommendations_results.rb +553 -0
- data/lib/algolia/models/recommend/recommended_for_you_model.rb +32 -0
- data/lib/algolia/models/recommend/recommended_for_you_query.rb +292 -0
- data/lib/algolia/models/recommend/recommended_for_you_query_parameters.rb +1105 -0
- data/lib/algolia/models/recommend/redirect.rb +195 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/recommend/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/recommend/remove_stop_words.rb +97 -0
- data/lib/algolia/models/recommend/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/recommend/rendering_content.rb +193 -0
- data/lib/algolia/models/recommend/rule_response.rb +246 -0
- data/lib/algolia/models/recommend/rule_response_metadata.rb +193 -0
- data/lib/algolia/models/recommend/search_params_object.rb +1103 -0
- data/lib/algolia/models/recommend/search_params_query.rb +193 -0
- data/lib/algolia/models/recommend/search_recommend_rules_params.rb +268 -0
- data/lib/algolia/models/recommend/search_recommend_rules_response.rb +233 -0
- data/lib/algolia/models/recommend/semantic_search.rb +198 -0
- data/lib/algolia/models/recommend/snippet_result.rb +96 -0
- data/lib/algolia/models/recommend/snippet_result_option.rb +229 -0
- data/lib/algolia/models/recommend/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/recommend/tag_filters.rb +97 -0
- data/lib/algolia/models/recommend/task_status.rb +33 -0
- data/lib/algolia/models/recommend/trending_facet_hit.rb +238 -0
- data/lib/algolia/models/recommend/trending_facets_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_facets_query.rb +284 -0
- data/lib/algolia/models/recommend/trending_items_model.rb +32 -0
- data/lib/algolia/models/recommend/trending_items_query.rb +310 -0
- data/lib/algolia/models/recommend/typo_tolerance.rb +97 -0
- data/lib/algolia/models/recommend/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/recommend/value.rb +226 -0
- data/lib/algolia/models/search/acl.rb +47 -0
- data/lib/algolia/models/search/action.rb +38 -0
- data/lib/algolia/models/search/add_api_key_response.rb +207 -0
- data/lib/algolia/models/search/advanced_syntax_features.rb +33 -0
- data/lib/algolia/models/search/alternatives_as_exact.rb +34 -0
- data/lib/algolia/models/search/anchoring.rb +35 -0
- data/lib/algolia/models/search/api_key.rb +272 -0
- data/lib/algolia/models/search/around_precision.rb +97 -0
- data/lib/algolia/models/search/around_precision_from_value_inner.rb +201 -0
- data/lib/algolia/models/search/around_radius.rb +97 -0
- data/lib/algolia/models/search/around_radius_all.rb +32 -0
- data/lib/algolia/models/search/assign_user_id_params.rb +196 -0
- data/lib/algolia/models/search/attribute_to_update.rb +96 -0
- data/lib/algolia/models/search/automatic_facet_filter.rb +216 -0
- data/lib/algolia/models/search/automatic_facet_filters.rb +97 -0
- data/lib/algolia/models/search/base_get_api_key_response.rb +205 -0
- data/lib/algolia/models/search/base_index_settings.rb +366 -0
- data/lib/algolia/models/search/base_search_params.rb +564 -0
- data/lib/algolia/models/search/base_search_params_without_query.rb +546 -0
- data/lib/algolia/models/search/base_search_response.rb +517 -0
- data/lib/algolia/models/search/batch_assign_user_ids_params.rb +210 -0
- data/lib/algolia/models/search/batch_dictionary_entries_params.rb +208 -0
- data/lib/algolia/models/search/batch_dictionary_entries_request.rb +227 -0
- data/lib/algolia/models/search/batch_params.rb +197 -0
- data/lib/algolia/models/search/batch_request.rb +228 -0
- data/lib/algolia/models/search/batch_response.rb +209 -0
- data/lib/algolia/models/search/batch_write_params.rb +197 -0
- data/lib/algolia/models/search/browse_params.rb +96 -0
- data/lib/algolia/models/search/browse_params_object.rb +1113 -0
- data/lib/algolia/models/search/browse_response.rb +568 -0
- data/lib/algolia/models/search/built_in_operation.rb +229 -0
- data/lib/algolia/models/search/built_in_operation_type.rb +38 -0
- data/lib/algolia/models/search/condition.rb +244 -0
- data/lib/algolia/models/search/consequence.rb +239 -0
- data/lib/algolia/models/search/consequence_hide.rb +196 -0
- data/lib/algolia/models/search/consequence_params.rb +1121 -0
- data/lib/algolia/models/search/consequence_query.rb +97 -0
- data/lib/algolia/models/search/consequence_query_object.rb +207 -0
- data/lib/algolia/models/search/created_at_response.rb +196 -0
- data/lib/algolia/models/search/cursor.rb +193 -0
- data/lib/algolia/models/search/delete_api_key_response.rb +195 -0
- data/lib/algolia/models/search/delete_by_params.rb +263 -0
- data/lib/algolia/models/search/delete_source_response.rb +195 -0
- data/lib/algolia/models/search/deleted_at_response.rb +208 -0
- data/lib/algolia/models/search/dictionary_action.rb +33 -0
- data/lib/algolia/models/search/dictionary_entry.rb +276 -0
- data/lib/algolia/models/search/dictionary_entry_state.rb +33 -0
- data/lib/algolia/models/search/dictionary_language.rb +194 -0
- data/lib/algolia/models/search/dictionary_settings_params.rb +195 -0
- data/lib/algolia/models/search/dictionary_type.rb +34 -0
- data/lib/algolia/models/search/distinct.rb +97 -0
- data/lib/algolia/models/search/edit.rb +234 -0
- data/lib/algolia/models/search/edit_type.rb +33 -0
- data/lib/algolia/models/search/error_base.rb +196 -0
- data/lib/algolia/models/search/exact_on_single_word_query.rb +34 -0
- data/lib/algolia/models/search/exhaustive.rb +234 -0
- data/lib/algolia/models/search/facet_filters.rb +97 -0
- data/lib/algolia/models/search/facet_hits.rb +219 -0
- data/lib/algolia/models/search/facet_ordering.rb +205 -0
- data/lib/algolia/models/search/facets.rb +196 -0
- data/lib/algolia/models/search/facets_stats.rb +223 -0
- data/lib/algolia/models/search/fetched_index.rb +313 -0
- data/lib/algolia/models/search/get_api_key_response.rb +301 -0
- data/lib/algolia/models/search/get_dictionary_settings_response.rb +194 -0
- data/lib/algolia/models/search/get_logs_response.rb +196 -0
- data/lib/algolia/models/search/get_objects_params.rb +197 -0
- data/lib/algolia/models/search/get_objects_request.rb +220 -0
- data/lib/algolia/models/search/get_objects_response.rb +197 -0
- data/lib/algolia/models/search/get_task_response.rb +216 -0
- data/lib/algolia/models/search/get_top_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/has_pending_mappings_response.rb +207 -0
- data/lib/algolia/models/search/highlight_result.rb +96 -0
- data/lib/algolia/models/search/highlight_result_option.rb +253 -0
- data/lib/algolia/models/search/hit.rb +241 -0
- data/lib/algolia/models/search/ignore_plurals.rb +97 -0
- data/lib/algolia/models/search/index_settings.rb +912 -0
- data/lib/algolia/models/search/index_settings_as_search_params.rb +723 -0
- data/lib/algolia/models/search/languages.rb +221 -0
- data/lib/algolia/models/search/list_api_keys_response.rb +197 -0
- data/lib/algolia/models/search/list_clusters_response.rb +198 -0
- data/lib/algolia/models/search/list_indices_response.rb +207 -0
- data/lib/algolia/models/search/list_user_ids_response.rb +198 -0
- data/lib/algolia/models/search/log.rb +358 -0
- data/lib/algolia/models/search/log_query.rb +213 -0
- data/lib/algolia/models/search/log_type.rb +35 -0
- data/lib/algolia/models/search/match_level.rb +34 -0
- data/lib/algolia/models/search/matched_geo_location.rb +213 -0
- data/lib/algolia/models/search/mixed_search_filters.rb +96 -0
- data/lib/algolia/models/search/mode.rb +33 -0
- data/lib/algolia/models/search/multiple_batch_request.rb +240 -0
- data/lib/algolia/models/search/multiple_batch_response.rb +211 -0
- data/lib/algolia/models/search/numeric_filters.rb +97 -0
- data/lib/algolia/models/search/operation_index_params.rb +240 -0
- data/lib/algolia/models/search/operation_type.rb +33 -0
- data/lib/algolia/models/search/optional_filters.rb +97 -0
- data/lib/algolia/models/search/params.rb +220 -0
- data/lib/algolia/models/search/personalization.rb +213 -0
- data/lib/algolia/models/search/promote.rb +96 -0
- data/lib/algolia/models/search/promote_object_id.rb +208 -0
- data/lib/algolia/models/search/promote_object_ids.rb +210 -0
- data/lib/algolia/models/search/query_type.rb +34 -0
- data/lib/algolia/models/search/ranking_info.rb +328 -0
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +97 -0
- data/lib/algolia/models/search/redirect.rb +195 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +242 -0
- data/lib/algolia/models/search/redirect_rule_index_metadata_data.rb +195 -0
- data/lib/algolia/models/search/remove_stop_words.rb +97 -0
- data/lib/algolia/models/search/remove_user_id_response.rb +195 -0
- data/lib/algolia/models/search/remove_words_if_no_results.rb +35 -0
- data/lib/algolia/models/search/rendering_content.rb +193 -0
- data/lib/algolia/models/search/replace_source_response.rb +195 -0
- data/lib/algolia/models/search/rule.rb +249 -0
- data/lib/algolia/models/search/save_object_response.rb +217 -0
- data/lib/algolia/models/search/save_synonym_response.rb +219 -0
- data/lib/algolia/models/search/scope_type.rb +34 -0
- data/lib/algolia/models/search/search_dictionary_entries_params.rb +244 -0
- data/lib/algolia/models/search/search_for_facet_values_request.rb +227 -0
- data/lib/algolia/models/search/search_for_facet_values_response.rb +218 -0
- data/lib/algolia/models/search/search_for_facets.rb +1158 -0
- data/lib/algolia/models/search/search_for_facets_options.rb +274 -0
- data/lib/algolia/models/search/search_for_hits.rb +1134 -0
- data/lib/algolia/models/search/search_for_hits_options.rb +226 -0
- data/lib/algolia/models/search/search_hits.rb +223 -0
- data/lib/algolia/models/search/search_method_params.rb +227 -0
- data/lib/algolia/models/search/search_params.rb +96 -0
- data/lib/algolia/models/search/search_params_object.rb +1103 -0
- data/lib/algolia/models/search/search_params_query.rb +193 -0
- data/lib/algolia/models/search/search_params_string.rb +193 -0
- data/lib/algolia/models/search/search_query.rb +96 -0
- data/lib/algolia/models/search/search_response.rb +560 -0
- data/lib/algolia/models/search/search_responses.rb +196 -0
- data/lib/algolia/models/search/search_result.rb +96 -0
- data/lib/algolia/models/search/search_rules_params.rb +311 -0
- data/lib/algolia/models/search/search_rules_response.rb +233 -0
- data/lib/algolia/models/search/search_strategy.rb +33 -0
- data/lib/algolia/models/search/search_synonyms_params.rb +193 -0
- data/lib/algolia/models/search/search_synonyms_response.rb +212 -0
- data/lib/algolia/models/search/search_type_default.rb +32 -0
- data/lib/algolia/models/search/search_type_facet.rb +32 -0
- data/lib/algolia/models/search/search_user_ids_params.rb +244 -0
- data/lib/algolia/models/search/search_user_ids_response.rb +264 -0
- data/lib/algolia/models/search/semantic_search.rb +198 -0
- data/lib/algolia/models/search/snippet_result.rb +96 -0
- data/lib/algolia/models/search/snippet_result_option.rb +229 -0
- data/lib/algolia/models/search/sort_remaining_by.rb +34 -0
- data/lib/algolia/models/search/source.rb +206 -0
- data/lib/algolia/models/search/standard_entries.rb +224 -0
- data/lib/algolia/models/search/synonym_hit.rb +295 -0
- data/lib/algolia/models/search/synonym_type.rb +36 -0
- data/lib/algolia/models/search/tag_filters.rb +97 -0
- data/lib/algolia/models/search/task_status.rb +33 -0
- data/lib/algolia/models/search/time_range.rb +207 -0
- data/lib/algolia/models/search/typo_tolerance.rb +97 -0
- data/lib/algolia/models/search/typo_tolerance_enum.rb +33 -0
- data/lib/algolia/models/search/update_api_key_response.rb +207 -0
- data/lib/algolia/models/search/updated_at_response.rb +208 -0
- data/lib/algolia/models/search/updated_at_with_object_id_response.rb +214 -0
- data/lib/algolia/models/search/updated_rule_response.rb +219 -0
- data/lib/algolia/models/search/user_highlight_result.rb +205 -0
- data/lib/algolia/models/search/user_hit.rb +269 -0
- data/lib/algolia/models/search/user_id.rb +247 -0
- data/lib/algolia/models/search/value.rb +226 -0
- data/lib/algolia/transport/echo_requester.rb +10 -0
- data/lib/algolia/{http → transport/http}/http_requester.rb +24 -19
- data/lib/algolia/{http → transport/http}/response.rb +11 -1
- data/lib/algolia/transport/request_options.rb +19 -31
- data/lib/algolia/transport/retry_strategy.rb +5 -8
- data/lib/algolia/transport/stateful_host.rb +1 -2
- data/lib/algolia/transport/transport.rb +33 -73
- data/lib/algolia/user_agent.rb +4 -14
- data/lib/algolia/version.rb +3 -1
- data/lib/algolia.rb +23 -40
- metadata +523 -218
- data/.circleci/config.yml +0 -155
- data/.dockerignore +0 -38
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- data/.gitignore +0 -40
- data/.rubocop.yml +0 -189
- data/.rubocop_todo.yml +0 -14
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.MD +0 -184
- data/DOCKER_README.MD +0 -89
- data/Dockerfile +0 -7
- data/LICENSE +0 -21
- data/SECURITY.md +0 -3
- data/Steepfile +0 -6
- data/bin/console +0 -21
- data/bin/setup +0 -8
- data/lib/algolia/account_client.rb +0 -65
- data/lib/algolia/analytics_client.rb +0 -105
- data/lib/algolia/config/analytics_config.rb +0 -20
- data/lib/algolia/config/base_config.rb +0 -43
- data/lib/algolia/config/insights_config.rb +0 -20
- data/lib/algolia/config/personalization_config.rb +0 -20
- data/lib/algolia/config/recommend_config.rb +0 -6
- data/lib/algolia/config/recommendation_config.rb +0 -7
- data/lib/algolia/config/search_config.rb +0 -40
- data/lib/algolia/defaults.rb +0 -35
- data/lib/algolia/helpers.rb +0 -134
- data/lib/algolia/insights_client.rb +0 -238
- data/lib/algolia/iterators/base_iterator.rb +0 -19
- data/lib/algolia/iterators/object_iterator.rb +0 -28
- data/lib/algolia/iterators/paginator_iterator.rb +0 -46
- data/lib/algolia/iterators/rule_iterator.rb +0 -9
- data/lib/algolia/iterators/synonym_iterator.rb +0 -9
- data/lib/algolia/personalization_client.rb +0 -60
- data/lib/algolia/recommend_client.rb +0 -134
- data/lib/algolia/recommendation_client.rb +0 -7
- data/lib/algolia/responses/add_api_key_response.rb +0 -38
- data/lib/algolia/responses/base_response.rb +0 -9
- data/lib/algolia/responses/delete_api_key_response.rb +0 -40
- data/lib/algolia/responses/dictionary_response.rb +0 -33
- data/lib/algolia/responses/indexing_response.rb +0 -28
- data/lib/algolia/responses/multiple_batch_indexing_response.rb +0 -29
- data/lib/algolia/responses/multiple_response.rb +0 -45
- data/lib/algolia/responses/restore_api_key_response.rb +0 -36
- data/lib/algolia/responses/update_api_key_response.rb +0 -39
- data/lib/algolia/search_client.rb +0 -791
- data/lib/algolia/search_index.rb +0 -1059
- data/renovate.json +0 -5
- data/sig/config/algolia_config.rbs +0 -24
- data/sig/config/analytics_config.rbs +0 -11
- data/sig/config/insights_config.rbs +0 -11
- data/sig/config/recommendation_config.rbs +0 -11
- data/sig/config/search_config.rbs +0 -11
- data/sig/enums/call_type.rbs +0 -5
- data/sig/helpers.rbs +0 -12
- data/sig/http/http_requester.rbs +0 -17
- data/sig/http/response.rbs +0 -14
- data/sig/interfaces/_connection.rbs +0 -16
- data/sig/iterators/base_iterator.rbs +0 -15
- data/sig/iterators/object_iterator.rbs +0 -6
- data/sig/iterators/paginator_iterator.rbs +0 -8
- data/sig/iterators/rule_iterator.rbs +0 -5
- data/sig/iterators/synonym_iterator.rbs +0 -5
- data/sig/transport/request_options.rbs +0 -33
- data/sig/transport/stateful_host.rbs +0 -21
- data/test/algolia/integration/account_client_test.rb +0 -47
- data/test/algolia/integration/analytics_client_test.rb +0 -117
- data/test/algolia/integration/base_test.rb +0 -9
- data/test/algolia/integration/insights_client_test.rb +0 -80
- data/test/algolia/integration/mocks/mock_requester.rb +0 -47
- data/test/algolia/integration/personalization_client_test.rb +0 -30
- data/test/algolia/integration/recommend_client_test.rb +0 -70
- data/test/algolia/integration/recommendation_client_test.rb +0 -30
- data/test/algolia/integration/search_client_test.rb +0 -465
- data/test/algolia/integration/search_index_test.rb +0 -729
- data/test/algolia/unit/algolia_config_test.rb +0 -16
- data/test/algolia/unit/helpers_test.rb +0 -88
- data/test/algolia/unit/http_requester_test.rb +0 -27
- data/test/algolia/unit/retry_strategy_test.rb +0 -139
- data/test/algolia/unit/user_agent_test.rb +0 -16
- data/test/test_helper.rb +0 -121
- data/upgrade_guide.md +0 -603
- /data/lib/algolia/{enums → transport}/call_type.rb +0 -0
- /data/lib/algolia/{enums → transport}/retry_outcome_type.rb +0 -0
@@ -1,30 +0,0 @@
|
|
1
|
-
require_relative 'base_test'
|
2
|
-
require 'date'
|
3
|
-
|
4
|
-
class RecommendationClientTest < BaseTest
|
5
|
-
describe 'Recommendation client' do
|
6
|
-
def test_recommendation_client
|
7
|
-
client = Algolia::Recommendation::Client.create(APPLICATION_ID_1, ADMIN_KEY_1)
|
8
|
-
personalization_strategy = {
|
9
|
-
eventsScoring: [
|
10
|
-
{ eventName: 'Add to cart', eventType: 'conversion', score: 50 },
|
11
|
-
{ eventName: 'Purchase', eventType: 'conversion', score: 100 }
|
12
|
-
],
|
13
|
-
facetsScoring: [
|
14
|
-
{ facetName: 'brand', score: 100 },
|
15
|
-
{ facetName: 'categories', score: 10 }
|
16
|
-
],
|
17
|
-
personalizationImpact: 0
|
18
|
-
}
|
19
|
-
|
20
|
-
begin
|
21
|
-
client.set_personalization_strategy(personalization_strategy)
|
22
|
-
rescue Algolia::AlgoliaHttpError => e
|
23
|
-
raise e unless e.code == 429
|
24
|
-
end
|
25
|
-
response = client.get_personalization_strategy
|
26
|
-
|
27
|
-
assert_equal response, personalization_strategy
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,465 +0,0 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
require_relative 'base_test'
|
3
|
-
|
4
|
-
class SearchClientTest < BaseTest
|
5
|
-
describe 'customize search client' do
|
6
|
-
def test_with_custom_adapter
|
7
|
-
client = Algolia::Search::Client.new(@@search_config, adapter: 'httpclient')
|
8
|
-
index = client.init_index(get_test_index_name('test_custom_adapter'))
|
9
|
-
|
10
|
-
index.save_object!({ name: 'test', data: 10 }, { auto_generate_object_id_if_not_exist: true })
|
11
|
-
response = index.search('test')
|
12
|
-
|
13
|
-
refute_empty response[:hits]
|
14
|
-
assert_equal 'test', response[:hits][0][:name]
|
15
|
-
assert_equal 10, response[:hits][0][:data]
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_with_custom_requester
|
19
|
-
client = Algolia::Search::Client.new(@@search_config, http_requester: MockRequester.new)
|
20
|
-
index = client.init_index(get_test_index_name('test_custom_requester'))
|
21
|
-
|
22
|
-
response = index.search('test')
|
23
|
-
|
24
|
-
refute_nil response[:hits]
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_without_providing_config
|
28
|
-
client = Algolia::Search::Client.create(APPLICATION_ID_1, ADMIN_KEY_1)
|
29
|
-
index = client.init_index(get_test_index_name('test_no_config'))
|
30
|
-
index.save_object!({ name: 'test', data: 10 }, { auto_generate_object_id_if_not_exist: true })
|
31
|
-
response = index.search('test')
|
32
|
-
|
33
|
-
refute_empty response[:hits]
|
34
|
-
assert_equal 'test', response[:hits][0][:name]
|
35
|
-
assert_equal 10, response[:hits][0][:data]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'copy and move index' do
|
40
|
-
def before_all
|
41
|
-
super
|
42
|
-
@index_name = get_test_index_name('copy_index')
|
43
|
-
@index = @@search_client.init_index(@index_name)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_copy_and_move_index
|
47
|
-
responses = Algolia::MultipleResponse.new
|
48
|
-
|
49
|
-
objects = [
|
50
|
-
{ objectID: 'one', company: 'apple' },
|
51
|
-
{ objectID: 'two', company: 'algolia' }
|
52
|
-
]
|
53
|
-
responses.push(@index.save_objects(objects))
|
54
|
-
|
55
|
-
settings = { attributesForFaceting: ['company'] }
|
56
|
-
responses.push(@index.set_settings(settings))
|
57
|
-
|
58
|
-
synonym = {
|
59
|
-
objectID: 'google_placeholder',
|
60
|
-
type: 'placeholder',
|
61
|
-
placeholder: '<GOOG>',
|
62
|
-
replacements: %w(Google GOOG)
|
63
|
-
}
|
64
|
-
responses.push(@index.save_synonym(synonym))
|
65
|
-
|
66
|
-
rule = {
|
67
|
-
objectID: 'company_auto_faceting',
|
68
|
-
condition: {
|
69
|
-
anchoring: 'contains',
|
70
|
-
pattern: '{facet:company}'
|
71
|
-
},
|
72
|
-
consequence: {
|
73
|
-
params: { automaticFacetFilters: ['company'] }
|
74
|
-
}
|
75
|
-
}
|
76
|
-
responses.push(@index.save_rule(rule))
|
77
|
-
|
78
|
-
responses.wait
|
79
|
-
|
80
|
-
copy_settings_index = @@search_client.init_index(get_test_index_name('copy_index_settings'))
|
81
|
-
copy_rules_index = @@search_client.init_index(get_test_index_name('copy_index_rules'))
|
82
|
-
copy_synonyms_index = @@search_client.init_index(get_test_index_name('copy_index_synonyms'))
|
83
|
-
copy_full_copy_index = @@search_client.init_index(get_test_index_name('copy_index_full_copy'))
|
84
|
-
@@search_client.copy_settings!(@index_name, copy_settings_index.name)
|
85
|
-
@@search_client.copy_rules!(@index_name, copy_rules_index.name)
|
86
|
-
@@search_client.copy_synonyms!(@index_name, copy_synonyms_index.name)
|
87
|
-
@@search_client.copy_index!(@index_name, copy_full_copy_index.name)
|
88
|
-
|
89
|
-
assert_equal @index.get_settings, copy_settings_index.get_settings
|
90
|
-
assert_equal @index.get_rule(rule[:objectID]), copy_rules_index.get_rule(rule[:objectID])
|
91
|
-
assert_equal @index.get_synonym(synonym[:objectID]), copy_synonyms_index.get_synonym(synonym[:objectID])
|
92
|
-
assert_equal @index.get_settings, copy_full_copy_index.get_settings
|
93
|
-
assert_equal @index.get_rule(rule[:objectID]), copy_full_copy_index.get_rule(rule[:objectID])
|
94
|
-
assert_equal @index.get_synonym(synonym[:objectID]), copy_full_copy_index.get_synonym(synonym[:objectID])
|
95
|
-
|
96
|
-
moved_index = @@search_client.init_index(get_test_index_name('move_index'))
|
97
|
-
@@search_client.move_index!(@index_name, moved_index.name)
|
98
|
-
|
99
|
-
moved_index.get_synonym('google_placeholder')
|
100
|
-
moved_index.get_rule('company_auto_faceting')
|
101
|
-
assert_equal moved_index.get_settings[:attributesForFaceting], ['company']
|
102
|
-
|
103
|
-
moved_index.browse_objects.each do |obj|
|
104
|
-
assert_includes objects, obj
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe 'MCM' do
|
110
|
-
def before_all
|
111
|
-
super
|
112
|
-
@mcm_client = Algolia::Search::Client.create(MCM_APPLICATION_ID, MCM_ADMIN_KEY)
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_mcm
|
116
|
-
clusters = @mcm_client.list_clusters
|
117
|
-
assert_equal 2, clusters[:clusters].length
|
118
|
-
|
119
|
-
cluster_name = clusters[:clusters][0][:clusterName]
|
120
|
-
|
121
|
-
mcm_user_id0 = get_mcm_user_name(0)
|
122
|
-
mcm_user_id1 = get_mcm_user_name(1)
|
123
|
-
mcm_user_id2 = get_mcm_user_name(2)
|
124
|
-
|
125
|
-
@mcm_client.assign_user_id(mcm_user_id0, cluster_name)
|
126
|
-
@mcm_client.assign_user_ids([mcm_user_id1, mcm_user_id2], cluster_name)
|
127
|
-
|
128
|
-
0.upto(2) do |i|
|
129
|
-
retrieved_user = retrieve_user_id(i)
|
130
|
-
assert_equal(retrieved_user, {
|
131
|
-
userID: get_mcm_user_name(i),
|
132
|
-
clusterName: cluster_name,
|
133
|
-
nbRecords: 0,
|
134
|
-
dataSize: 0
|
135
|
-
})
|
136
|
-
end
|
137
|
-
|
138
|
-
refute_equal 0, @mcm_client.list_user_ids[:userIDs].length
|
139
|
-
refute_equal 0, @mcm_client.get_top_user_ids[:topUsers].length
|
140
|
-
|
141
|
-
0.upto(2) do |i|
|
142
|
-
remove_user_id(i)
|
143
|
-
end
|
144
|
-
|
145
|
-
0.upto(2) do |i|
|
146
|
-
assert_removed(i)
|
147
|
-
end
|
148
|
-
|
149
|
-
has_pending_mappings = @mcm_client.pending_mappings?({ retrieveMappings: true })
|
150
|
-
refute_nil has_pending_mappings
|
151
|
-
assert has_pending_mappings[:pending]
|
152
|
-
assert has_pending_mappings[:clusters]
|
153
|
-
assert_instance_of Hash, has_pending_mappings[:clusters]
|
154
|
-
|
155
|
-
has_pending_mappings = @mcm_client.pending_mappings?({ retrieveMappings: false })
|
156
|
-
refute_nil has_pending_mappings
|
157
|
-
assert has_pending_mappings[:pending]
|
158
|
-
refute has_pending_mappings[:clusters]
|
159
|
-
end
|
160
|
-
|
161
|
-
def retrieve_user_id(number)
|
162
|
-
loop do
|
163
|
-
begin
|
164
|
-
return @mcm_client.get_user_id(get_mcm_user_name(number))
|
165
|
-
rescue Algolia::AlgoliaHttpError => e
|
166
|
-
if e.code != 404
|
167
|
-
raise StandardError
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def remove_user_id(number)
|
174
|
-
loop do
|
175
|
-
begin
|
176
|
-
return @mcm_client.remove_user_id(get_mcm_user_name(number))
|
177
|
-
rescue Algolia::AlgoliaHttpError => e
|
178
|
-
if e.code != 400
|
179
|
-
raise StandardError
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def assert_removed(number)
|
186
|
-
loop do
|
187
|
-
begin
|
188
|
-
return @mcm_client.get_user_id(get_mcm_user_name(number))
|
189
|
-
rescue Algolia::AlgoliaHttpError => e
|
190
|
-
if e.code == 404
|
191
|
-
return true
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
describe 'API keys' do
|
199
|
-
def before_all
|
200
|
-
super
|
201
|
-
response = @@search_client.add_api_key!(['search'], {
|
202
|
-
description: 'A description',
|
203
|
-
indexes: ['index'],
|
204
|
-
maxHitsPerQuery: 1000,
|
205
|
-
maxQueriesPerIPPerHour: 1000,
|
206
|
-
queryParameters: 'typoTolerance=strict',
|
207
|
-
referers: ['referer'],
|
208
|
-
validity: 600
|
209
|
-
})
|
210
|
-
@api_key = @@search_client.get_api_key(response.raw_response[:key])
|
211
|
-
end
|
212
|
-
|
213
|
-
def teardown
|
214
|
-
@@search_client.delete_api_key!(@api_key[:value])
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_api_keys
|
218
|
-
assert_equal ['search'], @api_key[:acl]
|
219
|
-
assert_equal 'A description', @api_key[:description]
|
220
|
-
|
221
|
-
api_keys = @@search_client.list_api_keys[:keys].map do |key|
|
222
|
-
key[:value]
|
223
|
-
end
|
224
|
-
assert_includes api_keys, @api_key[:value]
|
225
|
-
|
226
|
-
@@search_client.update_api_key!(@api_key[:value], { maxHitsPerQuery: 42 })
|
227
|
-
updated_api_key = retry_test do
|
228
|
-
@@search_client.get_api_key(@api_key[:value], test: 'test')
|
229
|
-
end
|
230
|
-
assert_equal 42, updated_api_key[:maxHitsPerQuery]
|
231
|
-
|
232
|
-
@@search_client.delete_api_key!(@api_key[:value])
|
233
|
-
|
234
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
235
|
-
@@search_client.get_api_key(@api_key[:value])
|
236
|
-
end
|
237
|
-
|
238
|
-
assert_equal 'Key does not exist', exception.message
|
239
|
-
|
240
|
-
retry_test do
|
241
|
-
@@search_client.restore_api_key!(@api_key[:value])
|
242
|
-
end
|
243
|
-
|
244
|
-
restored_key = retry_test do
|
245
|
-
@@search_client.get_api_key(@api_key[:value])
|
246
|
-
end
|
247
|
-
|
248
|
-
refute_nil restored_key
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
describe 'Get logs' do
|
253
|
-
def test_logs
|
254
|
-
@@search_client.list_indexes
|
255
|
-
@@search_client.list_indexes
|
256
|
-
|
257
|
-
assert_equal 2, @@search_client.get_logs({
|
258
|
-
length: 2,
|
259
|
-
offset: 0,
|
260
|
-
type: 'all'
|
261
|
-
})[:logs].length
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
describe 'Multiple Operations' do
|
266
|
-
def before_all
|
267
|
-
@index1 = @@search_client.init_index(get_test_index_name('multiple_operations'))
|
268
|
-
@index2 = @@search_client.init_index(get_test_index_name('multiple_operations_dev'))
|
269
|
-
end
|
270
|
-
|
271
|
-
def test_multiple_operations
|
272
|
-
index_name1 = @index1.name
|
273
|
-
index_name2 = @index2.name
|
274
|
-
|
275
|
-
response = @@search_client.multiple_batch!([
|
276
|
-
{ indexName: index_name1, action: 'addObject', body: { firstname: 'Jimmie' } },
|
277
|
-
{ indexName: index_name1, action: 'addObject', body: { firstname: 'Jimmie' } },
|
278
|
-
{ indexName: index_name2, action: 'addObject', body: { firstname: 'Jimmie' } },
|
279
|
-
{ indexName: index_name2, action: 'addObject', body: { firstname: 'Jimmie' } }
|
280
|
-
])
|
281
|
-
|
282
|
-
object_ids = response.raw_response[:objectIDs]
|
283
|
-
objects = @@search_client.multiple_get_objects([
|
284
|
-
{ indexName: index_name1, objectID: object_ids[0] },
|
285
|
-
{ indexName: index_name1, objectID: object_ids[1] },
|
286
|
-
{ indexName: index_name2, objectID: object_ids[2] },
|
287
|
-
{ indexName: index_name2, objectID: object_ids[3] }
|
288
|
-
])[:results]
|
289
|
-
|
290
|
-
assert_equal object_ids[0], objects[0][:objectID]
|
291
|
-
assert_equal object_ids[1], objects[1][:objectID]
|
292
|
-
assert_equal object_ids[2], objects[2][:objectID]
|
293
|
-
assert_equal object_ids[3], objects[3][:objectID]
|
294
|
-
|
295
|
-
results = @@search_client.multiple_queries([
|
296
|
-
{ indexName: index_name1, params: to_query_string({ query: '', hitsPerPage: 2 }) },
|
297
|
-
{ indexName: index_name2, params: { query: '', hitsPerPage: 2 } }
|
298
|
-
], { strategy: 'none' })[:results]
|
299
|
-
|
300
|
-
assert_equal 2, results.length
|
301
|
-
assert_equal 2, results[0][:hits].length
|
302
|
-
assert_equal 2, results[0][:nbHits]
|
303
|
-
assert_equal 2, results[1][:hits].length
|
304
|
-
assert_equal 2, results[1][:nbHits]
|
305
|
-
|
306
|
-
results = @@search_client.multiple_queries([
|
307
|
-
{ indexName: index_name1, params: to_query_string({ query: '', hitsPerPage: 2 }) },
|
308
|
-
{ indexName: index_name2, params: to_query_string({ query: '', hitsPerPage: 2 }) }
|
309
|
-
], { strategy: 'stopIfEnoughMatches' })[:results]
|
310
|
-
|
311
|
-
assert_equal 2, results.length
|
312
|
-
assert_equal 2, results[0][:hits].length
|
313
|
-
assert_equal 2, results[0][:nbHits]
|
314
|
-
assert_equal 0, results[1][:hits].length
|
315
|
-
assert_equal 0, results[1][:nbHits]
|
316
|
-
end
|
317
|
-
|
318
|
-
describe 'Secured API keys' do
|
319
|
-
def test_secured_api_keys
|
320
|
-
@index1 = @@search_client.init_index(get_test_index_name('secured_api_keys'))
|
321
|
-
@index2 = @@search_client.init_index(get_test_index_name('secured_api_keys_dev'))
|
322
|
-
@index1.save_object!({ objectID: 'one' })
|
323
|
-
@index2.save_object!({ objectID: 'one' })
|
324
|
-
|
325
|
-
now = Time.now.to_i
|
326
|
-
secured_api_key = Algolia::Search::Client.generate_secured_api_key(SEARCH_KEY_1, {
|
327
|
-
validUntil: now + (10 * 60),
|
328
|
-
restrictIndices: @index1.name
|
329
|
-
})
|
330
|
-
|
331
|
-
secured_client = Algolia::Search::Client.create(APPLICATION_ID_1, secured_api_key)
|
332
|
-
secured_index1 = secured_client.init_index(@index1.name)
|
333
|
-
secured_index2 = secured_client.init_index(@index2.name)
|
334
|
-
|
335
|
-
res = retry_test do
|
336
|
-
secured_index1.search('')
|
337
|
-
end
|
338
|
-
|
339
|
-
assert_equal 1, res[:hits].length
|
340
|
-
|
341
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
342
|
-
secured_index2.search('')
|
343
|
-
end
|
344
|
-
|
345
|
-
assert_equal 403, exception.code
|
346
|
-
assert_equal 'Index not allowed with this API key', exception.message
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
describe 'Expired Secured API keys' do
|
351
|
-
def test_expired_secured_api_keys
|
352
|
-
now = Time.now.to_i
|
353
|
-
secured_api_key = Algolia::Search::Client.generate_secured_api_key('foo', {
|
354
|
-
validUntil: now - (10 * 60)
|
355
|
-
})
|
356
|
-
remaining = Algolia::Search::Client.get_secured_api_key_remaining_validity(secured_api_key)
|
357
|
-
assert remaining < 0
|
358
|
-
|
359
|
-
secured_api_key = Algolia::Search::Client.generate_secured_api_key('foo', {
|
360
|
-
validUntil: now + (10 * 60)
|
361
|
-
})
|
362
|
-
remaining = Algolia::Search::Client.get_secured_api_key_remaining_validity(secured_api_key)
|
363
|
-
assert remaining > 0
|
364
|
-
|
365
|
-
secured_api_key = Algolia::Search::Client.generate_secured_api_key('foo', {})
|
366
|
-
exception = assert_raises Algolia::AlgoliaError do
|
367
|
-
Algolia::Search::Client.get_secured_api_key_remaining_validity(secured_api_key)
|
368
|
-
end
|
369
|
-
|
370
|
-
assert_equal 'The SecuredAPIKey doesn\'t have a validUntil parameter.', exception.message
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
describe 'Custom Dictionaries' do
|
375
|
-
def before_all
|
376
|
-
@client = Algolia::Search::Client.create(APPLICATION_ID_2, ADMIN_KEY_2)
|
377
|
-
end
|
378
|
-
|
379
|
-
def test_stopwords_dictionaries
|
380
|
-
entry_id = SecureRandom.hex
|
381
|
-
assert_equal 0, @client.search_dictionary_entries('stopwords', entry_id)[:nbHits]
|
382
|
-
|
383
|
-
entry = {
|
384
|
-
objectID: entry_id,
|
385
|
-
language: 'en',
|
386
|
-
word: 'down'
|
387
|
-
}
|
388
|
-
@client.save_dictionary_entries!('stopwords', [entry])
|
389
|
-
|
390
|
-
stopwords = @client.search_dictionary_entries('stopwords', entry_id)
|
391
|
-
assert_equal 1, stopwords[:nbHits]
|
392
|
-
assert_equal stopwords[:hits][0][:objectID], entry[:objectID]
|
393
|
-
assert_equal stopwords[:hits][0][:word], entry[:word]
|
394
|
-
|
395
|
-
@client.delete_dictionary_entries!('stopwords', [entry_id])
|
396
|
-
assert_equal 0, @client.search_dictionary_entries('stopwords', entry_id)[:nbHits]
|
397
|
-
|
398
|
-
old_dictionary_state = @client.search_dictionary_entries('stopwords', '')
|
399
|
-
old_dictionary_entries = old_dictionary_state[:hits].map do |hit|
|
400
|
-
hit.reject { |key| key == :type }
|
401
|
-
end
|
402
|
-
|
403
|
-
@client.save_dictionary_entries!('stopwords', [entry])
|
404
|
-
assert_equal 1, @client.search_dictionary_entries('stopwords', entry_id)[:nbHits]
|
405
|
-
|
406
|
-
@client.replace_dictionary_entries!('stopwords', old_dictionary_entries)
|
407
|
-
assert_equal 0, @client.search_dictionary_entries('stopwords', entry_id)[:nbHits]
|
408
|
-
|
409
|
-
stopwords_settings = {
|
410
|
-
disableStandardEntries: {
|
411
|
-
stopwords: {
|
412
|
-
en: true
|
413
|
-
}
|
414
|
-
}
|
415
|
-
}
|
416
|
-
|
417
|
-
@client.set_dictionary_settings!(stopwords_settings)
|
418
|
-
|
419
|
-
assert_equal @client.get_dictionary_settings, stopwords_settings
|
420
|
-
end
|
421
|
-
|
422
|
-
def test_plurals_dictionaries
|
423
|
-
entry_id = SecureRandom.hex
|
424
|
-
assert_equal 0, @client.search_dictionary_entries('plurals', entry_id)[:nbHits]
|
425
|
-
|
426
|
-
entry = {
|
427
|
-
objectID: entry_id,
|
428
|
-
language: 'fr',
|
429
|
-
words: %w(cheval chevaux)
|
430
|
-
}
|
431
|
-
@client.save_dictionary_entries!('plurals', [entry])
|
432
|
-
|
433
|
-
plurals = @client.search_dictionary_entries('plurals', entry_id)
|
434
|
-
assert_equal 1, plurals[:nbHits]
|
435
|
-
assert_equal plurals[:hits][0][:objectID], entry[:objectID]
|
436
|
-
assert_equal plurals[:hits][0][:words], entry[:words]
|
437
|
-
|
438
|
-
@client.delete_dictionary_entries!('plurals', [entry_id])
|
439
|
-
assert_equal 0, @client.search_dictionary_entries('plurals', entry_id)[:nbHits]
|
440
|
-
end
|
441
|
-
|
442
|
-
def test_compounds_dictionaries
|
443
|
-
entry_id = SecureRandom.hex
|
444
|
-
assert_equal 0, @client.search_dictionary_entries('compounds', entry_id)[:nbHits]
|
445
|
-
|
446
|
-
entry = {
|
447
|
-
objectID: entry_id,
|
448
|
-
language: 'de',
|
449
|
-
word: 'kopfschmerztablette',
|
450
|
-
decomposition: %w(kopf schmerz tablette)
|
451
|
-
}
|
452
|
-
@client.save_dictionary_entries!('compounds', [entry])
|
453
|
-
|
454
|
-
compounds = @client.search_dictionary_entries('compounds', entry_id)
|
455
|
-
assert_equal 1, compounds[:nbHits]
|
456
|
-
assert_equal compounds[:hits][0][:objectID], entry[:objectID]
|
457
|
-
assert_equal compounds[:hits][0][:word], entry[:word]
|
458
|
-
assert_equal compounds[:hits][0][:decomposition], entry[:decomposition]
|
459
|
-
|
460
|
-
@client.delete_dictionary_entries!('compounds', [entry_id])
|
461
|
-
assert_equal 0, @client.search_dictionary_entries('compounds', entry_id)[:nbHits]
|
462
|
-
end
|
463
|
-
end
|
464
|
-
end
|
465
|
-
end
|