|
11 | 11 | { objectId: 4, title: 'Harry Potter and the Half-Blood Prince', genre: 'fantasy' }, |
12 | 12 | { objectId: 42, title: 'The Hitchhiker\'s Guide to the Galaxy' } |
13 | 13 | ] |
14 | | - client = MeiliSearch::Client.new($URL, $MASTER_KEY) |
| 14 | + client = MeiliSearch::Client.new(URL, MASTER_KEY) |
15 | 15 | clear_all_indexes(client) |
16 | 16 | @index = client.create_index('books') |
17 | 17 | response = @index.add_documents(@documents) |
|
25 | 25 | it 'does a custom search with one attributesToRetrieve' do |
26 | 26 | response = @index.search('the', attributesToRetrieve: ['title']) |
27 | 27 | expect(response).to be_a(Hash) |
28 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 28 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
29 | 29 | expect(response['hits'].count).to eq(3) |
30 | 30 | expect(response['hits'].first).to have_key('title') |
31 | 31 | expect(response['hits'].first).not_to have_key('objectId') |
|
35 | 35 | it 'does a custom search with multiple attributesToRetrieve' do |
36 | 36 | response = @index.search('the', attributesToRetrieve: ['title', 'genre']) |
37 | 37 | expect(response).to be_a(Hash) |
38 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 38 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
39 | 39 | expect(response['hits'].count).to eq(3) |
40 | 40 | expect(response['hits'].first).to have_key('title') |
41 | 41 | expect(response['hits'].first).not_to have_key('objectId') |
|
45 | 45 | it 'does a custom search with all attributesToRetrieve' do |
46 | 46 | response = @index.search('the', attributesToRetrieve: ['*']) |
47 | 47 | expect(response).to be_a(Hash) |
48 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 48 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
49 | 49 | expect(response['hits'].count).to eq(3) |
50 | 50 | expect(response['hits'].first).to have_key('objectId') |
51 | 51 | expect(response['hits'].first).to have_key('title') |
|
55 | 55 | it 'does a placeholder search with one attributesToRetrieve' do |
56 | 56 | response = @index.search('', attributesToRetrieve: ['title']) |
57 | 57 | expect(response).to be_a(Hash) |
58 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 58 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
59 | 59 | expect(response['hits'].count).to eq(@documents.count) |
60 | 60 | expect(response['hits'].first).to have_key('title') |
61 | 61 | expect(response['hits'].first).not_to have_key('objectId') |
|
65 | 65 | it 'does a placeholder search with multiple attributesToRetrieve' do |
66 | 66 | response = @index.search('', attributesToRetrieve: ['title', 'genre']) |
67 | 67 | expect(response).to be_a(Hash) |
68 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 68 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
69 | 69 | expect(response['hits'].count).to eq(@documents.count) |
70 | 70 | expect(response['hits'].first).to have_key('title') |
71 | 71 | expect(response['hits'].first).not_to have_key('objectId') |
|
75 | 75 | it 'does a placeholder search with all attributesToRetrieve' do |
76 | 76 | response = @index.search('', attributesToRetrieve: ['*']) |
77 | 77 | expect(response).to be_a(Hash) |
78 | | - expect(response.keys).to contain_exactly(*$DEFAULT_SEARCH_RESPONSE_KEYS) |
| 78 | + expect(response.keys).to contain_exactly(*DEFAULT_SEARCH_RESPONSE_KEYS) |
79 | 79 | expect(response['hits'].count).to eq(@documents.count) |
80 | 80 | expect(response['hits'].first).to have_key('title') |
81 | 81 | expect(response['hits'].first).to have_key('objectId') |
|
0 commit comments