You've already forked AstralRinth
forked from didirus/AstralRinth
Fixes incorrect loader fields (#849)
* loader_fields fix * tested, fixed * added direct file check for invalid file_parts * search fixes * removed printlns * Adds check for loaders * removes println
This commit is contained in:
@@ -128,6 +128,8 @@ pub async fn index_local(
|
||||
.map(|vf| (vf.field_name.clone(), vf.value.serialize_internal()))
|
||||
.collect();
|
||||
let mut loader_fields = models::projects::from_duplicate_version_fields(version_fields);
|
||||
let project_loader_fields =
|
||||
models::projects::from_duplicate_version_fields(m.aggregate_version_fields.clone());
|
||||
let license = match m.inner.license.split(' ').next() {
|
||||
Some(license) => license.to_string(),
|
||||
None => m.inner.license.clone(),
|
||||
@@ -240,6 +242,7 @@ pub async fn index_local(
|
||||
links: m.urls.clone(),
|
||||
gallery_items: m.gallery_items.clone(),
|
||||
loaders,
|
||||
project_loader_fields,
|
||||
};
|
||||
|
||||
uploads.push(usp);
|
||||
|
||||
@@ -400,6 +400,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[
|
||||
"links",
|
||||
"gallery_items",
|
||||
"loaders", // search uses loaders as categories- this is purely for the Project model.
|
||||
"project_loader_fields",
|
||||
];
|
||||
|
||||
const DEFAULT_SEARCHABLE_ATTRIBUTES: &[&str] = &["name", "summary", "author", "slug"];
|
||||
|
||||
@@ -133,6 +133,7 @@ pub struct UploadSearchProject {
|
||||
pub gallery_items: Vec<GalleryItem>, // Gallery *only* urls are stored in gallery, but the gallery items are stored here- required for the Project model.
|
||||
pub games: Vec<String>, // Todo: in future, could be a searchable field.
|
||||
pub organization_id: Option<String>, // Todo: in future, could be a searchable field.
|
||||
pub project_loader_fields: HashMap<String, Vec<serde_json::Value>>, // Aggregation of loader_fields from all versions of the project, allowing for reconstruction of the Project model.
|
||||
|
||||
#[serde(flatten)]
|
||||
pub loader_fields: HashMap<String, Vec<serde_json::Value>>,
|
||||
@@ -184,6 +185,7 @@ pub struct ResultSearchProject {
|
||||
pub gallery_items: Vec<GalleryItem>, // Gallery *only* urls are stored in gallery, but the gallery items are stored here- required for the Project model.
|
||||
pub games: Vec<String>, // Todo: in future, could be a searchable field.
|
||||
pub organization_id: Option<String>, // Todo: in future, could be a searchable field.
|
||||
pub project_loader_fields: HashMap<String, Vec<serde_json::Value>>, // Aggregation of loader_fields from all versions of the project, allowing for reconstruction of the Project model.
|
||||
|
||||
#[serde(flatten)]
|
||||
pub loader_fields: HashMap<String, Vec<serde_json::Value>>,
|
||||
|
||||
Reference in New Issue
Block a user