From db881151687303cd6f522f371bfc03883c37a466 Mon Sep 17 00:00:00 2001 From: Bruno Casali Date: Fri, 2 Sep 2022 12:01:41 -0300 Subject: [PATCH] Add tests to custom search with matching_strategy param --- .../index/search/matching_strategy_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/meilisearch/index/search/matching_strategy_spec.rb diff --git a/spec/meilisearch/index/search/matching_strategy_spec.rb b/spec/meilisearch/index/search/matching_strategy_spec.rb new file mode 100644 index 00000000..4324e627 --- /dev/null +++ b/spec/meilisearch/index/search/matching_strategy_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.describe 'MeiliSearch::Index - Search with matching_strategy' do + include_context 'search books with nested fields' + + it 'does a custom search with a matching strategy ALL' do + response = index.search('another french book', matching_strategy: 'all') + + expect(response['hits'].count).to eq(1) + end + + it 'does a custom search with a matching strategy LAST' do + response = index.search('french book', matching_strategy: 'last') + + expect(response['hits'].count).to eq(2) + end +end