|
15 | 15 | let(:default_displayed_attributes) { ['*'] } |
16 | 16 | let(:default_pagination) { { maxTotalHits: 1000 } } |
17 | 17 | let(:default_proximity_precision) { 'byWord' } |
| 18 | + let(:default_search_cutoff_ms) { nil } |
18 | 19 | let(:settings_keys) do |
19 | 20 | [ |
20 | 21 | 'rankingRules', |
|
31 | 32 | 'dictionary', |
32 | 33 | 'nonSeparatorTokens', |
33 | 34 | 'separatorTokens', |
34 | | - 'proximityPrecision' |
| 35 | + 'proximityPrecision', |
| 36 | + 'searchCutoffMs' |
35 | 37 | ] |
36 | 38 | end |
37 | 39 | let(:uid) { random_uid } |
|
55 | 57 | 'dictionary' => [], |
56 | 58 | 'separatorTokens' => [], |
57 | 59 | 'nonSeparatorTokens' => [], |
58 | | - 'proximityPrecision' => default_proximity_precision |
| 60 | + 'proximityPrecision' => default_proximity_precision, |
| 61 | + 'searchCutoffMs' => default_search_cutoff_ms |
59 | 62 | ) |
60 | 63 | end |
61 | 64 |
|
|
97 | 100 | distinct_attribute: 'title', |
98 | 101 | stop_words: ['the', 'a'], |
99 | 102 | synonyms: { wow: ['world of warcraft'] }, |
100 | | - proximity_precision: 'byAttribute' |
| 103 | + proximity_precision: 'byAttribute', |
| 104 | + search_cutoff_ms: 333 |
101 | 105 | ).await |
102 | 106 |
|
103 | 107 | task = index.reset_settings |
|
109 | 113 | 'distinctAttribute' => nil, |
110 | 114 | 'stopWords' => [], |
111 | 115 | 'synonyms' => {}, |
112 | | - 'proximityPrecision' => default_proximity_precision |
| 116 | + 'proximityPrecision' => default_proximity_precision, |
| 117 | + 'searchCutoffMs' => default_search_cutoff_ms |
113 | 118 | ) |
114 | 119 | end |
115 | 120 | end |
|
740 | 745 | end |
741 | 746 | end |
742 | 747 | end |
| 748 | + |
| 749 | + context 'On search cutoff' do |
| 750 | + let(:index) { client.index(uid) } |
| 751 | + let(:default_search_cutoff_ms) { nil } |
| 752 | + |
| 753 | + before { client.create_index(uid).await } |
| 754 | + |
| 755 | + it '#search_cutoff_ms gets default value' do |
| 756 | + expect(index.search_cutoff_ms).to eq(default_search_cutoff_ms) |
| 757 | + end |
| 758 | + |
| 759 | + it '#update_search_cutoff_ms updates default value' do |
| 760 | + update_task = index.update_search_cutoff_ms(800) |
| 761 | + client.wait_for_task(update_task['taskUid']) |
| 762 | + |
| 763 | + expect(index.search_cutoff_ms).to eq(800) |
| 764 | + end |
| 765 | + |
| 766 | + it '#reset_search_cutoff_ms resets search cutoff ms' do |
| 767 | + update_task = index.update_search_cutoff_ms(300) |
| 768 | + client.wait_for_task(update_task['taskUid']) |
| 769 | + |
| 770 | + expect(index.search_cutoff_ms).to eq(300) |
| 771 | + |
| 772 | + reset_task = index.reset_search_cutoff_ms |
| 773 | + client.wait_for_task(reset_task['taskUid']) |
| 774 | + |
| 775 | + expect(index.search_cutoff_ms).to eq(default_search_cutoff_ms) |
| 776 | + end |
| 777 | + end |
743 | 778 | end |
0 commit comments