File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ pub async fn build_sqlx_query(
326
326
SIden :: Str ( "chunk" ) ,
327
327
SIden :: Str ( "score" ) ,
328
328
] ) ;
329
- query. expr_as ( Expr :: cust ( "(rank).score" ) , Alias :: new ( "rank_score " ) ) ;
329
+ query. expr_as ( Expr :: cust ( "(rank).score" ) , Alias :: new ( "rerank_score " ) ) ;
330
330
331
331
// Build the actual select statement sub query
332
332
let mut sub_query_rank_call = Query :: select ( ) ;
@@ -364,6 +364,20 @@ pub async fn build_sqlx_query(
364
364
365
365
query
366
366
} else {
367
+ // Wrap our query to return a fourth null column
368
+ let mut vector_search_cte = CommonTableExpression :: from_select ( query) ;
369
+ vector_search_cte. table_name ( Alias :: new ( format ! ( "{prefix}_vector_search" ) ) ) ;
370
+ ctes. push ( vector_search_cte) ;
371
+
372
+ let mut query = Query :: select ( ) ;
373
+ query
374
+ . columns ( [
375
+ SIden :: Str ( "document" ) ,
376
+ SIden :: Str ( "chunk" ) ,
377
+ SIden :: Str ( "score" ) ,
378
+ ] )
379
+ . expr_as ( Expr :: cust ( "NULL" ) , Alias :: new ( "rerank_score" ) )
380
+ . from ( SIden :: String ( format ! ( "{prefix}_vector_search" ) ) ) ;
367
381
query
368
382
} ;
369
383
You can’t perform that action at this time.
0 commit comments