moving towards upgraded crates

This commit is contained in:
Priec
2026-06-10 17:22:42 +02:00
parent 40ad0db13f
commit 5481d1cb13
19 changed files with 1661 additions and 1218 deletions

View File

@@ -6,10 +6,10 @@ use std::sync::{Arc, Mutex};
use common::proto::komp_ac::search::searcher_server::Searcher;
pub use common::proto::komp_ac::search::searcher_server::SearcherServer;
use common::proto::komp_ac::search::{search_response::Hit, SearchRequest, SearchResponse};
use common::search::{register_tokenizers, search_index_path, SchemaFields};
use query_builder::{build_master_query, ConstraintMode, SearchConstraint};
use sqlx::{PgPool, Row};
use common::proto::komp_ac::search::{SearchRequest, SearchResponse, search_response::Hit};
use common::search::{SchemaFields, register_tokenizers, search_index_path};
use query_builder::{ConstraintMode, SearchConstraint, build_master_query};
use sqlx::{AssertSqlSafe, PgPool, Row};
use tantivy::collector::TopDocs;
use tantivy::schema::Value;
use tantivy::{Index, IndexReader, ReloadPolicy, TantivyDocument};
@@ -112,7 +112,6 @@ impl SearcherService {
Ok(Response::new(SearchResponse { hits }))
}
}
struct ProfileIndex {
@@ -322,7 +321,7 @@ async fn fetch_latest_rows(
qualify_profile_table(profile_name, table_name)
);
let rows = sqlx::query(&sql)
let rows = sqlx::query(AssertSqlSafe(sql))
.bind(limit as i64)
.fetch_all(pool)
.await
@@ -362,7 +361,7 @@ async fn run_search(
let searcher = profile.reader.searcher();
let top_docs = searcher
.search(&*master_query, &TopDocs::with_limit(limit))
.search(&*master_query, &TopDocs::with_limit(limit).order_by_score())
.map_err(|e| Status::internal(format!("Search failed: {}", e)))?;
if top_docs.is_empty() {
@@ -409,7 +408,7 @@ async fn run_search(
qualify_profile_table(profile_name, &table_name)
);
let rows = sqlx::query(&sql)
let rows = sqlx::query(AssertSqlSafe(sql))
.bind(&pg_ids)
.fetch_all(pool)
.await