File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
crates/database/src/tests Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -603,15 +603,26 @@ async fn test_search_score(rt: TestRuntime) -> anyhow::Result<()> {
603603 . await ?;
604604 assert_eq ! ( results. len( ) , 1 ) ;
605605
606- // Constant taken from https://github.com/quickwit-oss/tantivy/blob/main/src/query/term_query/mod.rs#L20
607- assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 1. ) ;
606+ // Search scoring will be different with multisegment search query.
607+ if std:: env:: var ( "USE_MULTI_SEGMENT_SEARCH_QUERY" ) . is_ok ( ) {
608+ assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 0.2876 ) ;
609+ } else {
610+ // Constant taken from https://github.com/quickwit-oss/tantivy/blob/main/src/query/term_query/mod.rs#L20
611+ assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 1. ) ;
612+ }
608613 }
609614 {
610615 let results = scenario
611616 . query_with_scores ( & query, None , SearchVersion :: V2 )
612617 . await ?;
613618 assert_eq ! ( results. len( ) , 1 ) ;
614- assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 1. ) ;
619+ // Search scoring will be different with multisegment search query.
620+ if std:: env:: var ( "USE_MULTI_SEGMENT_SEARCH_QUERY" ) . is_ok ( ) {
621+ assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 0.2876 ) ;
622+ } else {
623+ // Constant taken from https://github.com/quickwit-oss/tantivy/blob/main/src/query/term_query/mod.rs#L20
624+ assert_approx_equal ( results. first ( ) . unwrap ( ) . 1 , 1. ) ;
625+ }
615626 }
616627 anyhow:: Ok ( ( ) )
617628}
You can’t perform that action at this time.
0 commit comments