Skip to content

Commit b8d3de2

Browse files
Merge #550
550: Add code sample and tests for rankingScoreThreshold search parameter r=curquiza a=andre-m-dev # Pull Request ## Related issue Fixes #544 ## What does this PR do? rankingScoreThreshold implemented ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Co-authored-by: Andre <> Co-authored-by: Clémentine <[email protected]>
2 parents 5d4e3ed + e753f45 commit b8d3de2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.code-samples.meilisearch.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,10 @@ update_search_cutoff_1: |-
653653
client.index('movies').update_search_cutoff_ms(150)
654654
reset_search_cutoff_1: |-
655655
client.index('movies').reset_search_cutoff_ms
656+
search_parameter_reference_ranking_score_threshold_1: |-
657+
client.index('INDEX_NAME').search('badman', {
658+
rankingScoreThreshold: 0.2
659+
})
656660
search_parameter_reference_distinct_1: |-
657661
client.index('INDEX_NAME').search('QUERY TERMS', {
658662
distinct: 'ATTRIBUTE_A'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe 'MeiliSearch::Index - Search with rankingScoreThreshold' do
4+
include_context 'search books with genre'
5+
6+
it 'does a custom search with rankingScoreThreshold' do
7+
response = index.search('harry potter and the prisoner of azkaban', { rankingScoreThreshold: 0.9 })
8+
expect(response['hits'].count).to be(0)
9+
10+
response = index.search('harry potter and the', { rankingScoreThreshold: 0.3 })
11+
expect(response['hits'].count).to be(2)
12+
end
13+
end

0 commit comments

Comments
 (0)