@@ -75,7 +75,7 @@ async fn get_or_initialize_pool(database_url: &Option<String>) -> anyhow::Result
75
75
76
76
let pool = PgPoolOptions :: new ( )
77
77
. acquire_timeout ( std:: time:: Duration :: from_millis ( timeout) )
78
- . connect_lazy ( & url) ?;
78
+ . connect_lazy ( url) ?;
79
79
80
80
pools. insert ( url. to_string ( ) , pool. clone ( ) ) ;
81
81
Ok ( pool)
@@ -289,7 +289,7 @@ mod tests {
289
289
assert ! ( collection. database_data. is_none( ) ) ;
290
290
collection. add_pipeline ( & mut pipeline) . await ?;
291
291
assert ! ( collection. database_data. is_some( ) ) ;
292
- collection. remove_pipeline ( & mut pipeline) . await ?;
292
+ collection. remove_pipeline ( & pipeline) . await ?;
293
293
let pipelines = collection. get_pipelines ( ) . await ?;
294
294
assert ! ( pipelines. is_empty( ) ) ;
295
295
collection. archive ( ) . await ?;
@@ -306,7 +306,7 @@ mod tests {
306
306
collection. add_pipeline ( & mut pipeline2) . await ?;
307
307
let pipelines = collection. get_pipelines ( ) . await ?;
308
308
assert ! ( pipelines. len( ) == 2 ) ;
309
- collection. remove_pipeline ( & mut pipeline1) . await ?;
309
+ collection. remove_pipeline ( & pipeline1) . await ?;
310
310
let pipelines = collection. get_pipelines ( ) . await ?;
311
311
assert ! ( pipelines. len( ) == 1 ) ;
312
312
assert ! ( collection. get_pipeline( "test_r_p_carps_1" ) . await . is_err( ) ) ;
@@ -317,7 +317,7 @@ mod tests {
317
317
#[ tokio:: test]
318
318
async fn can_add_pipeline_and_upsert_documents ( ) -> anyhow:: Result < ( ) > {
319
319
internal_init_logger ( None , None ) . ok ( ) ;
320
- let collection_name = "test_r_c_capaud_47 " ;
320
+ let collection_name = "test_r_c_capaud_48 " ;
321
321
let pipeline_name = "test_r_p_capaud_6" ;
322
322
let mut pipeline = MultiFieldPipeline :: new (
323
323
pipeline_name,
@@ -333,7 +333,10 @@ mod tests {
333
333
"model" : "recursive_character"
334
334
} ,
335
335
"semantic_search" : {
336
- "model" : "intfloat/e5-small" ,
336
+ "model" : "hkunlp/instructor-base" ,
337
+ "parameters" : {
338
+ "instruction" : "Represent the Wikipedia document for retrieval"
339
+ }
337
340
} ,
338
341
"full_text_search" : {
339
342
"configuration" : "english"
@@ -490,7 +493,7 @@ mod tests {
490
493
sqlx:: query_as ( & query_builder ! ( "SELECT * FROM %s" , chunks_table) )
491
494
. fetch_all ( & pool)
492
495
. await ?;
493
- assert ! ( title_chunks. len ( ) == 0 ) ;
496
+ assert ! ( title_chunks. is_empty ( ) ) ;
494
497
collection. enable_pipeline ( & mut pipeline) . await ?;
495
498
let chunks_table = format ! ( "{}_{}.title_chunks" , collection_name, pipeline_name) ;
496
499
let title_chunks: Vec < models:: Chunk > =
@@ -707,7 +710,7 @@ mod tests {
707
710
}
708
711
} )
709
712
) ;
710
- collection. disable_pipeline ( & mut pipeline) . await ?;
713
+ collection. disable_pipeline ( & pipeline) . await ?;
711
714
collection
712
715
. upsert_documents ( documents[ 2 ..4 ] . to_owned ( ) , None )
713
716
. await ?;
@@ -813,7 +816,7 @@ mod tests {
813
816
#[ tokio:: test]
814
817
async fn can_search_with_local_embeddings ( ) -> anyhow:: Result < ( ) > {
815
818
internal_init_logger ( None , None ) . ok ( ) ;
816
- let collection_name = "test_r_c_cs_67 " ;
819
+ let collection_name = "test_r_c_cs_70 " ;
817
820
let mut collection = Collection :: new ( collection_name, None ) ;
818
821
let documents = generate_dummy_documents ( 10 ) ;
819
822
collection. upsert_documents ( documents. clone ( ) , None ) . await ?;
@@ -835,7 +838,10 @@ mod tests {
835
838
"model" : "recursive_character"
836
839
} ,
837
840
"semantic_search" : {
838
- "model" : "intfloat/e5-small"
841
+ "model" : "hkunlp/instructor-base" ,
842
+ "parameters" : {
843
+ "instruction" : "Represent the Wikipedia document for retrieval"
844
+ }
839
845
} ,
840
846
"full_text_search" : {
841
847
"configuration" : "english"
@@ -872,6 +878,9 @@ mod tests {
872
878
} ,
873
879
"body" : {
874
880
"query" : "This is the body test" ,
881
+ "parameters" : {
882
+ "instruction" : "Represent the Wikipedia question for retrieving supporting documents: " ,
883
+ } ,
875
884
"boost" : 1.01
876
885
} ,
877
886
"notes" : {
@@ -896,7 +905,7 @@ mod tests {
896
905
. into_iter ( )
897
906
. map ( |r| r[ "document" ] [ "id" ] . as_u64 ( ) . unwrap ( ) )
898
907
. collect ( ) ;
899
- assert_eq ! ( ids, vec![ 3 , 8 , 2 , 7 , 4 ] ) ;
908
+ assert_eq ! ( ids, vec![ 7 , 8 , 2 , 3 , 4 ] ) ;
900
909
collection. archive ( ) . await ?;
901
910
Ok ( ( ) )
902
911
}
0 commit comments