Chunking searches (#787)

* new attempt

* revised searching CTEs

* prepare fix

* fix tests

* fixes

* restructured project_item to use queries

* search changes! fmt clippy prepare

* small changes
This commit is contained in:
Wyatt Verchere
2023-12-08 22:14:17 -08:00
committed by GitHub
parent 945e5a2dc3
commit 235f4f10ef
28 changed files with 1784 additions and 1026 deletions

View File

@@ -115,8 +115,9 @@ pub async fn fetch_countries_downloads(
end_date: DateTime<Utc>,
client: Arc<clickhouse::Client>,
) -> Result<Vec<ReturnCountry>, ApiError> {
let query = client.query(
"
let query = client
.query(
"
SELECT
country,
project_id,
@@ -126,8 +127,8 @@ pub async fn fetch_countries_downloads(
GROUP BY
country,
project_id
"
)
",
)
.bind(start_date.timestamp())
.bind(end_date.timestamp())
.bind(projects.iter().map(|x| x.0).collect::<Vec<_>>());
@@ -141,8 +142,9 @@ pub async fn fetch_countries_views(
end_date: DateTime<Utc>,
client: Arc<clickhouse::Client>,
) -> Result<Vec<ReturnCountry>, ApiError> {
let query = client.query(
"
let query = client
.query(
"
SELECT
country,
project_id,
@@ -152,8 +154,8 @@ pub async fn fetch_countries_views(
GROUP BY
country,
project_id
"
)
",
)
.bind(start_date.timestamp())
.bind(end_date.timestamp())
.bind(projects.iter().map(|x| x.0).collect::<Vec<_>>());