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 @@ -903,6 +903,15 @@ search_parameter_guide_matching_strategy_2: |-
903
903
.execute()
904
904
.await
905
905
.unwrap();
906
+ search_parameter_guide_matching_strategy_3 : |-
907
+ let results: SearchResults<Movie> = client
908
+ .index("movies")
909
+ .search()
910
+ .with_query("white shirt")
911
+ .with_matching_strategy(MatchingStrategies::FREQUENCY)
912
+ .execute()
913
+ .await
914
+ .unwrap();
906
915
search_parameter_guide_hitsperpage_1 : |-
907
916
client.index("movies").search().with_hits_per_page(15).execute().await?;
908
917
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