picker in forms page have more results easily now

This commit is contained in:
Priec
2026-07-09 19:02:28 +02:00
parent 2f7d7dcdbc
commit ace4b32d0a
6 changed files with 13 additions and 4 deletions

2
client

Submodule client updated: 4d45b25c75...8fc2b22baa

View File

@@ -24,6 +24,7 @@ message SearchRequest {
string free_query = 3;
repeated ColumnConstraint must = 4;
optional uint32 limit = 5;
optional uint32 offset = 6;
}
message SearchResponse {
message Hit {

Binary file not shown.

View File

@@ -20,6 +20,8 @@ pub struct SearchRequest {
pub must: ::prost::alloc::vec::Vec<ColumnConstraint>,
#[prost(uint32, optional, tag = "5")]
pub limit: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "6")]
pub offset: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResponse {

View File

@@ -19,7 +19,7 @@ use tonic::{Request, Response, Status};
use tracing::info;
const INDEX_ROOT: &str = "./tantivy_indexes";
const DEFAULT_RESULT_LIMIT: usize = 25;
const DEFAULT_RESULT_LIMIT: usize = 60;
const HARD_RESULT_LIMIT: usize = 200;
const DEFAULT_LIST_LIMIT: usize = 5;
@@ -71,6 +71,7 @@ impl SearcherService {
&normalized.profile_name,
table_name,
normalized.limit.unwrap_or(DEFAULT_LIST_LIMIT),
normalized.offset,
)
.await?;
return Ok(Response::new(SearchResponse { hits }));
@@ -163,6 +164,7 @@ struct NormalizedSearchRequest {
free_query: String,
must: Vec<NormalizedColumnConstraint>,
limit: Option<usize>,
offset: usize,
}
#[derive(Debug)]
@@ -310,6 +312,7 @@ fn normalize_request(req: SearchRequest) -> Result<NormalizedSearchRequest, Stat
let limit = req
.limit
.map(|value| (value as usize).min(HARD_RESULT_LIMIT));
let offset = req.offset.unwrap_or_default() as usize;
Ok(NormalizedSearchRequest {
profile_name: profile_name.to_string(),
@@ -317,6 +320,7 @@ fn normalize_request(req: SearchRequest) -> Result<NormalizedSearchRequest, Stat
free_query,
must,
limit,
offset,
})
}
@@ -477,15 +481,17 @@ async fn fetch_latest_rows(
profile_name: &str,
table_name: &str,
limit: usize,
offset: usize,
) -> Result<Vec<Hit>, Status> {
let physical_to_display = table_physical_to_display_map(pool, profile_name, table_name).await?;
let sql = format!(
"SELECT id, to_jsonb(t) AS data FROM {} t WHERE deleted = FALSE ORDER BY id DESC LIMIT $1",
"SELECT id, to_jsonb(t) AS data FROM {} t WHERE deleted = FALSE ORDER BY id DESC LIMIT $1 OFFSET $2",
qualify_profile_table(profile_name, table_name)
);
let rows = sqlx::query(AssertSqlSafe(sql))
.bind(limit as i64)
.bind(offset as i64)
.fetch_all(pool)
.await
.map_err(|e| Status::internal(format!("DB query for default results failed: {}", e)))?;

2
server

Submodule server updated: e2909537f5...da3401c26b