algolia 2.3.4 → 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 -93
- 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 +522 -217
- 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 -92
- 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,729 +0,0 @@
|
|
1
|
-
require 'httpclient'
|
2
|
-
require_relative 'base_test'
|
3
|
-
|
4
|
-
class SearchIndexTest < BaseTest
|
5
|
-
describe 'pass request options' do
|
6
|
-
def before_all
|
7
|
-
super
|
8
|
-
@index = @@search_client.init_index(get_test_index_name('options'))
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_with_wrong_credentials
|
12
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
13
|
-
@index.save_object(generate_object('111'), {
|
14
|
-
headers: {
|
15
|
-
'X-Algolia-Application-Id' => 'XXXXX',
|
16
|
-
'X-Algolia-API-Key' => 'XXXXX'
|
17
|
-
}
|
18
|
-
})
|
19
|
-
end
|
20
|
-
|
21
|
-
assert_equal 'Invalid Application-ID or API key', exception.message
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'save objects' do
|
26
|
-
def before_all
|
27
|
-
super
|
28
|
-
@index = @@search_client.init_index(get_test_index_name('indexing'))
|
29
|
-
end
|
30
|
-
|
31
|
-
def retrieve_last_object_ids(responses)
|
32
|
-
responses.last.raw_response[:objectIDs]
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_save_objects
|
36
|
-
responses = Algolia::MultipleResponse.new
|
37
|
-
object_ids = []
|
38
|
-
|
39
|
-
obj1 = generate_object('obj1')
|
40
|
-
responses.push(@index.save_object(obj1))
|
41
|
-
object_ids.push(retrieve_last_object_ids(responses))
|
42
|
-
obj2 = generate_object
|
43
|
-
response = @index.save_object(obj2, { auto_generate_object_id_if_not_exist: true })
|
44
|
-
responses.push(response)
|
45
|
-
object_ids.push(retrieve_last_object_ids(responses))
|
46
|
-
responses.push(@index.save_objects([]))
|
47
|
-
object_ids.push(retrieve_last_object_ids(responses))
|
48
|
-
obj3 = generate_object('obj3')
|
49
|
-
obj4 = generate_object('obj4')
|
50
|
-
responses.push(@index.save_objects([obj3, obj4]))
|
51
|
-
object_ids.push(retrieve_last_object_ids(responses))
|
52
|
-
obj5 = generate_object
|
53
|
-
obj6 = generate_object
|
54
|
-
responses.push(@index.save_objects([obj5, obj6], { auto_generate_object_id_if_not_exist: true }))
|
55
|
-
object_ids.push(retrieve_last_object_ids(responses))
|
56
|
-
object_ids.flatten!
|
57
|
-
objects = 1.upto(1000).map do |i|
|
58
|
-
generate_object(i.to_s)
|
59
|
-
end
|
60
|
-
|
61
|
-
@index.config.batch_size = 100
|
62
|
-
responses.push(@index.save_objects(objects))
|
63
|
-
responses.wait
|
64
|
-
|
65
|
-
assert_equal obj1[:property], @index.get_object(object_ids[0])[:property]
|
66
|
-
assert_equal obj2[:property], @index.get_object(object_ids[1])[:property]
|
67
|
-
assert_equal obj3[:property], @index.get_object(object_ids[2])[:property]
|
68
|
-
assert_equal obj4[:property], @index.get_object(object_ids[3])[:property]
|
69
|
-
assert_equal obj5[:property], @index.get_object(object_ids[4])[:property]
|
70
|
-
assert_equal obj6[:property], @index.get_object(object_ids[5])[:property]
|
71
|
-
|
72
|
-
results = @index.get_objects((1..1000).to_a)[:results]
|
73
|
-
|
74
|
-
results.each do |obj|
|
75
|
-
assert_includes(objects, obj)
|
76
|
-
end
|
77
|
-
|
78
|
-
assert_equal objects.length, results.length
|
79
|
-
browsed_objects = []
|
80
|
-
@index.browse_objects do |hit|
|
81
|
-
browsed_objects.push(hit)
|
82
|
-
end
|
83
|
-
|
84
|
-
assert_equal 1006, browsed_objects.length
|
85
|
-
objects.each do |obj|
|
86
|
-
assert_includes(browsed_objects, obj)
|
87
|
-
end
|
88
|
-
|
89
|
-
[obj1, obj3, obj4].each do |obj|
|
90
|
-
assert_includes(browsed_objects, obj)
|
91
|
-
end
|
92
|
-
|
93
|
-
responses = Algolia::MultipleResponse.new
|
94
|
-
|
95
|
-
obj1[:property] = 'new property'
|
96
|
-
responses.push(@index.partial_update_object(obj1))
|
97
|
-
|
98
|
-
obj3[:property] = 'new property 3'
|
99
|
-
obj4[:property] = 'new property 4'
|
100
|
-
responses.push(@index.partial_update_objects([obj3, obj4]))
|
101
|
-
|
102
|
-
responses.wait
|
103
|
-
|
104
|
-
assert_equal obj1[:property], @index.get_object(object_ids[0])[:property]
|
105
|
-
assert_equal obj3[:property], @index.get_object(object_ids[2])[:property]
|
106
|
-
assert_equal obj4[:property], @index.get_object(object_ids[3])[:property]
|
107
|
-
|
108
|
-
delete_by_obj = { objectID: 'obj_del_by', _tags: 'algolia', property: 'property' }
|
109
|
-
@index.save_object!(delete_by_obj)
|
110
|
-
|
111
|
-
responses = Algolia::MultipleResponse.new
|
112
|
-
|
113
|
-
responses.push(@index.delete_object(object_ids.shift))
|
114
|
-
responses.push(@index.delete_by({ tagFilters: ['algolia'] }))
|
115
|
-
responses.push(@index.delete_objects(object_ids))
|
116
|
-
responses.push(@index.clear_objects)
|
117
|
-
|
118
|
-
responses.wait
|
119
|
-
|
120
|
-
browsed_objects = []
|
121
|
-
@index.browse_objects do |hit|
|
122
|
-
browsed_objects.push(hit)
|
123
|
-
end
|
124
|
-
|
125
|
-
assert_equal 0, browsed_objects.length
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_save_object_without_object_id_and_fail
|
129
|
-
exception = assert_raises Algolia::AlgoliaError do
|
130
|
-
@index.save_object(generate_object)
|
131
|
-
end
|
132
|
-
|
133
|
-
assert_equal "Missing 'objectID'", exception.message
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_save_objects_with_single_object_and_fail
|
137
|
-
exception = assert_raises Algolia::AlgoliaError do
|
138
|
-
@index.save_objects(generate_object)
|
139
|
-
end
|
140
|
-
|
141
|
-
assert_equal 'argument must be an array of objects', exception.message
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_save_objects_with_array_of_integers_and_fail
|
145
|
-
exception = assert_raises Algolia::AlgoliaError do
|
146
|
-
@index.save_objects([2222, 3333])
|
147
|
-
end
|
148
|
-
|
149
|
-
assert_equal 'argument must be an array of object, got: 2222', exception.message
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
describe 'settings' do
|
154
|
-
def before_all
|
155
|
-
super
|
156
|
-
@index_name = get_test_index_name('settings')
|
157
|
-
@index = @@search_client.init_index(@index_name)
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_settings
|
161
|
-
@index.save_object!(generate_object('obj1'))
|
162
|
-
|
163
|
-
settings = {
|
164
|
-
searchableAttributes: %w(attribute1 attribute2 attribute3 ordered(attribute4) unordered(attribute5)),
|
165
|
-
attributesForFaceting: %w(attribute1 filterOnly(attribute2) searchable(attribute3)),
|
166
|
-
unretrievableAttributes: %w(
|
167
|
-
attribute1
|
168
|
-
attribute2
|
169
|
-
),
|
170
|
-
attributesToRetrieve: %w(
|
171
|
-
attribute3
|
172
|
-
attribute4
|
173
|
-
),
|
174
|
-
ranking: %w(asc(attribute1) desc(attribute2) attribute custom exact filters geo proximity typo words),
|
175
|
-
customRanking: %w(asc(attribute1) desc(attribute1)),
|
176
|
-
replicas: [
|
177
|
-
@index_name + '_replica1',
|
178
|
-
@index_name + '_replica2'
|
179
|
-
],
|
180
|
-
maxValuesPerFacet: 100,
|
181
|
-
sortFacetValuesBy: 'count',
|
182
|
-
attributesToHighlight: %w(
|
183
|
-
attribute1
|
184
|
-
attribute2
|
185
|
-
),
|
186
|
-
attributesToSnippet: %w(attribute1:10 attribute2:8),
|
187
|
-
highlightPreTag: '<strong>',
|
188
|
-
highlightPostTag: '</strong>',
|
189
|
-
snippetEllipsisText: ' and so on.',
|
190
|
-
restrictHighlightAndSnippetArrays: true,
|
191
|
-
hitsPerPage: 42,
|
192
|
-
paginationLimitedTo: 43,
|
193
|
-
minWordSizefor1Typo: 2,
|
194
|
-
minWordSizefor2Typos: 6,
|
195
|
-
typoTolerance: 'false',
|
196
|
-
allowTyposOnNumericTokens: false,
|
197
|
-
ignorePlurals: true,
|
198
|
-
disableTypoToleranceOnAttributes: %w(
|
199
|
-
attribute1
|
200
|
-
attribute2
|
201
|
-
),
|
202
|
-
disableTypoToleranceOnWords: %w(
|
203
|
-
word1
|
204
|
-
word2
|
205
|
-
),
|
206
|
-
separatorsToIndex: '()[]',
|
207
|
-
queryType: 'prefixNone',
|
208
|
-
removeWordsIfNoResults: 'allOptional',
|
209
|
-
advancedSyntax: true,
|
210
|
-
optionalWords: %w(
|
211
|
-
word1
|
212
|
-
word2
|
213
|
-
),
|
214
|
-
removeStopWords: true,
|
215
|
-
disablePrefixOnAttributes: %w(
|
216
|
-
attribute1
|
217
|
-
attribute2
|
218
|
-
),
|
219
|
-
disableExactOnAttributes: %w(
|
220
|
-
attribute1
|
221
|
-
attribute2
|
222
|
-
),
|
223
|
-
exactOnSingleWordQuery: 'word',
|
224
|
-
enableRules: false,
|
225
|
-
numericAttributesForFiltering: %w(
|
226
|
-
attribute1
|
227
|
-
attribute2
|
228
|
-
),
|
229
|
-
allowCompressionOfIntegerArray: true,
|
230
|
-
attributeForDistinct: 'attribute1',
|
231
|
-
distinct: 2,
|
232
|
-
replaceSynonymsInHighlight: false,
|
233
|
-
minProximity: 7,
|
234
|
-
responseFields: %w(
|
235
|
-
hits
|
236
|
-
hitsPerPage
|
237
|
-
),
|
238
|
-
maxFacetHits: 100,
|
239
|
-
camelCaseAttributes: %w(
|
240
|
-
attribute1
|
241
|
-
attribute2
|
242
|
-
),
|
243
|
-
decompoundedAttributes: {
|
244
|
-
de: %w(attribute1 attribute2),
|
245
|
-
fi: ['attribute3']
|
246
|
-
},
|
247
|
-
keepDiacriticsOnCharacters: 'øé',
|
248
|
-
queryLanguages: %w(
|
249
|
-
en
|
250
|
-
fr
|
251
|
-
),
|
252
|
-
alternativesAsExact: ['ignorePlurals'],
|
253
|
-
advancedSyntaxFeatures: ['exactPhrase'],
|
254
|
-
userData: {
|
255
|
-
customUserData: 42.0
|
256
|
-
},
|
257
|
-
indexLanguages: ['ja']
|
258
|
-
}
|
259
|
-
|
260
|
-
@index.set_settings!(settings)
|
261
|
-
|
262
|
-
# Because the response settings dict contains the extra version key, we
|
263
|
-
# also add it to the expected settings dict to prevent the test to fail
|
264
|
-
# for a missing key.
|
265
|
-
settings[:version] = 2
|
266
|
-
|
267
|
-
assert_equal @index.get_settings, settings
|
268
|
-
|
269
|
-
settings[:typoTolerance] = 'min'
|
270
|
-
settings[:ignorePlurals] = %w(en fr)
|
271
|
-
settings[:removeStopWords] = %w(en fr)
|
272
|
-
settings[:distinct] = true
|
273
|
-
|
274
|
-
@index.set_settings!(settings)
|
275
|
-
|
276
|
-
assert_equal @index.get_settings, settings
|
277
|
-
|
278
|
-
# check that the forwardToReplicas parameter is passed correctly
|
279
|
-
assert @index.set_settings!(settings, { forwardToReplicas: true })
|
280
|
-
end
|
281
|
-
|
282
|
-
# Check version 1 API calling (ref. PR #473)
|
283
|
-
def test_version_param
|
284
|
-
@index.save_object!(generate_object('obj1')) # create index
|
285
|
-
|
286
|
-
# Check response's version value by actual access
|
287
|
-
assert_equal 2, @index.get_settings[:version]
|
288
|
-
assert_equal 1, @index.get_settings(getVersion: 1)[:version]
|
289
|
-
assert_equal 2, @index.get_settings(getVersion: 2)[:version]
|
290
|
-
|
291
|
-
# Check API endpoint handling by mock access
|
292
|
-
requester = MockRequester.new
|
293
|
-
client = Algolia::Search::Client.new(@@search_config, http_requester: requester)
|
294
|
-
index = client.init_index(@index_name)
|
295
|
-
|
296
|
-
index.get_settings # default
|
297
|
-
index.get_settings(getVersion: 1)
|
298
|
-
index.get_settings(getVersion: 2)
|
299
|
-
|
300
|
-
assert_requests(
|
301
|
-
requester,
|
302
|
-
[
|
303
|
-
{ method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=2" },
|
304
|
-
{ method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=1" },
|
305
|
-
{ method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=2" }
|
306
|
-
]
|
307
|
-
)
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
describe 'search' do
|
312
|
-
def before_all
|
313
|
-
super
|
314
|
-
@index = @@search_client.init_index(get_test_index_name('search'))
|
315
|
-
@index.save_objects!(create_employee_records, { auto_generate_object_id_if_not_exist: true })
|
316
|
-
@index.set_settings!(attributesForFaceting: ['searchable(company)'])
|
317
|
-
end
|
318
|
-
|
319
|
-
def test_search_objects
|
320
|
-
response = @index.search('algolia')
|
321
|
-
|
322
|
-
assert_equal 2, response[:nbHits]
|
323
|
-
assert_equal 0, Algolia::Search::Index.get_object_position(response, 'nicolas-dessaigne')
|
324
|
-
assert_equal 1, Algolia::Search::Index.get_object_position(response, 'julien-lemoine')
|
325
|
-
assert_equal(-1, Algolia::Search::Index.get_object_position(response, ''))
|
326
|
-
end
|
327
|
-
|
328
|
-
def test_find_objects
|
329
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
330
|
-
@index.find_object(-> (_hit) { false }, { query: '', paginate: false })
|
331
|
-
end
|
332
|
-
|
333
|
-
assert_equal 'Object not found', exception.message
|
334
|
-
|
335
|
-
response = @index.find_object(-> (_hit) { true }, { query: '', paginate: false })
|
336
|
-
assert_equal 0, response[:position]
|
337
|
-
assert_equal 0, response[:page]
|
338
|
-
|
339
|
-
condition = -> (obj) do
|
340
|
-
obj.has_key?(:company) && obj[:company] == 'Apple'
|
341
|
-
end
|
342
|
-
|
343
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
344
|
-
@index.find_object(condition, { query: 'algolia', paginate: false })
|
345
|
-
end
|
346
|
-
|
347
|
-
assert_equal 'Object not found', exception.message
|
348
|
-
|
349
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
350
|
-
@index.find_object(condition, { query: '', paginate: false, hitsPerPage: 5 })
|
351
|
-
end
|
352
|
-
|
353
|
-
assert_equal 'Object not found', exception.message
|
354
|
-
|
355
|
-
response = @index.find_object(condition, { query: '', paginate: true, hitsPerPage: 5 })
|
356
|
-
assert_equal 0, response[:position]
|
357
|
-
assert_equal 2, response[:page]
|
358
|
-
|
359
|
-
response = @index.search('elon', { clickAnalytics: true })
|
360
|
-
|
361
|
-
refute_nil response[:queryID]
|
362
|
-
|
363
|
-
response = @index.search('elon', { facets: '*', facetFilters: ['company:tesla'] })
|
364
|
-
|
365
|
-
assert_equal 1, response[:nbHits]
|
366
|
-
|
367
|
-
response = @index.search('elon', { facets: '*', filters: '(company:tesla OR company:spacex)' })
|
368
|
-
|
369
|
-
assert_equal 2, response[:nbHits]
|
370
|
-
|
371
|
-
response = @index.search_for_facet_values('company', 'a')
|
372
|
-
|
373
|
-
assert(response[:facetHits].any? { |hit| hit[:value] == 'Algolia' })
|
374
|
-
assert(response[:facetHits].any? { |hit| hit[:value] == 'Amazon' })
|
375
|
-
assert(response[:facetHits].any? { |hit| hit[:value] == 'Apple' })
|
376
|
-
assert(response[:facetHits].any? { |hit| hit[:value] == 'Arista Networks' })
|
377
|
-
end
|
378
|
-
end
|
379
|
-
|
380
|
-
describe 'synonyms' do
|
381
|
-
def before_all
|
382
|
-
super
|
383
|
-
@index = @@search_client.init_index(get_test_index_name('synonyms'))
|
384
|
-
end
|
385
|
-
|
386
|
-
def test_synonyms
|
387
|
-
responses = Algolia::MultipleResponse.new
|
388
|
-
responses.push(@index.save_objects([
|
389
|
-
{ console: 'Sony PlayStation <PLAYSTATIONVERSION>' },
|
390
|
-
{ console: 'Nintendo Switch' },
|
391
|
-
{ console: 'Nintendo Wii U' },
|
392
|
-
{ console: 'Nintendo Game Boy Advance' },
|
393
|
-
{ console: 'Microsoft Xbox' },
|
394
|
-
{ console: 'Microsoft Xbox 360' },
|
395
|
-
{ console: 'Microsoft Xbox One' }
|
396
|
-
], { auto_generate_object_id_if_not_exist: true }))
|
397
|
-
|
398
|
-
synonym1 = {
|
399
|
-
objectID: 'gba',
|
400
|
-
type: 'synonym',
|
401
|
-
synonyms: ['gba', 'gameboy advance', 'game boy advance']
|
402
|
-
}
|
403
|
-
|
404
|
-
responses.push(@index.save_synonym(synonym1))
|
405
|
-
|
406
|
-
synonym2 = {
|
407
|
-
objectID: 'wii_to_wii_u',
|
408
|
-
type: 'onewaysynonym',
|
409
|
-
input: 'wii',
|
410
|
-
synonyms: ['wii U']
|
411
|
-
}
|
412
|
-
|
413
|
-
synonym3 = {
|
414
|
-
objectID: 'playstation_version_placeholder',
|
415
|
-
type: 'placeholder',
|
416
|
-
placeholder: '<PLAYSTATIONVERSION>',
|
417
|
-
replacements: ['1', 'One', '2', '3', '4', '4 Pro']
|
418
|
-
}
|
419
|
-
|
420
|
-
synonym4 = {
|
421
|
-
objectID: 'ps4',
|
422
|
-
type: 'altcorrection1',
|
423
|
-
word: 'ps4',
|
424
|
-
corrections: ['playstation4']
|
425
|
-
}
|
426
|
-
|
427
|
-
synonym5 = {
|
428
|
-
objectID: 'psone',
|
429
|
-
type: 'altcorrection2',
|
430
|
-
word: 'psone',
|
431
|
-
corrections: ['playstationone']
|
432
|
-
}
|
433
|
-
|
434
|
-
responses.push(@index.save_synonyms([synonym2, synonym3, synonym4, synonym5]))
|
435
|
-
|
436
|
-
responses.wait
|
437
|
-
|
438
|
-
assert_equal synonym1, @index.get_synonym(synonym1[:objectID])
|
439
|
-
assert_equal synonym2, @index.get_synonym(synonym2[:objectID])
|
440
|
-
assert_equal synonym3, @index.get_synonym(synonym3[:objectID])
|
441
|
-
assert_equal synonym4, @index.get_synonym(synonym4[:objectID])
|
442
|
-
assert_equal synonym5, @index.get_synonym(synonym5[:objectID])
|
443
|
-
|
444
|
-
res = @index.search_synonyms('')
|
445
|
-
assert_equal 5, res[:hits].length
|
446
|
-
|
447
|
-
results = []
|
448
|
-
@index.browse_synonyms do |synonym|
|
449
|
-
results.push(synonym)
|
450
|
-
end
|
451
|
-
|
452
|
-
synonyms = [
|
453
|
-
synonym1,
|
454
|
-
synonym2,
|
455
|
-
synonym3,
|
456
|
-
synonym4,
|
457
|
-
synonym5
|
458
|
-
]
|
459
|
-
|
460
|
-
synonyms.each do |synonym|
|
461
|
-
assert_includes results, synonym
|
462
|
-
end
|
463
|
-
|
464
|
-
@index.delete_synonym!('gba')
|
465
|
-
|
466
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
467
|
-
@index.get_synonym('gba')
|
468
|
-
end
|
469
|
-
|
470
|
-
assert_equal 'Synonym set does not exist', exception.message
|
471
|
-
|
472
|
-
@index.clear_synonyms!
|
473
|
-
|
474
|
-
res = @index.search_synonyms('')
|
475
|
-
assert_equal 0, res[:nbHits]
|
476
|
-
end
|
477
|
-
|
478
|
-
describe 'query rules' do
|
479
|
-
def before_all
|
480
|
-
super
|
481
|
-
@index = @@search_client.init_index(get_test_index_name('rules'))
|
482
|
-
end
|
483
|
-
|
484
|
-
def test_rules
|
485
|
-
responses = Algolia::MultipleResponse.new
|
486
|
-
responses.push(@index.save_objects([
|
487
|
-
{ objectID: 'iphone_7', brand: 'Apple', model: '7' },
|
488
|
-
{ objectID: 'iphone_8', brand: 'Apple', model: '8' },
|
489
|
-
{ objectID: 'iphone_x', brand: 'Apple', model: 'X' },
|
490
|
-
{ objectID: 'one_plus_one', brand: 'OnePlus',
|
491
|
-
model: 'One' },
|
492
|
-
{ objectID: 'one_plus_two', brand: 'OnePlus',
|
493
|
-
model: 'Two' }
|
494
|
-
], { auto_generate_object_id_if_not_exist: true }))
|
495
|
-
|
496
|
-
responses.push(@index.set_settings({ attributesForFaceting: %w(brand model) }))
|
497
|
-
|
498
|
-
rule1 = {
|
499
|
-
objectID: 'brand_automatic_faceting',
|
500
|
-
enabled: false,
|
501
|
-
condition: { anchoring: 'is', pattern: '{facet:brand}' },
|
502
|
-
consequence: {
|
503
|
-
params: {
|
504
|
-
automaticFacetFilters: [
|
505
|
-
{ facet: 'brand', disjunctive: true, score: 42 }
|
506
|
-
]
|
507
|
-
}
|
508
|
-
},
|
509
|
-
validity: [
|
510
|
-
{
|
511
|
-
from: 1532439300, # 07/24/2018 13:35:00 UTC
|
512
|
-
until: 1532525700 # 07/25/2018 13:35:00 UTC
|
513
|
-
},
|
514
|
-
{
|
515
|
-
from: 1532612100, # 07/26/2018 13:35:00 UTC
|
516
|
-
until: 1532698500 # 07/27/2018 13:35:00 UTC
|
517
|
-
}
|
518
|
-
],
|
519
|
-
description: 'Automatic apply the faceting on `brand` if a brand value is found in the query'
|
520
|
-
}
|
521
|
-
|
522
|
-
responses.push(@index.save_rule(rule1))
|
523
|
-
|
524
|
-
rule2 = {
|
525
|
-
objectID: 'query_edits',
|
526
|
-
conditions: [{ anchoring: 'is', pattern: 'mobile phone', alternatives: true }],
|
527
|
-
consequence: {
|
528
|
-
filterPromotes: false,
|
529
|
-
params: {
|
530
|
-
query: {
|
531
|
-
edits: [
|
532
|
-
{ type: 'remove', delete: 'mobile' },
|
533
|
-
{ type: 'replace', delete: 'phone', insert: 'iphone' }
|
534
|
-
]
|
535
|
-
}
|
536
|
-
}
|
537
|
-
}
|
538
|
-
}
|
539
|
-
|
540
|
-
rule3 = {
|
541
|
-
objectID: 'query_promo',
|
542
|
-
consequence: {
|
543
|
-
params: {
|
544
|
-
filters: 'brand:OnePlus'
|
545
|
-
}
|
546
|
-
}
|
547
|
-
}
|
548
|
-
|
549
|
-
rule4 = {
|
550
|
-
objectID: 'query_promo_summer',
|
551
|
-
condition: {
|
552
|
-
context: 'summer'
|
553
|
-
},
|
554
|
-
consequence: {
|
555
|
-
params: {
|
556
|
-
filters: 'model:One'
|
557
|
-
}
|
558
|
-
}
|
559
|
-
}
|
560
|
-
|
561
|
-
responses.push(@index.save_rules([rule2, rule3, rule4]))
|
562
|
-
|
563
|
-
responses.wait
|
564
|
-
|
565
|
-
assert_equal 1, @index.search('', { ruleContexts: ['summer'] })[:nbHits]
|
566
|
-
|
567
|
-
assert_equal rule1, rule_without_metadata(@index.get_rule(rule1[:objectID]))
|
568
|
-
assert_equal rule2, rule_without_metadata(@index.get_rule(rule2[:objectID]))
|
569
|
-
assert_equal rule3, rule_without_metadata(@index.get_rule(rule3[:objectID]))
|
570
|
-
assert_equal rule4, rule_without_metadata(@index.get_rule(rule4[:objectID]))
|
571
|
-
|
572
|
-
assert_equal 4, @index.search_rules('')[:nbHits]
|
573
|
-
|
574
|
-
results = []
|
575
|
-
@index.browse_rules do |rule|
|
576
|
-
results.push(rule)
|
577
|
-
end
|
578
|
-
|
579
|
-
rules = [
|
580
|
-
rule1,
|
581
|
-
rule2,
|
582
|
-
rule3,
|
583
|
-
rule4
|
584
|
-
]
|
585
|
-
|
586
|
-
results.each do |rule|
|
587
|
-
assert_includes rules, rule_without_metadata(rule)
|
588
|
-
end
|
589
|
-
|
590
|
-
@index.delete_rule!(rule1[:objectID])
|
591
|
-
|
592
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
593
|
-
@index.get_rule(rule1[:objectID])
|
594
|
-
end
|
595
|
-
|
596
|
-
assert_equal 'ObjectID does not exist', exception.message
|
597
|
-
|
598
|
-
@index.clear_rules!
|
599
|
-
|
600
|
-
res = @index.search_rules('')
|
601
|
-
assert_equal 0, res[:nbHits]
|
602
|
-
end
|
603
|
-
end
|
604
|
-
|
605
|
-
describe 'batching' do
|
606
|
-
def before_all
|
607
|
-
super
|
608
|
-
@index = @@search_client.init_index(get_test_index_name('index_batching'))
|
609
|
-
end
|
610
|
-
|
611
|
-
def test_index_batching
|
612
|
-
@index.save_objects!([
|
613
|
-
{ objectID: 'one', key: 'value' },
|
614
|
-
{ objectID: 'two', key: 'value' },
|
615
|
-
{ objectID: 'three', key: 'value' },
|
616
|
-
{ objectID: 'four', key: 'value' },
|
617
|
-
{ objectID: 'five', key: 'value' }
|
618
|
-
])
|
619
|
-
|
620
|
-
@index.batch!([
|
621
|
-
{ action: 'addObject', body: { objectID: 'zero', key: 'value' } },
|
622
|
-
{ action: 'updateObject', body: { objectID: 'one', k: 'v' } },
|
623
|
-
{ action: 'partialUpdateObject', body: { objectID: 'two', k: 'v' } },
|
624
|
-
{ action: 'partialUpdateObject', body: { objectID: 'two_bis', key: 'value' } },
|
625
|
-
{ action: 'partialUpdateObjectNoCreate', body: { objectID: 'three', k: 'v' } },
|
626
|
-
{ action: 'deleteObject', body: { objectID: 'four' } }
|
627
|
-
])
|
628
|
-
|
629
|
-
objects = [
|
630
|
-
{ objectID: 'zero', key: 'value' },
|
631
|
-
{ objectID: 'one', k: 'v' },
|
632
|
-
{ objectID: 'two', key: 'value', k: 'v' },
|
633
|
-
{ objectID: 'two_bis', key: 'value' },
|
634
|
-
{ objectID: 'three', key: 'value', k: 'v' },
|
635
|
-
{ objectID: 'five', key: 'value' }
|
636
|
-
]
|
637
|
-
|
638
|
-
@index.browse_objects do |object|
|
639
|
-
assert_includes objects, object
|
640
|
-
end
|
641
|
-
end
|
642
|
-
end
|
643
|
-
|
644
|
-
describe 'replacing' do
|
645
|
-
def before_all
|
646
|
-
super
|
647
|
-
@index = @@search_client.init_index(get_test_index_name('replacing'))
|
648
|
-
end
|
649
|
-
|
650
|
-
def test_replacing
|
651
|
-
responses = Algolia::MultipleResponse.new
|
652
|
-
responses.push(@index.save_object({ objectID: 'one' }))
|
653
|
-
responses.push(@index.save_rule({
|
654
|
-
objectID: 'one',
|
655
|
-
condition: { anchoring: 'is', pattern: 'pattern' },
|
656
|
-
consequence: {
|
657
|
-
params: {
|
658
|
-
query: {
|
659
|
-
edits: [
|
660
|
-
{ type: 'remove', delete: 'pattern' }
|
661
|
-
]
|
662
|
-
}
|
663
|
-
}
|
664
|
-
}
|
665
|
-
}))
|
666
|
-
responses.push(@index.save_synonym({ objectID: 'one', type: 'synonym', synonyms: %w(one two) }))
|
667
|
-
responses.wait
|
668
|
-
|
669
|
-
@index.replace_all_objects!([{ objectID: 'two' }])
|
670
|
-
responses.push(@index.replace_all_rules([{
|
671
|
-
objectID: 'two',
|
672
|
-
condition: { anchoring: 'is', pattern: 'pattern' },
|
673
|
-
consequence: {
|
674
|
-
params: {
|
675
|
-
query: {
|
676
|
-
edits: [
|
677
|
-
{ type: 'remove', delete: 'pattern' }
|
678
|
-
]
|
679
|
-
}
|
680
|
-
}
|
681
|
-
}
|
682
|
-
}]))
|
683
|
-
|
684
|
-
responses.push(@index.replace_all_synonyms([{ objectID: 'two', type: 'synonym', synonyms: %w(one two) }]))
|
685
|
-
|
686
|
-
responses.wait
|
687
|
-
|
688
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
689
|
-
@index.get_object('one')
|
690
|
-
end
|
691
|
-
|
692
|
-
assert_equal 'ObjectID does not exist', exception.message
|
693
|
-
|
694
|
-
assert_equal 'two', @index.get_object('two')[:objectID]
|
695
|
-
|
696
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
697
|
-
@index.get_rule('one')
|
698
|
-
end
|
699
|
-
|
700
|
-
assert_equal 'ObjectID does not exist', exception.message
|
701
|
-
|
702
|
-
assert_equal 'two', @index.get_rule('two')[:objectID]
|
703
|
-
|
704
|
-
exception = assert_raises Algolia::AlgoliaHttpError do
|
705
|
-
@index.get_synonym('one')
|
706
|
-
end
|
707
|
-
|
708
|
-
assert_equal 'Synonym set does not exist', exception.message
|
709
|
-
|
710
|
-
assert_equal 'two', @index.get_synonym('two')[:objectID]
|
711
|
-
end
|
712
|
-
end
|
713
|
-
|
714
|
-
describe 'exists' do
|
715
|
-
def before_all
|
716
|
-
super
|
717
|
-
@index = @@search_client.init_index(get_test_index_name('exists'))
|
718
|
-
end
|
719
|
-
|
720
|
-
def test_exists
|
721
|
-
refute @index.exists?
|
722
|
-
@index.save_object!(generate_object('111'))
|
723
|
-
assert @index.exists?
|
724
|
-
@index.delete!
|
725
|
-
refute @index.exists?
|
726
|
-
end
|
727
|
-
end
|
728
|
-
end
|
729
|
-
end
|