Skip to content

Commit d6ad0a8

Browse files
authored
Merge branch 'main' into dependabot/bundler/httparty-gte-0.17.1-and-lt-0.23.0
2 parents 654eb8d + 1875bac commit d6ad0a8

File tree

15 files changed

+101
-39
lines changed

15 files changed

+101
-39
lines changed

.code-samples.meilisearch.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ update_settings_1: |-
190190
},
191191
faceting: {
192192
max_values_per_facet: 200
193-
}
193+
},
194+
search_cutoff_ms: 150
194195
})
195196
reset_settings_1: |-
196197
client.index('movies').reset_settings
@@ -642,3 +643,9 @@ update_proximity_precision_settings_1: |-
642643
client.index('books').update_proximity_precision('byAttribute')
643644
reset_proximity_precision_settings_1: |-
644645
client.index('books').reset_proximity_precision
646+
get_search_cutoff_1: |-
647+
client.index('movies').search_cutoff_ms
648+
update_search_cutoff_1: |-
649+
client.index('movies').update_search_cutoff_ms(150)
650+
reset_search_cutoff_1: |-
651+
client.index('movies').reset_search_cutoff_ms

.rubocop_todo.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-02-16 18:01:53 UTC using RuboCop version 1.50.2.
3+
# on 2024-06-01 14:58:01 UTC using RuboCop version 1.63.5.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 63
9+
# Offense count: 60
1010
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
1111
# AllowedMethods: refine
1212
Metrics/BlockLength:
13-
Max: 581
13+
Max: 607
1414

1515
# Offense count: 4
1616
# Configuration parameters: CountComments, CountAsOne.
1717
Metrics/ClassLength:
18-
Max: 421
18+
Max: 430
1919

2020
# Offense count: 1
2121
# Configuration parameters: Max, CountKeywordArgs.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ group :development, :test do
1818
end
1919

2020
group :development do
21-
gem 'rubocop', '~> 1.63.4', require: false
21+
gem 'rubocop', '~> 1.64.1', require: false
2222
end

lib/meilisearch/index.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def reset_stop_words
386386
Models::Task.new(response, task_endpoint)
387387
end
388388

389-
### SETTINGS - DINSTINCT ATTRIBUTE
389+
### SETTINGS - DISTINCT ATTRIBUTE
390390

391391
def distinct_attribute
392392
http_get "/indexes/#{@uid}/settings/distinct-attribute"
@@ -591,5 +591,19 @@ def update_proximity_precision(proximity_precision_attribute)
591591
def reset_proximity_precision
592592
http_delete("/indexes/#{@uid}/settings/proximity-precision")
593593
end
594+
595+
### SETTINGS - SEARCH CUTOFF MS
596+
597+
def search_cutoff_ms
598+
http_get("/indexes/#{@uid}/settings/search-cutoff-ms")
599+
end
600+
601+
def update_search_cutoff_ms(search_cutoff_ms_attribute)
602+
http_put("/indexes/#{@uid}/settings/search-cutoff-ms", search_cutoff_ms_attribute)
603+
end
604+
605+
def reset_search_cutoff_ms
606+
http_delete("/indexes/#{@uid}/settings/search-cutoff-ms")
607+
end
594608
end
595609
end

spec/meilisearch/client/health_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@
1111
it 'is unhealthy when the url is invalid' do
1212
expect(wrong_client.healthy?).to be false
1313
end
14+
15+
it 'returns the health information' do
16+
response = client.health
17+
expect(response).to be_a(Hash)
18+
expect(response).to have_key('status')
19+
end
1420
end

spec/meilisearch/client/requests_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RSpec.describe 'MeiliSearch::Client requests' do
44
let(:key) { SecureRandom.uuid }
55

6-
before(:each) do
6+
before do
77
expect(MeiliSearch::Client).to receive(:post)
88
.with(kind_of(String), hash_including(body: "{\"primaryKey\":\"#{key}\",\"uid\":\"#{key}\"}"))
99
.and_call_original

spec/meilisearch/client/token_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def initialize(api_key)
5353
it 'decodes successfully using @api_key from instance' do
5454
expect do
5555
JWT.decode token, client_key, true, VERIFY_OPTIONS
56-
end.to_not raise_error
56+
end.not_to raise_error
5757
end
5858

5959
it 'tries to decode without the right signature raises a error' do
@@ -89,7 +89,7 @@ def initialize(api_key)
8989
it 'allows generate token with a nil expires_at' do
9090
expect do
9191
instance.generate_tenant_token('uid', search_rules, expires_at: nil)
92-
end.to_not raise_error
92+
end.not_to raise_error
9393
end
9494

9595
it 'decodes successfully the expires_at param' do
@@ -117,7 +117,7 @@ def initialize(api_key)
117117
it 'allows generate token without expires_at' do
118118
expect do
119119
instance.generate_tenant_token('uid', search_rules)
120-
end.to_not raise_error
120+
end.not_to raise_error
121121
end
122122
end
123123

spec/meilisearch/index/base_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
client.create_index('books').await
66

77
index = client.fetch_index('books')
8-
expect(index).to be_a(MeiliSearch::Index)
8+
expect(index).to be_a(described_class)
99
expect(index.uid).to eq('books')
1010
expect(index.created_at).to be_a(Time)
1111
expect(index.created_at).to be_within(60).of(Time.now)
@@ -59,7 +59,7 @@
5959
task.await
6060

6161
index = client.fetch_index('uid')
62-
expect(index).to be_a(MeiliSearch::Index)
62+
expect(index).to be_a(described_class)
6363
expect(index.uid).to eq('uid')
6464
expect(index.primary_key).to eq('new_primary_key')
6565
expect(index.fetch_primary_key).to eq('new_primary_key')
@@ -77,7 +77,7 @@
7777
task.await
7878

7979
index = client.fetch_index('books')
80-
expect(index).to be_a(MeiliSearch::Index)
80+
expect(index).to be_a(described_class)
8181
expect(index.uid).to eq('books')
8282
expect(index.primary_key).to eq('international_standard_book_number')
8383
expect(index.fetch_primary_key).to eq('international_standard_book_number')
@@ -111,7 +111,7 @@
111111
index = new_client.fetch_index('books')
112112
expect(index.options).to eq({ max_retries: 1, timeout: 2, convert_body?: true })
113113

114-
expect(MeiliSearch::Index).to receive(:get).with(
114+
expect(described_class).to receive(:get).with(
115115
"#{URL}/indexes/books",
116116
{
117117
headers: expected_headers,
@@ -139,7 +139,7 @@
139139
index = new_client.fetch_index('books')
140140
expect(index.options).to eq(options.merge({ convert_body?: true }))
141141

142-
expect(MeiliSearch::Index).to receive(:get).with(
142+
expect(described_class).to receive(:get).with(
143143
"#{URL}/indexes/books",
144144
{
145145
headers: expected_headers,
@@ -194,7 +194,7 @@
194194
task.await
195195

196196
index = client.fetch_index('uid')
197-
expect(index).to be_a(MeiliSearch::Index)
197+
expect(index).to be_a(described_class)
198198
expect(index.uid).to eq('uid')
199199
expect(index.primary_key).to eq('new_primary_key')
200200
expect(index.fetch_primary_key).to eq('new_primary_key')

spec/meilisearch/index/documents_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@
153153

154154
it 'allows the user to store vectors' do
155155
enable_vector_store(true)
156-
new_doc = { objectId: 123, _vectors: [0.1, 0.2, 0.3] }
156+
new_doc = { objectId: 123, _vectors: { default: [0.1, 0.2, 0.3] } }
157157
client.create_index('vector_test').await
158158
new_index = client.index('vector_test')
159159
new_index.add_documents(new_doc).await
160-
expect(new_index.document(123)['_vectors']).to include(0.1)
160+
expect(new_index.search('123', retrieveVectors: true)['hits'][0]['_vectors']).to include('default')
161161
end
162162
end
163163
end

spec/meilisearch/index/search/q_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,9 @@
7272
context 'with finite pagination params' do
7373
it 'responds with specialized fields' do
7474
response = index.search('coco', { page: 2, hits_per_page: 2 })
75-
7675
expect(response.keys).to contain_exactly(*FINITE_PAGINATED_SEARCH_RESPONSE_KEYS)
77-
end
7876

79-
it 'responds with specialized fields' do
8077
response = index.search('coco', { page: 2, hitsPerPage: 2 })
81-
8278
expect(response.keys).to contain_exactly(*FINITE_PAGINATED_SEARCH_RESPONSE_KEYS)
8379
end
8480
end

0 commit comments

Comments
 (0)