Class: Algolia::SearchClient
- Inherits:
-
Object
- Object
- Algolia::SearchClient
- Defined in:
- lib/algolia/api/search_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_api_key(api_key, request_options = {}) ⇒ AddApiKeyResponse
Add API key.
-
#add_api_key_with_http_info(api_key, request_options = {}) ⇒ Http::Response
Add API key.
-
#add_or_update_object(index_name, object_id, body, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Add or update a record (using objectID).
-
#add_or_update_object_with_http_info(index_name, object_id, body, request_options = {}) ⇒ Http::Response
Add or update a record (using objectID).
-
#append_source(source, request_options = {}) ⇒ CreatedAtResponse
Add a source.
-
#append_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Add a source.
-
#assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ CreatedAtResponse
Assign or move a user ID.
-
#assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ Http::Response
Assign or move a user ID.
-
#batch(index_name, batch_write_params, request_options = {}) ⇒ BatchResponse
Batch write operations on one index.
-
#batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ CreatedAtResponse
Batch assign userIDs.
-
#batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ Http::Response
Batch assign userIDs.
-
#batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Batch dictionary entries.
-
#batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Batch dictionary entries.
-
#batch_with_http_info(index_name, batch_write_params, request_options = {}) ⇒ Http::Response
Batch write operations on one index.
-
#browse(index_name, browse_params = nil, request_options = {}) ⇒ BrowseResponse
Get all records from an index.
-
#browse_with_http_info(index_name, browse_params = nil, request_options = {}) ⇒ Http::Response
Get all records from an index.
-
#clear_objects(index_name, request_options = {}) ⇒ UpdatedAtResponse
Delete all records from an index.
-
#clear_objects_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Delete all records from an index.
-
#clear_rules(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete all rules.
-
#clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete all rules.
-
#clear_synonyms(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete all synonyms.
-
#clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete all synonyms.
-
#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API.
-
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API.
-
#custom_get(path, parameters = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API.
-
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API.
-
#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API.
-
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API.
-
#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API.
-
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API.
-
#delete_api_key(key, request_options = {}) ⇒ DeleteApiKeyResponse
Delete API key.
-
#delete_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Delete API key.
-
#delete_by(index_name, delete_by_params, request_options = {}) ⇒ DeletedAtResponse
Delete all records matching a query.
-
#delete_by_with_http_info(index_name, delete_by_params, request_options = {}) ⇒ Http::Response
Delete all records matching a query.
-
#delete_index(index_name, request_options = {}) ⇒ DeletedAtResponse
Delete index.
-
#delete_index_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Delete index.
-
#delete_object(index_name, object_id, request_options = {}) ⇒ DeletedAtResponse
Delete a record.
-
#delete_object_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Delete a record.
-
#delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete a rule.
-
#delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete a rule.
-
#delete_source(source, request_options = {}) ⇒ DeleteSourceResponse
Remove a source.
-
#delete_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Remove a source.
-
#delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ DeletedAtResponse
Delete a synonym.
-
#delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete a synonym.
-
#get_api_key(key, request_options = {}) ⇒ GetApiKeyResponse
Get API key permissions.
-
#get_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Get API key permissions.
-
#get_dictionary_languages(request_options = {}) ⇒ Hash<String, Languages>
List available languages.
-
#get_dictionary_languages_with_http_info(request_options = {}) ⇒ Http::Response
List available languages.
-
#get_dictionary_settings(request_options = {}) ⇒ GetDictionarySettingsResponse
Get stop word settings.
-
#get_dictionary_settings_with_http_info(request_options = {}) ⇒ Http::Response
Get stop word settings.
-
#get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ GetLogsResponse
Return the latest log entries.
-
#get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ Http::Response
Return the latest log entries.
-
#get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Hash<String, String>
Get a record.
-
#get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Http::Response
Get a record.
-
#get_objects(get_objects_params, request_options = {}) ⇒ GetObjectsResponse
Get multiple records.
-
#get_objects_with_http_info(get_objects_params, request_options = {}) ⇒ Http::Response
Get multiple records.
-
#get_rule(index_name, object_id, request_options = {}) ⇒ Rule
Get a rule.
-
#get_rule_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Get a rule.
-
#get_settings(index_name, request_options = {}) ⇒ IndexSettings
Get index settings.
-
#get_settings_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Get index settings.
-
#get_sources(request_options = {}) ⇒ Array<Source>
Get all allowed IP addresses.
-
#get_sources_with_http_info(request_options = {}) ⇒ Http::Response
Get all allowed IP addresses.
-
#get_synonym(index_name, object_id, request_options = {}) ⇒ SynonymHit
Get a synonym object.
-
#get_synonym_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Get a synonym object.
-
#get_task(index_name, task_id, request_options = {}) ⇒ GetTaskResponse
Check a task’s status.
-
#get_task_with_http_info(index_name, task_id, request_options = {}) ⇒ Http::Response
Check a task's status.
-
#get_top_user_ids(request_options = {}) ⇒ GetTopUserIdsResponse
Get top userID.
-
#get_top_user_ids_with_http_info(request_options = {}) ⇒ Http::Response
Get top userID.
-
#get_user_id(user_id, request_options = {}) ⇒ UserId
Get userID.
-
#get_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Get userID.
-
#has_pending_mappings(get_clusters = nil, request_options = {}) ⇒ HasPendingMappingsResponse
Get migration and user mapping status.
-
#has_pending_mappings_with_http_info(get_clusters = nil, request_options = {}) ⇒ Http::Response
Get migration and user mapping status.
-
#initialize(config = nil) ⇒ SearchClient
constructor
A new instance of SearchClient.
-
#list_api_keys(request_options = {}) ⇒ ListApiKeysResponse
List API keys.
-
#list_api_keys_with_http_info(request_options = {}) ⇒ Http::Response
List API keys.
-
#list_clusters(request_options = {}) ⇒ ListClustersResponse
List clusters.
-
#list_clusters_with_http_info(request_options = {}) ⇒ Http::Response
List clusters.
-
#list_indices(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListIndicesResponse
List indices.
-
#list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
List indices.
-
#list_user_ids(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListUserIdsResponse
List userIDs.
-
#list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
List userIDs.
-
#multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse
Batch write operations on multiple indices.
-
#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response
Batch write operations on multiple indices.
-
#operation_index(index_name, operation_index_params, request_options = {}) ⇒ UpdatedAtResponse
Copy, move, or rename an index.
-
#operation_index_with_http_info(index_name, operation_index_params, request_options = {}) ⇒ Http::Response
Copy, move, or rename an index.
-
#partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Update record attributes.
-
#partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ Http::Response
Update record attributes.
-
#remove_user_id(user_id, request_options = {}) ⇒ RemoveUserIdResponse
Remove userID.
-
#remove_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Remove userID.
-
#replace_sources(source, request_options = {}) ⇒ ReplaceSourceResponse
Replace all sources.
-
#replace_sources_with_http_info(source, request_options = {}) ⇒ Http::Response
Replace all sources.
-
#restore_api_key(key, request_options = {}) ⇒ AddApiKeyResponse
Restore API key.
-
#restore_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Restore API key.
-
#save_object(index_name, body, request_options = {}) ⇒ SaveObjectResponse
Add or update a record.
-
#save_object_with_http_info(index_name, body, request_options = {}) ⇒ Http::Response
Add or update a record.
-
#save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedRuleResponse
Create or update a rule.
-
#save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Create or update a rule.
-
#save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ UpdatedAtResponse
Save a batch of rules.
-
#save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ Http::Response
Save a batch of rules.
-
#save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ SaveSynonymResponse
Save a synonym.
-
#save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Save a synonym.
-
#save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ UpdatedAtResponse
Save a batch of synonyms.
-
#save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ Http::Response
Save a batch of synonyms.
-
#search(search_method_params, request_options = {}) ⇒ SearchResponses
Search multiple indices.
-
#search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Search dictionary entries.
-
#search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Search dictionary entries.
-
#search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse
Search for facet values.
-
#search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ Http::Response
Search for facet values.
-
#search_rules(index_name, search_rules_params = nil, request_options = {}) ⇒ SearchRulesResponse
Search for rules.
-
#search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {}) ⇒ Http::Response
Search for rules.
-
#search_single_index(index_name, search_params = nil, request_options = {}) ⇒ SearchResponse
Search an index.
-
#search_single_index_with_http_info(index_name, search_params = nil, request_options = {}) ⇒ Http::Response
Search an index.
-
#search_synonyms(index_name, search_synonyms_params = nil, request_options = {}) ⇒ SearchSynonymsResponse
Search for synonyms.
-
#search_synonyms_with_http_info(index_name, search_synonyms_params = nil, request_options = {}) ⇒ Http::Response
Search for synonyms.
-
#search_user_ids(search_user_ids_params, request_options = {}) ⇒ SearchUserIdsResponse
Search for a user ID.
-
#search_user_ids_with_http_info(search_user_ids_params, request_options = {}) ⇒ Http::Response
Search for a user ID.
-
#search_with_http_info(search_method_params, request_options = {}) ⇒ Http::Response
Search multiple indices.
-
#set_dictionary_settings(dictionary_settings_params, request_options = {}) ⇒ UpdatedAtResponse
Set stop word settings.
-
#set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {}) ⇒ Http::Response
Set stop word settings.
-
#set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Update index settings.
-
#set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Update index settings.
-
#update_api_key(key, api_key, request_options = {}) ⇒ UpdateApiKeyResponse
Update an API key.
-
#update_api_key_with_http_info(key, api_key, request_options = {}) ⇒ Http::Response
Update an API key.
-
#wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for an API key to be added, updated or deleted based on a given ‘operation`.
-
#wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for a task to be published (completed) for a given ‘index_name` and `task_id`.
Constructor Details
#initialize(config = nil) ⇒ SearchClient
Returns a new instance of SearchClient.
7 8 9 10 11 12 13 |
# File 'lib/algolia/api/search_client.rb', line 7 def initialize(config = nil) raise '`config` is missing.' if config.nil? raise '`app_id` is missing.' if config.app_id.nil? || config.app_id == '' raise '`api_key` is missing.' if config.api_key.nil? || config.api_key == '' @api_client = Algolia::ApiClient.new(config) end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/algolia/api/search_client.rb', line 5 def api_client @api_client end |
Class Method Details
.create(app_id, api_key, opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/algolia/api/search_client.rb', line 15 def self.create(app_id, api_key, opts = {}) hosts = [] hosts << Transport::StatefulHost.new("#{app_id}-dsn.algolia.net", accept: CallType::READ) hosts << Transport::StatefulHost.new("#{app_id}.algolia.net", accept: CallType::WRITE) hosts += 1.upto(3).map do |i| Transport::StatefulHost.new("#{app_id}-#{i}.algolianet.com", accept: CallType::READ | CallType::WRITE) end.shuffle config = Algolia::Configuration.new(app_id, api_key, hosts, 'Search', opts) create_with_config(config) end |
.create_with_config(config) ⇒ Object
28 29 30 |
# File 'lib/algolia/api/search_client.rb', line 28 def self.create_with_config(config) new(config) end |
Instance Method Details
#add_api_key(api_key, request_options = {}) ⇒ AddApiKeyResponse
Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string.
67 68 69 70 |
# File 'lib/algolia/api/search_client.rb', line 67 def add_api_key(api_key, = {}) response = add_api_key_with_http_info(api_key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::AddApiKeyResponse') end |
#add_api_key_with_http_info(api_key, request_options = {}) ⇒ Http::Response
Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/algolia/api/search_client.rb', line 37 def add_api_key_with_http_info(api_key, = {}) # verify the required parameter 'api_key' is set if @api_client.config.client_side_validation && api_key.nil? raise ArgumentError, "Parameter `api_key` is required when calling `add_api_key`." end path = '/1/keys' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(api_key) = .merge( :operation => :'SearchClient.add_api_key', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#add_or_update_object(index_name, object_id, body, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Add or update a record (using objectID). If you use an existing ‘objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
120 121 122 123 |
# File 'lib/algolia/api/search_client.rb', line 120 def add_or_update_object(index_name, object_id, body, = {}) response = add_or_update_object_with_http_info(index_name, object_id, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtWithObjectIdResponse') end |
#add_or_update_object_with_http_info(index_name, object_id, body, request_options = {}) ⇒ Http::Response
Add or update a record (using objectID). If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/algolia/api/search_client.rb', line 79 def add_or_update_object_with_http_info(index_name, object_id, body, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `add_or_update_object`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `add_or_update_object`." end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Parameter `body` is required when calling `add_or_update_object`." end path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :'SearchClient.add_or_update_object', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#append_source(source, request_options = {}) ⇒ CreatedAtResponse
Add a source. Add a source to the list of allowed sources.
160 161 162 163 |
# File 'lib/algolia/api/search_client.rb', line 160 def append_source(source, = {}) response = append_source_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::CreatedAtResponse') end |
#append_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Add a source. Add a source to the list of allowed sources.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/algolia/api/search_client.rb', line 130 def append_source_with_http_info(source, = {}) # verify the required parameter 'source' is set if @api_client.config.client_side_validation && source.nil? raise ArgumentError, "Parameter `source` is required when calling `append_source`." end path = '/1/security/sources/append' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(source) = .merge( :operation => :'SearchClient.append_source', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ CreatedAtResponse
Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
213 214 215 216 |
# File 'lib/algolia/api/search_client.rb', line 213 def assign_user_id(x_algolia_user_id, assign_user_id_params, = {}) response = assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::CreatedAtResponse') end |
#assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ Http::Response
Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/algolia/api/search_client.rb', line 171 def assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, = {}) # verify the required parameter 'x_algolia_user_id' is set if @api_client.config.client_side_validation && x_algolia_user_id.nil? raise ArgumentError, "Parameter `x_algolia_user_id` is required when calling `assign_user_id`." end pattern = /^[a-zA-Z0-9 \-*.]+$/ if @api_client.config.client_side_validation && x_algolia_user_id !~ pattern raise ArgumentError, "invalid value for 'x_algolia_user_id' when calling SearchClient.assign_user_id, must conform to the pattern #{pattern}." end # verify the required parameter 'assign_user_id_params' is set if @api_client.config.client_side_validation && assign_user_id_params.nil? raise ArgumentError, "Parameter `assign_user_id_params` is required when calling `assign_user_id`." end path = '/1/clusters/mapping' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params[:'X-Algolia-User-ID'] = x_algolia_user_id header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(assign_user_id_params) = .merge( :operation => :'SearchClient.assign_user_id', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#batch(index_name, batch_write_params, request_options = {}) ⇒ BatchResponse
Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported ‘action`s are equivalent to the individual operations of the same name.
259 260 261 262 |
# File 'lib/algolia/api/search_client.rb', line 259 def batch(index_name, batch_write_params, = {}) response = batch_with_http_info(index_name, batch_write_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::BatchResponse') end |
#batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ CreatedAtResponse
Batch assign userIDs. Assign multiple user IDs to a cluster. **You can’t move users with this operation.**.
312 313 314 315 |
# File 'lib/algolia/api/search_client.rb', line 312 def batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, = {}) response = batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::CreatedAtResponse') end |
#batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ Http::Response
Batch assign userIDs. Assign multiple user IDs to a cluster. **You can't move users with this operation.**.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/algolia/api/search_client.rb', line 270 def batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, = {}) # verify the required parameter 'x_algolia_user_id' is set if @api_client.config.client_side_validation && x_algolia_user_id.nil? raise ArgumentError, "Parameter `x_algolia_user_id` is required when calling `batch_assign_user_ids`." end pattern = /^[a-zA-Z0-9 \-*.]+$/ if @api_client.config.client_side_validation && x_algolia_user_id !~ pattern raise ArgumentError, "invalid value for 'x_algolia_user_id' when calling SearchClient.batch_assign_user_ids, must conform to the pattern #{pattern}." end # verify the required parameter 'batch_assign_user_ids_params' is set if @api_client.config.client_side_validation && batch_assign_user_ids_params.nil? raise ArgumentError, "Parameter `batch_assign_user_ids_params` is required when calling `batch_assign_user_ids`." end path = '/1/clusters/mapping/batch' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params[:'X-Algolia-User-ID'] = x_algolia_user_id header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_assign_user_ids_params) = .merge( :operation => :'SearchClient.batch_assign_user_ids', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Batch dictionary entries. Add or remove a batch of dictionary entries.
358 359 360 361 |
# File 'lib/algolia/api/search_client.rb', line 358 def batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, = {}) response = batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Batch dictionary entries. Add or remove a batch of dictionary entries.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/algolia/api/search_client.rb', line 323 def batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, = {}) # verify the required parameter 'dictionary_name' is set if @api_client.config.client_side_validation && dictionary_name.nil? raise ArgumentError, "Parameter `dictionary_name` is required when calling `batch_dictionary_entries`." end # verify the required parameter 'batch_dictionary_entries_params' is set if @api_client.config.client_side_validation && batch_dictionary_entries_params.nil? raise ArgumentError, "Parameter `batch_dictionary_entries_params` is required when calling `batch_dictionary_entries`." end path = '/1/dictionaries/{dictionaryName}/batch'.sub('{' + 'dictionaryName' + '}', @api_client.encode_uri(dictionary_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_dictionary_entries_params) = .merge( :operation => :'SearchClient.batch_dictionary_entries', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#batch_with_http_info(index_name, batch_write_params, request_options = {}) ⇒ Http::Response
Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/algolia/api/search_client.rb', line 224 def batch_with_http_info(index_name, batch_write_params, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `batch`." end # verify the required parameter 'batch_write_params' is set if @api_client.config.client_side_validation && batch_write_params.nil? raise ArgumentError, "Parameter `batch_write_params` is required when calling `batch`." end path = '/1/indexes/{indexName}/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_write_params) = .merge( :operation => :'SearchClient.batch', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#browse(index_name, browse_params = nil, request_options = {}) ⇒ BrowseResponse
Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn’t support: - The ‘distinct` query parameter - Sorting by typos, proximity, words, or geographical distance.
400 401 402 403 |
# File 'lib/algolia/api/search_client.rb', line 400 def browse(index_name, browse_params = nil, = {}) response = browse_with_http_info(index_name, browse_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::BrowseResponse') end |
#browse_with_http_info(index_name, browse_params = nil, request_options = {}) ⇒ Http::Response
Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance.
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/algolia/api/search_client.rb', line 369 def browse_with_http_info(index_name, browse_params = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `browse`." end path = '/1/indexes/{indexName}/browse'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(browse_params) = .merge( :operation => :'SearchClient.browse', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#clear_objects(index_name, request_options = {}) ⇒ UpdatedAtResponse
Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched.
440 441 442 443 |
# File 'lib/algolia/api/search_client.rb', line 440 def clear_objects(index_name, = {}) response = clear_objects_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_objects_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched.
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/algolia/api/search_client.rb', line 410 def clear_objects_with_http_info(index_name, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `clear_objects`." end path = '/1/indexes/{indexName}/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.clear_objects', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#clear_rules(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete all rules. Delete all rules in the index.
483 484 485 486 |
# File 'lib/algolia/api/search_client.rb', line 483 def clear_rules(index_name, forward_to_replicas = nil, = {}) response = clear_rules_with_http_info(index_name, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete all rules. Delete all rules in the index.
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/algolia/api/search_client.rb', line 451 def clear_rules_with_http_info(index_name, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `clear_rules`." end path = '/1/indexes/{indexName}/rules/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.clear_rules', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#clear_synonyms(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete all synonyms. Delete all synonyms in the index.
526 527 528 529 |
# File 'lib/algolia/api/search_client.rb', line 526 def clear_synonyms(index_name, forward_to_replicas = nil, = {}) response = clear_synonyms_with_http_info(index_name, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete all synonyms. Delete all synonyms in the index.
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/algolia/api/search_client.rb', line 494 def clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `clear_synonyms`." end path = '/1/indexes/{indexName}/synonyms/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.clear_synonyms', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
569 570 571 572 |
# File 'lib/algolia/api/search_client.rb', line 569 def custom_delete(path, parameters = nil, = {}) response = custom_delete_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'lib/algolia/api/search_client.rb', line 537 def custom_delete_with_http_info(path, parameters = nil, = {}) # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? raise ArgumentError, "Parameter `path` is required when calling `custom_delete`." end path = '/1{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.custom_delete', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#custom_get(path, parameters = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
612 613 614 615 |
# File 'lib/algolia/api/search_client.rb', line 612 def custom_get(path, parameters = nil, = {}) response = custom_get_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/algolia/api/search_client.rb', line 580 def custom_get_with_http_info(path, parameters = nil, = {}) # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? raise ArgumentError, "Parameter `path` is required when calling `custom_get`." end path = '/1{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.custom_get', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
657 658 659 660 |
# File 'lib/algolia/api/search_client.rb', line 657 def custom_post(path, parameters = nil, body = nil, = {}) response = custom_post_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
# File 'lib/algolia/api/search_client.rb', line 624 def custom_post_with_http_info(path, parameters = nil, body = nil, = {}) # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? raise ArgumentError, "Parameter `path` is required when calling `custom_post`." end path = '/1{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :'SearchClient.custom_post', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
702 703 704 705 |
# File 'lib/algolia/api/search_client.rb', line 702 def custom_put(path, parameters = nil, body = nil, = {}) response = custom_put_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/algolia/api/search_client.rb', line 669 def custom_put_with_http_info(path, parameters = nil, body = nil, = {}) # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? raise ArgumentError, "Parameter `path` is required when calling `custom_put`." end path = '/1{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :'SearchClient.custom_put', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#delete_api_key(key, request_options = {}) ⇒ DeleteApiKeyResponse
Delete API key. Delete an existing API key. The request must be authenticated with the admin API key.
742 743 744 745 |
# File 'lib/algolia/api/search_client.rb', line 742 def delete_api_key(key, = {}) response = delete_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeleteApiKeyResponse') end |
#delete_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Delete API key. Delete an existing API key. The request must be authenticated with the admin API key.
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/algolia/api/search_client.rb', line 712 def delete_api_key_with_http_info(key, = {}) # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? raise ArgumentError, "Parameter `key` is required when calling `delete_api_key`." end path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_api_key', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#delete_by(index_name, delete_by_params, request_options = {}) ⇒ DeletedAtResponse
Delete all records matching a query. This operation doesn’t support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn’t accept empty filters or queries.
788 789 790 791 |
# File 'lib/algolia/api/search_client.rb', line 788 def delete_by(index_name, delete_by_params, = {}) response = delete_by_with_http_info(index_name, delete_by_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_by_with_http_info(index_name, delete_by_params, request_options = {}) ⇒ Http::Response
Delete all records matching a query. This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries.
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
# File 'lib/algolia/api/search_client.rb', line 753 def delete_by_with_http_info(index_name, delete_by_params, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `delete_by`." end # verify the required parameter 'delete_by_params' is set if @api_client.config.client_side_validation && delete_by_params.nil? raise ArgumentError, "Parameter `delete_by_params` is required when calling `delete_by`." end path = '/1/indexes/{indexName}/deleteByQuery'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(delete_by_params) = .merge( :operation => :'SearchClient.delete_by', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#delete_index(index_name, request_options = {}) ⇒ DeletedAtResponse
Delete index. Delete an existing index.
828 829 830 831 |
# File 'lib/algolia/api/search_client.rb', line 828 def delete_index(index_name, = {}) response = delete_index_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_index_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Delete index. Delete an existing index.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'lib/algolia/api/search_client.rb', line 798 def delete_index_with_http_info(index_name, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `delete_index`." end path = '/1/indexes/{indexName}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_index', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#delete_object(index_name, object_id, request_options = {}) ⇒ DeletedAtResponse
Delete a record. To delete a set of records matching a query, use the [‘deleteByQuery` operation](#tag/Records/operation/deleteBy) instead.
875 876 877 878 |
# File 'lib/algolia/api/search_client.rb', line 875 def delete_object(index_name, object_id, = {}) response = delete_object_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_object_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Delete a record. To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead.
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
# File 'lib/algolia/api/search_client.rb', line 839 def delete_object_with_http_info(index_name, object_id, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `delete_object`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `delete_object`." end path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_object', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Delete a rule. Delete a rule by its ‘objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
925 926 927 928 |
# File 'lib/algolia/api/search_client.rb', line 925 def delete_rule(index_name, object_id, forward_to_replicas = nil, = {}) response = delete_rule_with_http_info(index_name, object_id, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete a rule. Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 |
# File 'lib/algolia/api/search_client.rb', line 887 def delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `delete_rule`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `delete_rule`." end path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_rule', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#delete_source(source, request_options = {}) ⇒ DeleteSourceResponse
Remove a source. Remove a source from the list of allowed sources.
965 966 967 968 |
# File 'lib/algolia/api/search_client.rb', line 965 def delete_source(source, = {}) response = delete_source_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeleteSourceResponse') end |
#delete_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Remove a source. Remove a source from the list of allowed sources.
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 |
# File 'lib/algolia/api/search_client.rb', line 935 def delete_source_with_http_info(source, = {}) # verify the required parameter 'source' is set if @api_client.config.client_side_validation && source.nil? raise ArgumentError, "Parameter `source` is required when calling `delete_source`." end path = '/1/security/sources/{source}'.sub('{' + 'source' + '}', @api_client.encode_uri(source.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_source', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ DeletedAtResponse
Delete a synonym. Delete a synonym by its ‘objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
1015 1016 1017 1018 |
# File 'lib/algolia/api/search_client.rb', line 1015 def delete_synonym(index_name, object_id, forward_to_replicas = nil, = {}) response = delete_synonym_with_http_info(index_name, object_id, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Delete a synonym. Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 |
# File 'lib/algolia/api/search_client.rb', line 977 def delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `delete_synonym`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `delete_synonym`." end path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.delete_synonym', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#get_api_key(key, request_options = {}) ⇒ GetApiKeyResponse
Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application’s keys. When authenticating with other API keys, you can only retrieve information for that key.
1055 1056 1057 1058 |
# File 'lib/algolia/api/search_client.rb', line 1055 def get_api_key(key, = {}) response = get_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetApiKeyResponse') end |
#get_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key.
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
# File 'lib/algolia/api/search_client.rb', line 1025 def get_api_key_with_http_info(key, = {}) # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? raise ArgumentError, "Parameter `key` is required when calling `get_api_key`." end path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_api_key', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_dictionary_languages(request_options = {}) ⇒ Hash<String, Languages>
List available languages. Lists Algolia’s [supported languages](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language’s [stop word](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features.
1088 1089 1090 1091 |
# File 'lib/algolia/api/search_client.rb', line 1088 def get_dictionary_languages( = {}) response = get_dictionary_languages_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::Hash<String, Languages>') end |
#get_dictionary_languages_with_http_info(request_options = {}) ⇒ Http::Response
List available languages. Lists Algolia's [supported languages](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features.
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 |
# File 'lib/algolia/api/search_client.rb', line 1064 def get_dictionary_languages_with_http_info( = {}) path = '/1/dictionaries/*/languages' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_dictionary_languages', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_dictionary_settings(request_options = {}) ⇒ GetDictionarySettingsResponse
Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings).
1121 1122 1123 1124 |
# File 'lib/algolia/api/search_client.rb', line 1121 def get_dictionary_settings( = {}) response = get_dictionary_settings_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetDictionarySettingsResponse') end |
#get_dictionary_settings_with_http_info(request_options = {}) ⇒ Http::Response
Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings).
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 |
# File 'lib/algolia/api/search_client.rb', line 1097 def get_dictionary_settings_with_http_info( = {}) path = '/1/dictionaries/*/settings' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_dictionary_settings', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ GetLogsResponse
Return the latest log entries. The request must be authenticated by an API key with the [‘logs` ACL](www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There’s also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn’t appear in the logs itself. > Note: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN’s endpoint](www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers).
1170 1171 1172 1173 |
# File 'lib/algolia/api/search_client.rb', line 1170 def get_logs(offset = nil, length = nil, index_name = nil, type = nil, = {}) response = get_logs_with_http_info(offset, length, index_name, type, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetLogsResponse') end |
#get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ Http::Response
Return the latest log entries. The request must be authenticated by an API key with the [`logs` ACL](www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > Note: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers).
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 |
# File 'lib/algolia/api/search_client.rb', line 1134 def get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, = {}) if @api_client.config.client_side_validation && !length.nil? && length > 1000 raise ArgumentError, 'invalid value for ""length"" when calling SearchClient.get_logs, must be smaller than or equal to 1000.' end path = '/1/logs' query_params = {} query_params[:offset] = offset unless offset.nil? query_params[:length] = length unless length.nil? query_params[:indexName] = index_name unless index_name.nil? query_params[:type] = type unless type.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_logs', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Hash<String, String>
Get a record. To get more than one record, use the [‘objects` operation](#tag/Records/operation/getObjects).
1220 1221 1222 1223 |
# File 'lib/algolia/api/search_client.rb', line 1220 def get_object(index_name, object_id, attributes_to_retrieve = nil, = {}) response = get_object_with_http_info(index_name, object_id, attributes_to_retrieve, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::Hash<String, String>') end |
#get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Http::Response
Get a record. To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 |
# File 'lib/algolia/api/search_client.rb', line 1182 def get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `get_object`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `get_object`." end path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:attributesToRetrieve] = @api_client.build_collection_param(attributes_to_retrieve, :multi) unless attributes_to_retrieve.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_object', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_objects(get_objects_params, request_options = {}) ⇒ GetObjectsResponse
Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests.
1260 1261 1262 1263 |
# File 'lib/algolia/api/search_client.rb', line 1260 def get_objects(get_objects_params, = {}) response = get_objects_with_http_info(get_objects_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetObjectsResponse') end |
#get_objects_with_http_info(get_objects_params, request_options = {}) ⇒ Http::Response
Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests.
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 |
# File 'lib/algolia/api/search_client.rb', line 1230 def get_objects_with_http_info(get_objects_params, = {}) # verify the required parameter 'get_objects_params' is set if @api_client.config.client_side_validation && get_objects_params.nil? raise ArgumentError, "Parameter `get_objects_params` is required when calling `get_objects`." end path = '/1/indexes/*/objects' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(get_objects_params) = .merge( :operation => :'SearchClient.get_objects', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#get_rule(index_name, object_id, request_options = {}) ⇒ Rule
Get a rule. Get a rule by its ‘objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
1307 1308 1309 1310 |
# File 'lib/algolia/api/search_client.rb', line 1307 def get_rule(index_name, object_id, = {}) response = get_rule_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::Rule') end |
#get_rule_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Get a rule. Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 |
# File 'lib/algolia/api/search_client.rb', line 1271 def get_rule_with_http_info(index_name, object_id, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `get_rule`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `get_rule`." end path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_rule', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_settings(index_name, request_options = {}) ⇒ IndexSettings
Get index settings. Return an object containing an index’s [configuration settings](www.algolia.com/doc/api-reference/settings-api-parameters/).
1347 1348 1349 1350 |
# File 'lib/algolia/api/search_client.rb', line 1347 def get_settings(index_name, = {}) response = get_settings_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::IndexSettings') end |
#get_settings_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Get index settings. Return an object containing an index's [configuration settings](www.algolia.com/doc/api-reference/settings-api-parameters/).
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 |
# File 'lib/algolia/api/search_client.rb', line 1317 def get_settings_with_http_info(index_name, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `get_settings`." end path = '/1/indexes/{indexName}/settings'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_settings', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_sources(request_options = {}) ⇒ Array<Source>
Get all allowed IP addresses. Get all allowed sources (IP addresses).
1380 1381 1382 1383 |
# File 'lib/algolia/api/search_client.rb', line 1380 def get_sources( = {}) response = get_sources_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Array<Search::Source>') end |
#get_sources_with_http_info(request_options = {}) ⇒ Http::Response
Get all allowed IP addresses. Get all allowed sources (IP addresses).
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/algolia/api/search_client.rb', line 1356 def get_sources_with_http_info( = {}) path = '/1/security/sources' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_sources', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_synonym(index_name, object_id, request_options = {}) ⇒ SynonymHit
Get a synonym object. Get a syonym by its ‘objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
1427 1428 1429 1430 |
# File 'lib/algolia/api/search_client.rb', line 1427 def get_synonym(index_name, object_id, = {}) response = get_synonym_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SynonymHit') end |
#get_synonym_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Get a synonym object. Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 |
# File 'lib/algolia/api/search_client.rb', line 1391 def get_synonym_with_http_info(index_name, object_id, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `get_synonym`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `get_synonym`." end path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_synonym', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_task(index_name, task_id, request_options = {}) ⇒ GetTaskResponse
Check a task’s status. Some operations, such as copying an index, will respond with a ‘taskID` value. Use this value here to check the status of that task.
1474 1475 1476 1477 |
# File 'lib/algolia/api/search_client.rb', line 1474 def get_task(index_name, task_id, = {}) response = get_task_with_http_info(index_name, task_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetTaskResponse') end |
#get_task_with_http_info(index_name, task_id, request_options = {}) ⇒ Http::Response
Check a task's status. Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task.
1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 |
# File 'lib/algolia/api/search_client.rb', line 1438 def get_task_with_http_info(index_name, task_id, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `get_task`." end # verify the required parameter 'task_id' is set if @api_client.config.client_side_validation && task_id.nil? raise ArgumentError, "Parameter `task_id` is required when calling `get_task`." end path = '/1/indexes/{indexName}/task/{taskID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'taskID' + '}', @api_client.encode_uri(task_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_task', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_top_user_ids(request_options = {}) ⇒ GetTopUserIdsResponse
Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.
1507 1508 1509 1510 |
# File 'lib/algolia/api/search_client.rb', line 1507 def get_top_user_ids( = {}) response = get_top_user_ids_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetTopUserIdsResponse') end |
#get_top_user_ids_with_http_info(request_options = {}) ⇒ Http::Response
Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time.
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 |
# File 'lib/algolia/api/search_client.rb', line 1483 def get_top_user_ids_with_http_info( = {}) path = '/1/clusters/mapping/top' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_top_user_ids', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#get_user_id(user_id, request_options = {}) ⇒ UserId
Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.
1552 1553 1554 1555 |
# File 'lib/algolia/api/search_client.rb', line 1552 def get_user_id(user_id, = {}) response = get_user_id_with_http_info(user_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UserId') end |
#get_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time.
1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 |
# File 'lib/algolia/api/search_client.rb', line 1517 def get_user_id_with_http_info(user_id, = {}) # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? raise ArgumentError, "Parameter `user_id` is required when calling `get_user_id`." end pattern = /^[a-zA-Z0-9 \-*.]+$/ if @api_client.config.client_side_validation && user_id !~ pattern raise ArgumentError, "invalid value for 'user_id' when calling SearchClient.get_user_id, must conform to the pattern #{pattern}." end path = '/1/clusters/mapping/{userID}'.sub('{' + 'userID' + '}', @api_client.encode_uri(user_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.get_user_id', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#has_pending_mappings(get_clusters = nil, request_options = {}) ⇒ HasPendingMappingsResponse
Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
1588 1589 1590 1591 |
# File 'lib/algolia/api/search_client.rb', line 1588 def has_pending_mappings(get_clusters = nil, = {}) response = has_pending_mappings_with_http_info(get_clusters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::HasPendingMappingsResponse') end |
#has_pending_mappings_with_http_info(get_clusters = nil, request_options = {}) ⇒ Http::Response
Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 |
# File 'lib/algolia/api/search_client.rb', line 1562 def has_pending_mappings_with_http_info(get_clusters = nil, = {}) path = '/1/clusters/mapping/pending' query_params = {} query_params[:getClusters] = get_clusters unless get_clusters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.has_pending_mappings', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#list_api_keys(request_options = {}) ⇒ ListApiKeysResponse
List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions.
1621 1622 1623 1624 |
# File 'lib/algolia/api/search_client.rb', line 1621 def list_api_keys( = {}) response = list_api_keys_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListApiKeysResponse') end |
#list_api_keys_with_http_info(request_options = {}) ⇒ Http::Response
List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions.
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'lib/algolia/api/search_client.rb', line 1597 def list_api_keys_with_http_info( = {}) path = '/1/keys' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.list_api_keys', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#list_clusters(request_options = {}) ⇒ ListClustersResponse
List clusters. List the available clusters in a multi-cluster setup.
1654 1655 1656 1657 |
# File 'lib/algolia/api/search_client.rb', line 1654 def list_clusters( = {}) response = list_clusters_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListClustersResponse') end |
#list_clusters_with_http_info(request_options = {}) ⇒ Http::Response
List clusters. List the available clusters in a multi-cluster setup.
1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 |
# File 'lib/algolia/api/search_client.rb', line 1630 def list_clusters_with_http_info( = {}) path = '/1/clusters' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.list_clusters', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#list_indices(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListIndicesResponse
List indices. List indices in an Algolia application.
1697 1698 1699 1700 |
# File 'lib/algolia/api/search_client.rb', line 1697 def list_indices(page = nil, hits_per_page = nil, = {}) response = list_indices_with_http_info(page, hits_per_page, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListIndicesResponse') end |
#list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
List indices. List indices in an Algolia application.
1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 |
# File 'lib/algolia/api/search_client.rb', line 1665 def list_indices_with_http_info(page = nil, hits_per_page = nil, = {}) if @api_client.config.client_side_validation && !page.nil? && page < 0 raise ArgumentError, 'invalid value for ""page"" when calling SearchClient.list_indices, must be greater than or equal to 0.' end path = '/1/indexes' query_params = {} query_params[:page] = page unless page.nil? query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.list_indices', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#list_user_ids(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListUserIdsResponse
List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.
1740 1741 1742 1743 |
# File 'lib/algolia/api/search_client.rb', line 1740 def list_user_ids(page = nil, hits_per_page = nil, = {}) response = list_user_ids_with_http_info(page, hits_per_page, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListUserIdsResponse') end |
#list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time.
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
# File 'lib/algolia/api/search_client.rb', line 1708 def list_user_ids_with_http_info(page = nil, hits_per_page = nil, = {}) if @api_client.config.client_side_validation && !page.nil? && page < 0 raise ArgumentError, 'invalid value for ""page"" when calling SearchClient.list_user_ids, must be greater than or equal to 0.' end path = '/1/clusters/mapping' query_params = {} query_params[:page] = page unless page.nil? query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.list_user_ids', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:GET, path, ) end |
#multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse
Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It’s a multi-index version of the [‘batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name.
1780 1781 1782 1783 |
# File 'lib/algolia/api/search_client.rb', line 1780 def multiple_batch(batch_params, = {}) response = multiple_batch_with_http_info(batch_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::MultipleBatchResponse') end |
#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response
Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name.
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 |
# File 'lib/algolia/api/search_client.rb', line 1750 def multiple_batch_with_http_info(batch_params, = {}) # verify the required parameter 'batch_params' is set if @api_client.config.client_side_validation && batch_params.nil? raise ArgumentError, "Parameter `batch_params` is required when calling `multiple_batch`." end path = '/1/indexes/*/batch' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_params) = .merge( :operation => :'SearchClient.multiple_batch', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#operation_index(index_name, operation_index_params, request_options = {}) ⇒ UpdatedAtResponse
Copy, move, or rename an index. This ‘operation`, copy or move, will copy or move a source index’s (‘IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn’t exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - Move to rename an index. - Copy to create a new index with the same records and configuration as an existing one. > Note: When considering copying or moving, be aware of the [rate limitations](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/).
1826 1827 1828 1829 |
# File 'lib/algolia/api/search_client.rb', line 1826 def operation_index(index_name, operation_index_params, = {}) response = operation_index_with_http_info(index_name, operation_index_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#operation_index_with_http_info(index_name, operation_index_params, request_options = {}) ⇒ Http::Response
Copy, move, or rename an index. This `operation`, copy or move, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - Move to rename an index. - Copy to create a new index with the same records and configuration as an existing one. > Note: When considering copying or moving, be aware of the [rate limitations](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/).
1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 |
# File 'lib/algolia/api/search_client.rb', line 1791 def operation_index_with_http_info(index_name, operation_index_params, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `operation_index`." end # verify the required parameter 'operation_index_params' is set if @api_client.config.client_side_validation && operation_index_params.nil? raise ArgumentError, "Parameter `operation_index_params` is required when calling `operation_index`." end path = '/1/indexes/{indexName}/operation'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(operation_index_params) = .merge( :operation => :'SearchClient.operation_index', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor.
1882 1883 1884 1885 |
# File 'lib/algolia/api/search_client.rb', line 1882 def partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, = {}) response = partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtWithObjectIdResponse') end |
#partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ Http::Response
Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor.
1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 |
# File 'lib/algolia/api/search_client.rb', line 1839 def partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `partial_update_object`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `partial_update_object`." end # verify the required parameter 'attributes_to_update' is set if @api_client.config.client_side_validation && attributes_to_update.nil? raise ArgumentError, "Parameter `attributes_to_update` is required when calling `partial_update_object`." end path = '/1/indexes/{indexName}/{objectID}/partial'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:createIfNotExists] = create_if_not_exists unless create_if_not_exists.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(attributes_to_update) = .merge( :operation => :'SearchClient.partial_update_object', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#remove_user_id(user_id, request_options = {}) ⇒ RemoveUserIdResponse
Remove userID. Remove a userID and its associated data from the multi-clusters.
1927 1928 1929 1930 |
# File 'lib/algolia/api/search_client.rb', line 1927 def remove_user_id(user_id, = {}) response = remove_user_id_with_http_info(user_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::RemoveUserIdResponse') end |
#remove_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Remove userID. Remove a userID and its associated data from the multi-clusters.
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 |
# File 'lib/algolia/api/search_client.rb', line 1892 def remove_user_id_with_http_info(user_id, = {}) # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? raise ArgumentError, "Parameter `user_id` is required when calling `remove_user_id`." end pattern = /^[a-zA-Z0-9 \-*.]+$/ if @api_client.config.client_side_validation && user_id !~ pattern raise ArgumentError, "invalid value for 'user_id' when calling SearchClient.remove_user_id, must conform to the pattern #{pattern}." end path = '/1/clusters/mapping/{userID}'.sub('{' + 'userID' + '}', @api_client.encode_uri(user_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.remove_user_id', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:DELETE, path, ) end |
#replace_sources(source, request_options = {}) ⇒ ReplaceSourceResponse
Replace all sources. Replace all allowed sources.
1967 1968 1969 1970 |
# File 'lib/algolia/api/search_client.rb', line 1967 def replace_sources(source, = {}) response = replace_sources_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ReplaceSourceResponse') end |
#replace_sources_with_http_info(source, request_options = {}) ⇒ Http::Response
Replace all sources. Replace all allowed sources.
1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 |
# File 'lib/algolia/api/search_client.rb', line 1937 def replace_sources_with_http_info(source, = {}) # verify the required parameter 'source' is set if @api_client.config.client_side_validation && source.nil? raise ArgumentError, "Parameter `source` is required when calling `replace_sources`." end path = '/1/security/sources' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(source) = .merge( :operation => :'SearchClient.replace_sources', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#restore_api_key(key, request_options = {}) ⇒ AddApiKeyResponse
Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key.
2007 2008 2009 2010 |
# File 'lib/algolia/api/search_client.rb', line 2007 def restore_api_key(key, = {}) response = restore_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::AddApiKeyResponse') end |
#restore_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key.
1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
# File 'lib/algolia/api/search_client.rb', line 1977 def restore_api_key_with_http_info(key, = {}) # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? raise ArgumentError, "Parameter `key` is required when calling `restore_api_key`." end path = '/1/keys/{key}/restore'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.restore_api_key', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#save_object(index_name, body, request_options = {}) ⇒ SaveObjectResponse
Add or update a record. Add a record (object) to an index or replace it. If the record doesn’t contain an ‘objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
2053 2054 2055 2056 |
# File 'lib/algolia/api/search_client.rb', line 2053 def save_object(index_name, body, = {}) response = save_object_with_http_info(index_name, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SaveObjectResponse') end |
#save_object_with_http_info(index_name, body, request_options = {}) ⇒ Http::Response
Add or update a record. Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).
2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 |
# File 'lib/algolia/api/search_client.rb', line 2018 def save_object_with_http_info(index_name, body, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `save_object`." end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Parameter `body` is required when calling `save_object`." end path = '/1/indexes/{indexName}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .merge( :operation => :'SearchClient.save_object', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedRuleResponse
Create or update a rule. To create or update more than one rule, use the [‘batch` operation](#tag/Rules/operation/saveRules).
2109 2110 2111 2112 |
# File 'lib/algolia/api/search_client.rb', line 2109 def save_rule(index_name, object_id, rule, forward_to_replicas = nil, = {}) response = save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedRuleResponse') end |
#save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Create or update a rule. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules).
2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 |
# File 'lib/algolia/api/search_client.rb', line 2066 def save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `save_rule`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `save_rule`." end # verify the required parameter 'rule' is set if @api_client.config.client_side_validation && rule.nil? raise ArgumentError, "Parameter `rule` is required when calling `save_rule`." end path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(rule) = .merge( :operation => :'SearchClient.save_rule', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ UpdatedAtResponse
Save a batch of rules. Create or update multiple rules.
2161 2162 2163 2164 |
# File 'lib/algolia/api/search_client.rb', line 2161 def save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, = {}) response = save_rules_with_http_info(index_name, rules, forward_to_replicas, clear_existing_rules, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ Http::Response
Save a batch of rules. Create or update multiple rules.
2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 |
# File 'lib/algolia/api/search_client.rb', line 2122 def save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `save_rules`." end # verify the required parameter 'rules' is set if @api_client.config.client_side_validation && rules.nil? raise ArgumentError, "Parameter `rules` is required when calling `save_rules`." end path = '/1/indexes/{indexName}/rules/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params[:clearExistingRules] = clear_existing_rules unless clear_existing_rules.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(rules) = .merge( :operation => :'SearchClient.save_rules', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ SaveSynonymResponse
Save a synonym. Add a [synonym](www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym ‘objectID` doesn’t exist, Algolia adds a new one. If you use an existing synonym ‘objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
2217 2218 2219 2220 |
# File 'lib/algolia/api/search_client.rb', line 2217 def save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, = {}) response = save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SaveSynonymResponse') end |
#save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Save a synonym. Add a [synonym](www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 |
# File 'lib/algolia/api/search_client.rb', line 2174 def save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `save_synonym`." end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? raise ArgumentError, "Parameter `object_id` is required when calling `save_synonym`." end # verify the required parameter 'synonym_hit' is set if @api_client.config.client_side_validation && synonym_hit.nil? raise ArgumentError, "Parameter `synonym_hit` is required when calling `save_synonym`." end path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', @api_client.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(synonym_hit) = .merge( :operation => :'SearchClient.save_synonym', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ UpdatedAtResponse
Save a batch of synonyms. Create or update multiple synonyms.
2269 2270 2271 2272 |
# File 'lib/algolia/api/search_client.rb', line 2269 def save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, = {}) response = save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas, replace_existing_synonyms, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ Http::Response
Save a batch of synonyms. Create or update multiple synonyms.
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 |
# File 'lib/algolia/api/search_client.rb', line 2230 def save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `save_synonyms`." end # verify the required parameter 'synonym_hit' is set if @api_client.config.client_side_validation && synonym_hit.nil? raise ArgumentError, "Parameter `synonym_hit` is required when calling `save_synonyms`." end path = '/1/indexes/{indexName}/synonyms/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params[:replaceExistingSynonyms] = replace_existing_synonyms unless replace_existing_synonyms.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(synonym_hit) = .merge( :operation => :'SearchClient.save_synonyms', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#search(search_method_params, request_options = {}) ⇒ SearchResponses
Search multiple indices. Send multiple search queries to one or more indices.
2309 2310 2311 2312 |
# File 'lib/algolia/api/search_client.rb', line 2309 def search(search_method_params, = {}) response = search_with_http_info(search_method_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchResponses') end |
#search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Search dictionary entries. Search for standard and [custom](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries.
2355 2356 2357 2358 |
# File 'lib/algolia/api/search_client.rb', line 2355 def search_dictionary_entries(dictionary_name, search_dictionary_entries_params, = {}) response = search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Search dictionary entries. Search for standard and [custom](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries.
2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 |
# File 'lib/algolia/api/search_client.rb', line 2320 def search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, = {}) # verify the required parameter 'dictionary_name' is set if @api_client.config.client_side_validation && dictionary_name.nil? raise ArgumentError, "Parameter `dictionary_name` is required when calling `search_dictionary_entries`." end # verify the required parameter 'search_dictionary_entries_params' is set if @api_client.config.client_side_validation && search_dictionary_entries_params.nil? raise ArgumentError, "Parameter `search_dictionary_entries_params` is required when calling `search_dictionary_entries`." end path = '/1/dictionaries/{dictionaryName}/search'.sub('{' + 'dictionaryName' + '}', @api_client.encode_uri(dictionary_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_dictionary_entries_params) = .merge( :operation => :'SearchClient.search_dictionary_entries', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse
Search for facet values. [Search for a facet’s values](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > Note: Pagination isn’t supported (‘page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`.
2404 2405 2406 2407 |
# File 'lib/algolia/api/search_client.rb', line 2404 def search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, = {}) response = search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchForFacetValuesResponse') end |
#search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ Http::Response
Search for facet values. [Search for a facet's values](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > Note: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`.
2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 |
# File 'lib/algolia/api/search_client.rb', line 2367 def search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `search_for_facet_values`." end # verify the required parameter 'facet_name' is set if @api_client.config.client_side_validation && facet_name.nil? raise ArgumentError, "Parameter `facet_name` is required when calling `search_for_facet_values`." end path = '/1/indexes/{indexName}/facets/{facetName}/query'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'facetName' + '}', @api_client.encode_uri(facet_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_for_facet_values_request) = .merge( :operation => :'SearchClient.search_for_facet_values', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_rules(index_name, search_rules_params = nil, request_options = {}) ⇒ SearchRulesResponse
Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body.
2446 2447 2448 2449 |
# File 'lib/algolia/api/search_client.rb', line 2446 def search_rules(index_name, search_rules_params = nil, = {}) response = search_rules_with_http_info(index_name, search_rules_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchRulesResponse') end |
#search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {}) ⇒ Http::Response
Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body.
2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 |
# File 'lib/algolia/api/search_client.rb', line 2415 def search_rules_with_http_info(index_name, search_rules_params = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `search_rules`." end path = '/1/indexes/{indexName}/rules/search'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_rules_params) = .merge( :operation => :'SearchClient.search_rules', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_single_index(index_name, search_params = nil, request_options = {}) ⇒ SearchResponse
Search an index. Return records that match the query.
2488 2489 2490 2491 |
# File 'lib/algolia/api/search_client.rb', line 2488 def search_single_index(index_name, search_params = nil, = {}) response = search_single_index_with_http_info(index_name, search_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchResponse') end |
#search_single_index_with_http_info(index_name, search_params = nil, request_options = {}) ⇒ Http::Response
Search an index. Return records that match the query.
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 |
# File 'lib/algolia/api/search_client.rb', line 2457 def search_single_index_with_http_info(index_name, search_params = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `search_single_index`." end path = '/1/indexes/{indexName}/query'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_params) = .merge( :operation => :'SearchClient.search_single_index', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_synonyms(index_name, search_synonyms_params = nil, request_options = {}) ⇒ SearchSynonymsResponse
Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body.
2530 2531 2532 2533 |
# File 'lib/algolia/api/search_client.rb', line 2530 def search_synonyms(index_name, search_synonyms_params = nil, = {}) response = search_synonyms_with_http_info(index_name, search_synonyms_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchSynonymsResponse') end |
#search_synonyms_with_http_info(index_name, search_synonyms_params = nil, request_options = {}) ⇒ Http::Response
Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body.
2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 |
# File 'lib/algolia/api/search_client.rb', line 2499 def search_synonyms_with_http_info(index_name, search_synonyms_params = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `search_synonyms`." end path = '/1/indexes/{indexName}/synonyms/search'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_synonyms_params) = .merge( :operation => :'SearchClient.search_synonyms', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_user_ids(search_user_ids_params, request_options = {}) ⇒ SearchUserIdsResponse
Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time. To ensure rapid updates, the user IDs index isn’t built at the same time as the mapping. Instead, it’s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
2570 2571 2572 2573 |
# File 'lib/algolia/api/search_client.rb', line 2570 def search_user_ids(search_user_ids_params, = {}) response = search_user_ids_with_http_info(search_user_ids_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchUserIdsResponse') end |
#search_user_ids_with_http_info(search_user_ids_params, request_options = {}) ⇒ Http::Response
Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 |
# File 'lib/algolia/api/search_client.rb', line 2540 def search_user_ids_with_http_info(search_user_ids_params, = {}) # verify the required parameter 'search_user_ids_params' is set if @api_client.config.client_side_validation && search_user_ids_params.nil? raise ArgumentError, "Parameter `search_user_ids_params` is required when calling `search_user_ids`." end path = '/1/clusters/mapping/search' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_user_ids_params) = .merge( :operation => :'SearchClient.search_user_ids', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_with_http_info(search_method_params, request_options = {}) ⇒ Http::Response
Search multiple indices. Send multiple search queries to one or more indices.
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 |
# File 'lib/algolia/api/search_client.rb', line 2279 def search_with_http_info(search_method_params, = {}) # verify the required parameter 'search_method_params' is set if @api_client.config.client_side_validation && search_method_params.nil? raise ArgumentError, "Parameter `search_method_params` is required when calling `search`." end path = '/1/indexes/*/queries' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_method_params) = .merge( :operation => :'SearchClient.search', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#set_dictionary_settings(dictionary_settings_params, request_options = {}) ⇒ UpdatedAtResponse
Set stop word settings. Set stop word settings for a specific language.
2610 2611 2612 2613 |
# File 'lib/algolia/api/search_client.rb', line 2610 def set_dictionary_settings(dictionary_settings_params, = {}) response = set_dictionary_settings_with_http_info(dictionary_settings_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {}) ⇒ Http::Response
Set stop word settings. Set stop word settings for a specific language.
2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 |
# File 'lib/algolia/api/search_client.rb', line 2580 def set_dictionary_settings_with_http_info(dictionary_settings_params, = {}) # verify the required parameter 'dictionary_settings_params' is set if @api_client.config.client_side_validation && dictionary_settings_params.nil? raise ArgumentError, "Parameter `dictionary_settings_params` is required when calling `set_dictionary_settings`." end path = '/1/dictionaries/*/settings' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(dictionary_settings_params) = .merge( :operation => :'SearchClient.set_dictionary_settings', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Update index settings. Update the specified [index settings](www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value.
2659 2660 2661 2662 |
# File 'lib/algolia/api/search_client.rb', line 2659 def set_settings(index_name, index_settings, forward_to_replicas = nil, = {}) response = set_settings_with_http_info(index_name, index_settings, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Update index settings. Update the specified [index settings](www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value.
2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 |
# File 'lib/algolia/api/search_client.rb', line 2622 def set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, = {}) # verify the required parameter 'index_name' is set if @api_client.config.client_side_validation && index_name.nil? raise ArgumentError, "Parameter `index_name` is required when calling `set_settings`." end # verify the required parameter 'index_settings' is set if @api_client.config.client_side_validation && index_settings.nil? raise ArgumentError, "Parameter `index_settings` is required when calling `set_settings`." end path = '/1/indexes/{indexName}/settings'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(index_settings) = .merge( :operation => :'SearchClient.set_settings', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#update_api_key(key, api_key, request_options = {}) ⇒ UpdateApiKeyResponse
Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key.
2705 2706 2707 2708 |
# File 'lib/algolia/api/search_client.rb', line 2705 def update_api_key(key, api_key, = {}) response = update_api_key_with_http_info(key, api_key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdateApiKeyResponse') end |
#update_api_key_with_http_info(key, api_key, request_options = {}) ⇒ Http::Response
Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key.
2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 |
# File 'lib/algolia/api/search_client.rb', line 2670 def update_api_key_with_http_info(key, api_key, = {}) # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? raise ArgumentError, "Parameter `key` is required when calling `update_api_key`." end # verify the required parameter 'api_key' is set if @api_client.config.client_side_validation && api_key.nil? raise ArgumentError, "Parameter `api_key` is required when calling `update_api_key`." end path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(api_key) = .merge( :operation => :'SearchClient.update_api_key', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:PUT, path, ) end |
#wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for an API key to be added, updated or deleted based on a given ‘operation`.
2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 |
# File 'lib/algolia/api/search_client.rb', line 2741 def wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, = {}) retries = 0 if operation == 'update' raise ArgumentError, '`api_key` is required when waiting for an `update` operation.' if api_key.nil? while retries < max_retries begin updatad_key = get_api_key(key, ) updated_key_hash = updatad_key.to_hash equals = true api_key.to_hash.each do |k, v| equals &&= updated_key_hash[k] == v end return updatad_key if equals rescue AlgoliaError => e raise e unless e.code == 404 end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end while retries < max_retries begin res = get_api_key(key, ) return res if operation == 'add' rescue AlgoliaError => e return res if operation == 'delete' && e.code == 404 end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end |
#wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for a task to be published (completed) for a given ‘index_name` and `task_id`.
2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 |
# File 'lib/algolia/api/search_client.rb', line 2718 def wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, = {}) retries = 0 while retries < max_retries res = get_task(index_name, task_id, ) if res.status == 'published' return res end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end |