Skip to content

Commit 3dbda99

Browse files
authored
Merge branch 'main' into feat/similar-search
2 parents bf1b409 + 75b78f6 commit 3dbda99

19 files changed

+97
-18
lines changed

.code-samples.meilisearch.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,3 +655,21 @@ reset_search_cutoff_1: |-
655655
client.index('movies').reset_search_cutoff_ms
656656
get_similar_post_1: |-
657657
client.index('INDEX_NAME').search_similar_documents('TARGET_DOCUMENT_ID')
658+
search_parameter_reference_ranking_score_threshold_1: |-
659+
client.index('INDEX_NAME').search('badman', {
660+
rankingScoreThreshold: 0.2
661+
})
662+
search_parameter_reference_distinct_1: |-
663+
client.index('INDEX_NAME').search('QUERY TERMS', {
664+
distinct: 'ATTRIBUTE_A'
665+
})
666+
distinct_attribute_guide_filterable_1: |-
667+
client.index('products').update_filterable_attributes([
668+
'product_id',
669+
'sku',
670+
'url'
671+
])
672+
distinct_attribute_guide_distinct_parameter_1: |-
673+
client.index('products').search('white shirt', {
674+
distinct: 'sku'
675+
})

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
ruby-version: ['3.1', '3.2', '3.3']
2121
name: integration-tests (ruby ${{ matrix.ruby-version }})
22-
runs-on: ubuntu-22.04
22+
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
2525
- name: Set up Ruby ${{ matrix.ruby-version }}

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-06-01 14:58:01 UTC using RuboCop version 1.63.5.
3+
# on 2024-09-10 01:25:16 UTC using RuboCop version 1.65.1.
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

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.64.1', require: false
21+
gem 'rubocop', '~> 1.66.0', require: false
2222
end

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ volumes:
33

44
services:
55
package:
6-
image: ruby:3.0
6+
image: ruby:3.3
77
tty: true
88
stdin_open: true
99
working_dir: /home/package

lib/meilisearch.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require 'json'
4+
35
require 'meilisearch/version'
46
require 'meilisearch/utils'
57
require 'meilisearch/models/task'

lib/meilisearch/error.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def initialize(message = nil)
7070
end
7171
end
7272

73+
class InvalidDocumentId < Error
74+
attr_reader :message
75+
76+
def initialize(message = nil)
77+
@message = "The document id is invalid. #{message}"
78+
super(@message)
79+
end
80+
end
81+
7382
module TenantToken
7483
class ExpireOrInvalidSignature < MeiliSearch::Error; end
7584
class InvalidApiKey < MeiliSearch::Error; end

lib/meilisearch/index.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def delete_documents!(documents_ids)
220220
alias delete_multiple_documents! delete_documents!
221221

222222
def delete_document(document_id)
223+
if document_id.nil? || document_id.to_s.empty?
224+
raise MeiliSearch::InvalidDocumentId, 'document_id cannot be empty or nil'
225+
end
226+
223227
encode_document = URI.encode_www_form_component(document_id)
224228
response = http_delete "/indexes/#{@uid}/documents/#{encode_document}"
225229

lib/meilisearch/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module MeiliSearch
4-
VERSION = '0.28.0'
4+
VERSION = '0.28.3'
55

66
def self.qualified_version
77
"Meilisearch Ruby (v#{VERSION})"

meilisearch.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Gem::Specification.new do |s|
1515
s.files = Dir['{lib}/**/*', 'LICENSE', 'README.md']
1616

1717
s.required_ruby_version = '>= 3.0.0'
18-
s.add_dependency 'httparty', '~> 0.17.1'
18+
s.add_dependency 'httparty', '~> 0.17'
1919
s.metadata['rubygems_mfa_required'] = 'true'
2020
end

0 commit comments

Comments
 (0)