Class: MeiliSearch::Index
Constant Summary
Constants inherited
from HTTPRequest
HTTPRequest::DEFAULT_OPTIONS
Instance Attribute Summary collapse
Attributes inherited from HTTPRequest
#headers, #options
Instance Method Summary
collapse
-
#add_documents(documents, primary_key = nil) ⇒ Object
(also: #replace_documents, #add_or_replace_documents)
-
#add_documents!(documents, primary_key = nil) ⇒ Object
(also: #replace_documents!, #add_or_replace_documents!)
-
#add_documents_csv(documents, primary_key = nil, delimiter = nil) ⇒ Object
(also: #replace_documents_csv, #add_or_replace_documents_csv)
-
#add_documents_in_batches(documents, batch_size = 1000, primary_key = nil) ⇒ Object
-
#add_documents_in_batches!(documents, batch_size = 1000, primary_key = nil) ⇒ Object
-
#add_documents_json(documents, primary_key = nil) ⇒ Object
(also: #replace_documents_json, #add_or_replace_documents_json)
-
#add_documents_ndjson(documents, primary_key = nil) ⇒ Object
(also: #replace_documents_ndjson, #add_or_replace_documents_ndjson)
-
#delete ⇒ Object
(also: #delete_index)
-
#delete_all_documents ⇒ Object
-
#delete_all_documents! ⇒ Object
-
#delete_document(document_id) ⇒ Object
(also: #delete_one_document)
-
#delete_document!(document_id) ⇒ Object
(also: #delete_one_document!)
-
#delete_documents(options = {}) ⇒ Object
(also: #delete_multiple_documents)
Public: Delete documents from an index.
-
#delete_documents!(documents_ids) ⇒ Object
(also: #delete_multiple_documents!)
-
#displayed_attributes ⇒ Object
(also: #get_displayed_attributes)
SETTINGS - DISPLAYED ATTRIBUTES.
-
#distinct_attribute ⇒ Object
(also: #get_distinct_attribute)
SETTINGS - DINSTINCT ATTRIBUTE.
-
#document(document_id, fields: nil) ⇒ Object
(also: #get_document, #get_one_document)
-
#documents(options = {}) ⇒ Object
(also: #get_documents)
Public: Retrieve documents from a index.
-
#faceting ⇒ Object
(also: #get_faceting)
-
#fetch_info ⇒ Object
-
#fetch_primary_key ⇒ Object
(also: #get_primary_key)
-
#fetch_raw_info ⇒ Object
-
#field_distribution ⇒ Object
-
#filterable_attributes ⇒ Object
(also: #get_filterable_attributes)
SETTINGS - FILTERABLE ATTRIBUTES.
-
#indexing? ⇒ Boolean
-
#initialize(index_uid, url, api_key = nil, primary_key = nil, options = {}) ⇒ Index
constructor
-
#number_of_documents ⇒ Object
-
#pagination ⇒ Object
(also: #get_pagination)
-
#ranking_rules ⇒ Object
(also: #get_ranking_rules)
SETTINGS - RANKING RULES.
-
#reset_displayed_attributes ⇒ Object
-
#reset_distinct_attribute ⇒ Object
-
#reset_faceting ⇒ Object
-
#reset_filterable_attributes ⇒ Object
-
#reset_pagination ⇒ Object
-
#reset_ranking_rules ⇒ Object
-
#reset_searchable_attributes ⇒ Object
-
#reset_settings ⇒ Object
-
#reset_sortable_attributes ⇒ Object
-
#reset_stop_words ⇒ Object
-
#reset_synonyms ⇒ Object
-
#reset_typo_tolerance ⇒ Object
-
#search(query, options = {}) ⇒ Object
options: A Hash show_ranking_score - To see the ranking scores for returned documents attributes_to_search_on - Customize attributes to search on at search time.
-
#searchable_attributes ⇒ Object
(also: #get_searchable_attributes)
SETTINGS - SEARCHABLE ATTRIBUTES.
-
#settings ⇒ Object
(also: #get_settings)
-
#sortable_attributes ⇒ Object
(also: #get_sortable_attributes)
SETTINGS - SORTABLE ATTRIBUTES.
-
#stats ⇒ Object
-
#stop_words ⇒ Object
(also: #get_stop_words)
-
#synonyms ⇒ Object
(also: #get_synonyms)
-
#task(task_uid) ⇒ Object
-
#tasks ⇒ Object
-
#typo_tolerance ⇒ Object
(also: #get_typo_tolerance)
-
#update(body) ⇒ Object
(also: #update_index)
-
#update_displayed_attributes(displayed_attributes) ⇒ Object
(also: #displayed_attributes=)
-
#update_distinct_attribute(distinct_attribute) ⇒ Object
(also: #distinct_attribute=)
-
#update_documents(documents, primary_key = nil) ⇒ Object
(also: #add_or_update_documents)
-
#update_documents!(documents, primary_key = nil) ⇒ Object
(also: #add_or_update_documents!)
-
#update_documents_in_batches(documents, batch_size = 1000, primary_key = nil) ⇒ Object
-
#update_documents_in_batches!(documents, batch_size = 1000, primary_key = nil) ⇒ Object
-
#update_faceting(faceting_attributes) ⇒ Object
(also: #faceting=)
-
#update_filterable_attributes(filterable_attributes) ⇒ Object
(also: #filterable_attributes=)
-
#update_pagination(pagination) ⇒ Object
-
#update_ranking_rules(ranking_rules) ⇒ Object
(also: #ranking_rules=)
-
#update_searchable_attributes(searchable_attributes) ⇒ Object
(also: #searchable_attributes=)
-
#update_settings(settings) ⇒ Object
(also: #settings=)
-
#update_sortable_attributes(sortable_attributes) ⇒ Object
(also: #sortable_attributes=, #pagination=)
-
#update_stop_words(stop_words) ⇒ Object
(also: #stop_words=)
-
#update_synonyms(synonyms) ⇒ Object
(also: #synonyms=)
-
#update_typo_tolerance(typo_tolerance_attributes) ⇒ Object
(also: #typo_tolerance=)
-
#wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50) ⇒ Object
Methods inherited from HTTPRequest
#http_delete, #http_get, #http_patch, #http_post, #http_put
Constructor Details
#initialize(index_uid, url, api_key = nil, primary_key = nil, options = {}) ⇒ Index
Returns a new instance of Index.
9
10
11
12
13
|
# File 'lib/meilisearch/index.rb', line 9
def initialize(index_uid, url, api_key = nil, primary_key = nil, options = {})
@uid = index_uid
@primary_key = primary_key
super(url, api_key, options)
end
|
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
7
8
9
|
# File 'lib/meilisearch/index.rb', line 7
def created_at
@created_at
end
|
#primary_key ⇒ Object
Returns the value of attribute primary_key.
7
8
9
|
# File 'lib/meilisearch/index.rb', line 7
def primary_key
@primary_key
end
|
#uid ⇒ Object
Returns the value of attribute uid.
7
8
9
|
# File 'lib/meilisearch/index.rb', line 7
def uid
@uid
end
|
#updated_at ⇒ Object
Returns the value of attribute updated_at.
7
8
9
|
# File 'lib/meilisearch/index.rb', line 7
def updated_at
@updated_at
end
|
Instance Method Details
#add_documents(documents, primary_key = nil) ⇒ Object
Also known as:
replace_documents, add_or_replace_documents
87
88
89
90
|
# File 'lib/meilisearch/index.rb', line 87
def add_documents(documents, primary_key = nil)
documents = [documents] if documents.is_a?(Hash)
http_post "/indexes/#{@uid}/documents", documents, { primaryKey: primary_key }.compact
end
|
#add_documents!(documents, primary_key = nil) ⇒ Object
Also known as:
replace_documents!, add_or_replace_documents!
94
95
96
97
|
# File 'lib/meilisearch/index.rb', line 94
def add_documents!(documents, primary_key = nil)
task = add_documents(documents, primary_key)
wait_for_task(task['taskUid'])
end
|
#add_documents_csv(documents, primary_key = nil, delimiter = nil) ⇒ Object
Also known as:
replace_documents_csv, add_or_replace_documents_csv
115
116
117
118
119
120
121
122
|
# File 'lib/meilisearch/index.rb', line 115
def add_documents_csv(documents, primary_key = nil, delimiter = nil)
options = { headers: { 'Content-Type' => 'text/csv' }, convert_body?: false }
http_post "/indexes/#{@uid}/documents", documents, {
primaryKey: primary_key,
csvDelimiter: delimiter
}.compact, options
end
|
#add_documents_in_batches(documents, batch_size = 1000, primary_key = nil) ⇒ Object
138
139
140
141
142
143
144
|
# File 'lib/meilisearch/index.rb', line 138
def add_documents_in_batches(documents, batch_size = 1000, primary_key = nil)
tasks = []
documents.each_slice(batch_size) do |batch|
tasks.append(add_documents(batch, primary_key))
end
tasks
end
|
#add_documents_in_batches!(documents, batch_size = 1000, primary_key = nil) ⇒ Object
146
147
148
149
150
151
152
153
|
# File 'lib/meilisearch/index.rb', line 146
def add_documents_in_batches!(documents, batch_size = 1000, primary_key = nil)
tasks = add_documents_in_batches(documents, batch_size, primary_key)
responses = []
tasks.each do |task_obj|
responses.append(wait_for_task(task_obj['taskUid']))
end
responses
end
|
#add_documents_json(documents, primary_key = nil) ⇒ Object
Also known as:
replace_documents_json, add_or_replace_documents_json
101
102
103
104
|
# File 'lib/meilisearch/index.rb', line 101
def add_documents_json(documents, primary_key = nil)
options = { convert_body?: false }
http_post "/indexes/#{@uid}/documents", documents, { primaryKey: primary_key }.compact, options
end
|
#add_documents_ndjson(documents, primary_key = nil) ⇒ Object
Also known as:
replace_documents_ndjson, add_or_replace_documents_ndjson
108
109
110
111
|
# File 'lib/meilisearch/index.rb', line 108
def add_documents_ndjson(documents, primary_key = nil)
options = { headers: { 'Content-Type' => 'application/x-ndjson' }, convert_body?: false }
http_post "/indexes/#{@uid}/documents", documents, { primaryKey: primary_key }.compact, options
end
|
#delete ⇒ Object
Also known as:
delete_index
38
39
40
|
# File 'lib/meilisearch/index.rb', line 38
def delete
http_delete indexes_path(id: @uid)
end
|
#delete_all_documents ⇒ Object
212
213
214
|
# File 'lib/meilisearch/index.rb', line 212
def delete_all_documents
http_delete "/indexes/#{@uid}/documents"
end
|
#delete_all_documents! ⇒ Object
216
217
218
219
|
# File 'lib/meilisearch/index.rb', line 216
def delete_all_documents!
task = delete_all_documents
wait_for_task(task['taskUid'])
end
|
#delete_document(document_id) ⇒ Object
Also known as:
delete_one_document
200
201
202
203
|
# File 'lib/meilisearch/index.rb', line 200
def delete_document(document_id)
encode_document = URI.encode_www_form_component(document_id)
http_delete "/indexes/#{@uid}/documents/#{encode_document}"
end
|
#delete_document!(document_id) ⇒ Object
Also known as:
delete_one_document!
206
207
208
209
|
# File 'lib/meilisearch/index.rb', line 206
def delete_document!(document_id)
task = delete_document(document_id)
wait_for_task(task['taskUid'])
end
|
#delete_documents(options = {}) ⇒ Object
Also known as:
delete_multiple_documents
Public: Delete documents from an index
options: A Hash or an Array containing documents_ids or a hash with filter:.
filter: - A hash containing a filter that should match documents.
Available ONLY with Meilisearch v1.2 and newer (optional)
Returns a Task object.
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/meilisearch/index.rb', line 179
def delete_documents(options = {})
Utils.version_error_handler(__method__) do
if options.is_a?(Hash) && options.key?(:filter)
http_post "/indexes/#{@uid}/documents/delete", options
else
options = [options] unless options.is_a?(Array)
http_post "/indexes/#{@uid}/documents/delete-batch", options
end
end
end
|
#delete_documents!(documents_ids) ⇒ Object
Also known as:
delete_multiple_documents!
194
195
196
197
|
# File 'lib/meilisearch/index.rb', line 194
def delete_documents!(documents_ids)
task = delete_documents(documents_ids)
wait_for_task(task['taskUid'])
end
|
#displayed_attributes ⇒ Object
Also known as:
get_displayed_attributes
SETTINGS - DISPLAYED ATTRIBUTES
373
374
375
|
# File 'lib/meilisearch/index.rb', line 373
def displayed_attributes
http_get "/indexes/#{@uid}/settings/displayed-attributes"
end
|
#distinct_attribute ⇒ Object
Also known as:
get_distinct_attribute
SETTINGS - DINSTINCT ATTRIBUTE
341
342
343
|
# File 'lib/meilisearch/index.rb', line 341
def distinct_attribute
http_get "/indexes/#{@uid}/settings/distinct-attribute"
end
|
#document(document_id, fields: nil) ⇒ Object
Also known as:
get_document, get_one_document
57
58
59
60
61
62
|
# File 'lib/meilisearch/index.rb', line 57
def document(document_id, fields: nil)
encode_document = URI.encode_www_form_component(document_id)
body = { fields: fields&.join(',') }.compact
http_get("/indexes/#{@uid}/documents/#{encode_document}", body)
end
|
#documents(options = {}) ⇒ Object
Also known as:
get_documents
Public: Retrieve documents from a index.
options - The hash options used to refine the selection (default: {}):
:limit - Number of documents to return (optional).
:offset - Number of documents to skip (optional).
:fields - Array of document attributes to show (optional).
:filter - Filter queries by an attribute's value.
Available ONLY with Meilisearch v1.2 and newer (optional).
Returns the documents results object.
76
77
78
79
80
81
82
83
84
|
# File 'lib/meilisearch/index.rb', line 76
def documents(options = {})
Utils.version_error_handler(__method__) do
if options.key?(:filter)
http_post "/indexes/#{@uid}/documents/fetch", Utils.filter(options, [:limit, :offset, :fields, :filter])
else
http_get "/indexes/#{@uid}/documents", Utils.parse_query(options, [:limit, :offset, :fields])
end
end
end
|
#faceting ⇒ Object
Also known as:
get_faceting
450
451
452
|
# File 'lib/meilisearch/index.rb', line 450
def faceting
http_get("/indexes/#{@uid}/settings/faceting")
end
|
#fetch_info ⇒ Object
15
16
17
18
19
|
# File 'lib/meilisearch/index.rb', line 15
def fetch_info
index_hash = http_get indexes_path(id: @uid)
set_base_properties index_hash
self
end
|
#fetch_primary_key ⇒ Object
Also known as:
get_primary_key
21
22
23
|
# File 'lib/meilisearch/index.rb', line 21
def fetch_primary_key
fetch_info.primary_key
end
|
#fetch_raw_info ⇒ Object
26
27
28
29
30
|
# File 'lib/meilisearch/index.rb', line 26
def fetch_raw_info
index_hash = http_get indexes_path(id: @uid)
set_base_properties index_hash
index_hash
end
|
#field_distribution ⇒ Object
270
271
272
|
# File 'lib/meilisearch/index.rb', line 270
def field_distribution
stats['fieldDistribution']
end
|
#filterable_attributes ⇒ Object
Also known as:
get_filterable_attributes
SETTINGS - FILTERABLE ATTRIBUTES
389
390
391
|
# File 'lib/meilisearch/index.rb', line 389
def filterable_attributes
http_get "/indexes/#{@uid}/settings/filterable-attributes"
end
|
#indexing? ⇒ Boolean
266
267
268
|
# File 'lib/meilisearch/index.rb', line 266
def indexing?
stats['isIndexing']
end
|
#number_of_documents ⇒ Object
262
263
264
|
# File 'lib/meilisearch/index.rb', line 262
def number_of_documents
stats['numberOfDocuments']
end
|
421
422
423
|
# File 'lib/meilisearch/index.rb', line 421
def
http_get("/indexes/#{@uid}/settings/pagination")
end
|
#ranking_rules ⇒ Object
Also known as:
get_ranking_rules
292
293
294
|
# File 'lib/meilisearch/index.rb', line 292
def ranking_rules
http_get "/indexes/#{@uid}/settings/ranking-rules"
end
|
#reset_displayed_attributes ⇒ Object
383
384
385
|
# File 'lib/meilisearch/index.rb', line 383
def reset_displayed_attributes
http_delete "/indexes/#{@uid}/settings/displayed-attributes"
end
|
#reset_distinct_attribute ⇒ Object
351
352
353
|
# File 'lib/meilisearch/index.rb', line 351
def reset_distinct_attribute
http_delete "/indexes/#{@uid}/settings/distinct-attribute"
end
|
#reset_faceting ⇒ Object
461
462
463
|
# File 'lib/meilisearch/index.rb', line 461
def reset_faceting
http_delete("/indexes/#{@uid}/settings/faceting")
end
|
#reset_filterable_attributes ⇒ Object
399
400
401
|
# File 'lib/meilisearch/index.rb', line 399
def reset_filterable_attributes
http_delete "/indexes/#{@uid}/settings/filterable-attributes"
end
|
431
432
433
|
# File 'lib/meilisearch/index.rb', line 431
def
http_delete "/indexes/#{@uid}/settings/pagination"
end
|
#reset_ranking_rules ⇒ Object
302
303
304
|
# File 'lib/meilisearch/index.rb', line 302
def reset_ranking_rules
http_delete "/indexes/#{@uid}/settings/ranking-rules"
end
|
#reset_searchable_attributes ⇒ Object
367
368
369
|
# File 'lib/meilisearch/index.rb', line 367
def reset_searchable_attributes
http_delete "/indexes/#{@uid}/settings/searchable-attributes"
end
|
#reset_settings ⇒ Object
286
287
288
|
# File 'lib/meilisearch/index.rb', line 286
def reset_settings
http_delete "/indexes/#{@uid}/settings"
end
|
#reset_sortable_attributes ⇒ Object
415
416
417
|
# File 'lib/meilisearch/index.rb', line 415
def reset_sortable_attributes
http_delete "/indexes/#{@uid}/settings/sortable-attributes"
end
|
#reset_stop_words ⇒ Object
335
336
337
|
# File 'lib/meilisearch/index.rb', line 335
def reset_stop_words
http_delete "/indexes/#{@uid}/settings/stop-words"
end
|
#reset_synonyms ⇒ Object
318
319
320
|
# File 'lib/meilisearch/index.rb', line 318
def reset_synonyms
http_delete "/indexes/#{@uid}/settings/synonyms"
end
|
#reset_typo_tolerance ⇒ Object
446
447
448
|
# File 'lib/meilisearch/index.rb', line 446
def reset_typo_tolerance
http_delete("/indexes/#{@uid}/settings/typo-tolerance")
end
|
#search(query, options = {}) ⇒ Object
options: A Hash
show_ranking_score - To see the ranking scores for returned documents
attributes_to_search_on - Customize attributes to search on at search time.
226
227
228
229
230
231
232
233
234
235
|
# File 'lib/meilisearch/index.rb', line 226
def search(query, options = {})
attributes = { q: query.to_s }.merge(options.compact)
parsed_options = Utils.transform_attributes(attributes)
response = http_post "/indexes/#{@uid}/search", parsed_options
response['nbHits'] ||= response['estimatedTotalHits'] unless response.key?('totalPages')
response
end
|
#searchable_attributes ⇒ Object
Also known as:
get_searchable_attributes
SETTINGS - SEARCHABLE ATTRIBUTES
357
358
359
|
# File 'lib/meilisearch/index.rb', line 357
def searchable_attributes
http_get "/indexes/#{@uid}/settings/searchable-attributes"
end
|
#settings ⇒ Object
Also known as:
get_settings
276
277
278
|
# File 'lib/meilisearch/index.rb', line 276
def settings
http_get "/indexes/#{@uid}/settings"
end
|
#sortable_attributes ⇒ Object
Also known as:
get_sortable_attributes
SETTINGS - SORTABLE ATTRIBUTES
405
406
407
|
# File 'lib/meilisearch/index.rb', line 405
def sortable_attributes
http_get "/indexes/#{@uid}/settings/sortable-attributes"
end
|
#stats ⇒ Object
258
259
260
|
# File 'lib/meilisearch/index.rb', line 258
def stats
http_get "/indexes/#{@uid}/stats"
end
|
#stop_words ⇒ Object
Also known as:
get_stop_words
324
325
326
|
# File 'lib/meilisearch/index.rb', line 324
def stop_words
http_get "/indexes/#{@uid}/settings/stop-words"
end
|
#synonyms ⇒ Object
Also known as:
get_synonyms
308
309
310
|
# File 'lib/meilisearch/index.rb', line 308
def synonyms
http_get "/indexes/#{@uid}/settings/synonyms"
end
|
#task(task_uid) ⇒ Object
244
245
246
|
# File 'lib/meilisearch/index.rb', line 244
def task(task_uid)
task_endpoint.index_task(task_uid)
end
|
#tasks ⇒ Object
248
249
250
|
# File 'lib/meilisearch/index.rb', line 248
def tasks
task_endpoint.index_tasks(@uid)
end
|
#typo_tolerance ⇒ Object
Also known as:
get_typo_tolerance
435
436
437
|
# File 'lib/meilisearch/index.rb', line 435
def typo_tolerance
http_get("/indexes/#{@uid}/settings/typo-tolerance")
end
|
#update(body) ⇒ Object
Also known as:
update_index
32
33
34
|
# File 'lib/meilisearch/index.rb', line 32
def update(body)
http_patch indexes_path(id: @uid), Utils.transform_attributes(body)
end
|
#update_displayed_attributes(displayed_attributes) ⇒ Object
Also known as:
displayed_attributes=
378
379
380
|
# File 'lib/meilisearch/index.rb', line 378
def update_displayed_attributes(displayed_attributes)
http_put "/indexes/#{@uid}/settings/displayed-attributes", displayed_attributes
end
|
#update_distinct_attribute(distinct_attribute) ⇒ Object
Also known as:
distinct_attribute=
346
347
348
|
# File 'lib/meilisearch/index.rb', line 346
def update_distinct_attribute(distinct_attribute)
http_put "/indexes/#{@uid}/settings/distinct-attribute", distinct_attribute
end
|
#update_documents(documents, primary_key = nil) ⇒ Object
Also known as:
add_or_update_documents
126
127
128
129
|
# File 'lib/meilisearch/index.rb', line 126
def update_documents(documents, primary_key = nil)
documents = [documents] if documents.is_a?(Hash)
http_put "/indexes/#{@uid}/documents", documents, { primaryKey: primary_key }.compact
end
|
#update_documents!(documents, primary_key = nil) ⇒ Object
Also known as:
add_or_update_documents!
132
133
134
135
|
# File 'lib/meilisearch/index.rb', line 132
def update_documents!(documents, primary_key = nil)
task = update_documents(documents, primary_key)
wait_for_task(task['taskUid'])
end
|
#update_documents_in_batches(documents, batch_size = 1000, primary_key = nil) ⇒ Object
155
156
157
158
159
160
161
|
# File 'lib/meilisearch/index.rb', line 155
def update_documents_in_batches(documents, batch_size = 1000, primary_key = nil)
tasks = []
documents.each_slice(batch_size) do |batch|
tasks.append(update_documents(batch, primary_key))
end
tasks
end
|
#update_documents_in_batches!(documents, batch_size = 1000, primary_key = nil) ⇒ Object
163
164
165
166
167
168
169
170
|
# File 'lib/meilisearch/index.rb', line 163
def update_documents_in_batches!(documents, batch_size = 1000, primary_key = nil)
tasks = update_documents_in_batches(documents, batch_size, primary_key)
responses = []
tasks.each do |task_obj|
responses.append(wait_for_task(task_obj['taskUid']))
end
responses
end
|
#update_faceting(faceting_attributes) ⇒ Object
Also known as:
faceting=
455
456
457
458
|
# File 'lib/meilisearch/index.rb', line 455
def update_faceting(faceting_attributes)
attributes = Utils.transform_attributes(faceting_attributes)
http_patch("/indexes/#{@uid}/settings/faceting", attributes)
end
|
#update_filterable_attributes(filterable_attributes) ⇒ Object
Also known as:
filterable_attributes=
394
395
396
|
# File 'lib/meilisearch/index.rb', line 394
def update_filterable_attributes(filterable_attributes)
http_put "/indexes/#{@uid}/settings/filterable-attributes", filterable_attributes
end
|
426
427
428
|
# File 'lib/meilisearch/index.rb', line 426
def ()
http_patch "/indexes/#{@uid}/settings/pagination",
end
|
#update_ranking_rules(ranking_rules) ⇒ Object
Also known as:
ranking_rules=
297
298
299
|
# File 'lib/meilisearch/index.rb', line 297
def update_ranking_rules(ranking_rules)
http_put "/indexes/#{@uid}/settings/ranking-rules", ranking_rules
end
|
#update_searchable_attributes(searchable_attributes) ⇒ Object
Also known as:
searchable_attributes=
362
363
364
|
# File 'lib/meilisearch/index.rb', line 362
def update_searchable_attributes(searchable_attributes)
http_put "/indexes/#{@uid}/settings/searchable-attributes", searchable_attributes
end
|
#update_settings(settings) ⇒ Object
Also known as:
settings=
281
282
283
|
# File 'lib/meilisearch/index.rb', line 281
def update_settings(settings)
http_patch "/indexes/#{@uid}/settings", Utils.transform_attributes(settings)
end
|
#update_sortable_attributes(sortable_attributes) ⇒ Object
Also known as:
sortable_attributes=,
410
411
412
|
# File 'lib/meilisearch/index.rb', line 410
def update_sortable_attributes(sortable_attributes)
http_put "/indexes/#{@uid}/settings/sortable-attributes", sortable_attributes
end
|
#update_stop_words(stop_words) ⇒ Object
Also known as:
stop_words=
329
330
331
332
|
# File 'lib/meilisearch/index.rb', line 329
def update_stop_words(stop_words)
body = stop_words.nil? || stop_words.is_a?(Array) ? stop_words : [stop_words]
http_put "/indexes/#{@uid}/settings/stop-words", body
end
|
#update_synonyms(synonyms) ⇒ Object
Also known as:
synonyms=
313
314
315
|
# File 'lib/meilisearch/index.rb', line 313
def update_synonyms(synonyms)
http_put "/indexes/#{@uid}/settings/synonyms", synonyms
end
|
#update_typo_tolerance(typo_tolerance_attributes) ⇒ Object
Also known as:
typo_tolerance=
440
441
442
443
|
# File 'lib/meilisearch/index.rb', line 440
def update_typo_tolerance(typo_tolerance_attributes)
attributes = Utils.transform_attributes(typo_tolerance_attributes)
http_patch("/indexes/#{@uid}/settings/typo-tolerance", attributes)
end
|
#wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50) ⇒ Object
252
253
254
|
# File 'lib/meilisearch/index.rb', line 252
def wait_for_task(task_uid, timeout_in_ms = 5000, interval_in_ms = 50)
task_endpoint.wait_for_task(task_uid, timeout_in_ms, interval_in_ms)
end
|