Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acef680
commit 7999210
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module MeiliSearch | ||
module MultiSearch | ||
def multi_search(data) | ||
body = Utils.transform_attributes(data) | ||
|
||
http_post '/multi-search', queries: body | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
RSpec.describe 'MeiliSearch::Client - Multiple Index Search' do | ||
|
||
before do | ||
client.create_index('books') | ||
client.create_index('movies') | ||
end | ||
|
||
it 'does a custom search with two different indexes' do | ||
response = client.multi_search([ | ||
{ index_uid: 'books', q: 'prince' }, | ||
{ index_uid: 'movies', q: 'prince' } | ||
]) | ||
|
||
expect(response['results'].count).to eq(2) | ||
expect(response['results'][0]['estimatedTotalHits']).to eq(0) | ||
expect(response['results'][1]['estimatedTotalHits']).to eq(0) | ||
end | ||
end |