You've already forked AstralRinth
forked from didirus/AstralRinth
Allow many Meilisearch write addrs (#5102)
* Write to many Meilisearch write addrs * Keep client results ordered * Attach Read Meilisearch client to actix data * Load balanced meilisearch Compose profile * Nginx config (round_robin) * Fix nginx * Meilisearch + nginx in same net * Fix env vars example * Fix env example again * Fix env again * Use try_collect with FuturesOrdered * maybe fix remove_documents * Clippy
This commit is contained in:
committed by
GitHub
parent
7dba9cbe54
commit
3ffa78aa07
@@ -13,7 +13,9 @@ use crate::queue::moderation::AutomatedModerationQueue;
|
||||
use crate::queue::session::AuthQueue;
|
||||
use crate::routes::v3::projects::ProjectIds;
|
||||
use crate::routes::{ApiError, v2_reroute, v3};
|
||||
use crate::search::{SearchConfig, SearchError, search_for_project};
|
||||
use crate::search::{
|
||||
MeilisearchReadClient, SearchConfig, SearchError, search_for_project,
|
||||
};
|
||||
use actix_web::{HttpRequest, HttpResponse, delete, get, patch, post, web};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
@@ -54,6 +56,7 @@ pub fn config(cfg: &mut web::ServiceConfig) {
|
||||
pub async fn project_search(
|
||||
web::Query(info): web::Query<SearchRequest>,
|
||||
config: web::Data<SearchConfig>,
|
||||
read_client: web::Data<MeilisearchReadClient>,
|
||||
) -> Result<HttpResponse, SearchError> {
|
||||
// Search now uses loader_fields instead of explicit 'client_side' and 'server_side' fields
|
||||
// While the backend for this has changed, it doesnt affect much
|
||||
@@ -99,7 +102,7 @@ pub async fn project_search(
|
||||
..info
|
||||
};
|
||||
|
||||
let results = search_for_project(&info, &config).await?;
|
||||
let results = search_for_project(&info, &config, &read_client).await?;
|
||||
|
||||
let results = LegacySearchResults::from(results);
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ use crate::queue::moderation::AutomatedModerationQueue;
|
||||
use crate::queue::session::AuthQueue;
|
||||
use crate::routes::ApiError;
|
||||
use crate::search::indexing::remove_documents;
|
||||
use crate::search::{SearchConfig, SearchError, search_for_project};
|
||||
use crate::search::{
|
||||
MeilisearchReadClient, SearchConfig, SearchError, search_for_project,
|
||||
};
|
||||
use crate::util::img;
|
||||
use crate::util::img::{delete_old_images, upload_image_optimized};
|
||||
use crate::util::routes::read_limited_from_payload;
|
||||
@@ -1037,8 +1039,9 @@ pub async fn edit_project_categories(
|
||||
pub async fn project_search(
|
||||
web::Query(info): web::Query<SearchRequest>,
|
||||
config: web::Data<SearchConfig>,
|
||||
read_client: web::Data<MeilisearchReadClient>,
|
||||
) -> Result<HttpResponse, SearchError> {
|
||||
let results = search_for_project(&info, &config).await?;
|
||||
let results = search_for_project(&info, &config, &read_client).await?;
|
||||
|
||||
// TODO: add this back
|
||||
// let results = ReturnSearchResults {
|
||||
|
||||
Reference in New Issue
Block a user