Add dependencies to search (#578)

* Add dependencies to search

* add attrs for faceting

* run prepare

* Add user data route from token

* update to 24hrs

* Fix report bugs
This commit is contained in:
Geometrically
2023-04-20 16:38:30 -07:00
committed by GitHub
parent 5c559af936
commit 59f24df294
65 changed files with 1518 additions and 2218 deletions

View File

@@ -99,6 +99,8 @@ pub struct UploadSearchProject {
pub modified_timestamp: i64,
pub open_source: bool,
pub color: Option<u32>,
/// format: {project_id}-{dep_type}
pub dependencies: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug)]
@@ -134,6 +136,8 @@ pub struct ResultSearchProject {
pub gallery: Vec<String>,
pub featured_gallery: Option<String>,
pub color: Option<u32>,
/// format: {project_id}-{dep_type}
pub dependencies: Vec<String>,
}
pub async fn search_for_project(
@@ -177,13 +181,12 @@ pub async fn search_for_project(
None
};
let filters: Cow<_> =
match (info.filters.as_deref(), info.version.as_deref()) {
(Some(f), Some(v)) => format!("({f}) AND ({v})").into(),
(Some(f), None) => f.into(),
(None, Some(v)) => v.into(),
(None, None) => "".into(),
};
let filters: Cow<_> = match (info.filters.as_deref(), info.version.as_deref()) {
(Some(f), Some(v)) => format!("({f}) AND ({v})").into(),
(Some(f), None) => f.into(),
(None, Some(v)) => v.into(),
(None, None) => "".into(),
};
if let Some(facets) = facets {
filter_string.push('(');