File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -867,6 +867,15 @@ search_parameter_guide_matching_strategy_2: |-
867
867
.execute()
868
868
.await
869
869
.unwrap();
870
+ search_parameter_guide_matching_strategy_3 : |-
871
+ let results: SearchResults<Movie> = client
872
+ .index("movies")
873
+ .search()
874
+ .with_query("white shirt")
875
+ .with_matching_strategy(MatchingStrategies::FREQUENCY)
876
+ .execute()
877
+ .await
878
+ .unwrap();
870
879
search_parameter_guide_hitsperpage_1 : |-
871
880
client.index("movies").search().with_hits_per_page(15).execute().await?;
872
881
search_parameter_guide_page_1 : |-
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ pub enum MatchingStrategies {
32
32
ALL ,
33
33
#[ serde( rename = "last" ) ]
34
34
LAST ,
35
+ #[ serde( rename = "frequency" ) ]
36
+ FREQUENCY ,
35
37
}
36
38
37
39
/// A single result.
@@ -1151,7 +1153,7 @@ mod tests {
1151
1153
}
1152
1154
1153
1155
#[ meilisearch_test]
1154
- async fn test_matching_strategy_left ( client : Client , index : Index ) -> Result < ( ) , Error > {
1156
+ async fn test_matching_strategy_last ( client : Client , index : Index ) -> Result < ( ) , Error > {
1155
1157
setup_test_index ( & client, & index) . await ?;
1156
1158
1157
1159
let results = SearchQuery :: new ( & index)
@@ -1165,6 +1167,21 @@ mod tests {
1165
1167
Ok ( ( ) )
1166
1168
}
1167
1169
1170
+ #[ meilisearch_test]
1171
+ async fn test_matching_strategy_frequency ( client : Client , index : Index ) -> Result < ( ) , Error > {
1172
+ setup_test_index ( & client, & index) . await ?;
1173
+
1174
+ let results = SearchQuery :: new ( & index)
1175
+ . with_query ( "Harry Styles" )
1176
+ . with_matching_strategy ( MatchingStrategies :: FREQUENCY )
1177
+ . execute :: < Document > ( )
1178
+ . await
1179
+ . unwrap ( ) ;
1180
+
1181
+ assert_eq ! ( results. hits. len( ) , 7 ) ;
1182
+ Ok ( ( ) )
1183
+ }
1184
+
1168
1185
#[ meilisearch_test]
1169
1186
async fn test_generate_tenant_token_from_client (
1170
1187
client : Client ,
You can’t perform that action at this time.
0 commit comments