You've already forked AstralRinth
forked from didirus/AstralRinth
Update search queries (#854)
* Update search queries * Bump accepted payload limit * fixes * push test changes * fmt clippy prepare --------- Co-authored-by: Wyatt Verchere <wverchere@gmail.com>
This commit is contained in:
@@ -893,13 +893,14 @@ pub async fn edit_project_categories(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ReturnSearchResults {
|
||||
pub hits: Vec<Project>,
|
||||
pub page: usize,
|
||||
pub hits_per_page: usize,
|
||||
pub total_hits: usize,
|
||||
}
|
||||
// TODO: Re-add this if we want to match v3 Projects structure to v3 Search Result structure, otherwise, delete
|
||||
// #[derive(Serialize, Deserialize)]
|
||||
// pub struct ReturnSearchResults {
|
||||
// pub hits: Vec<Project>,
|
||||
// pub page: usize,
|
||||
// pub hits_per_page: usize,
|
||||
// pub total_hits: usize,
|
||||
// }
|
||||
|
||||
pub async fn project_search(
|
||||
web::Query(info): web::Query<SearchRequest>,
|
||||
@@ -907,16 +908,17 @@ pub async fn project_search(
|
||||
) -> Result<HttpResponse, SearchError> {
|
||||
let results = search_for_project(&info, &config).await?;
|
||||
|
||||
let results = ReturnSearchResults {
|
||||
hits: results
|
||||
.hits
|
||||
.into_iter()
|
||||
.filter_map(Project::from_search)
|
||||
.collect::<Vec<_>>(),
|
||||
page: results.page,
|
||||
hits_per_page: results.hits_per_page,
|
||||
total_hits: results.total_hits,
|
||||
};
|
||||
// TODO: add this back
|
||||
// let results = ReturnSearchResults {
|
||||
// hits: results
|
||||
// .hits
|
||||
// .into_iter()
|
||||
// .filter_map(Project::from_search)
|
||||
// .collect::<Vec<_>>(),
|
||||
// page: results.page,
|
||||
// hits_per_page: results.hits_per_page,
|
||||
// total_hits: results.total_hits,
|
||||
// };
|
||||
|
||||
Ok(HttpResponse::Ok().json(results))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user