From 62e1268e0e85a06192e749b0a2a7406a73d1acc1 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 16 Feb 2026 19:16:03 -0500 Subject: [PATCH 1/6] Add support for dependencies in search --- .../src/search/indexing/local_import.rs | 17 +++++++++++++++++ apps/labrinth/src/search/indexing/mod.rs | 2 ++ apps/labrinth/src/search/mod.rs | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/apps/labrinth/src/search/indexing/local_import.rs b/apps/labrinth/src/search/indexing/local_import.rs index 6c2549fef1..958c0eb293 100644 --- a/apps/labrinth/src/search/indexing/local_import.rs +++ b/apps/labrinth/src/search/indexing/local_import.rs @@ -414,6 +414,7 @@ pub async fn index_local( featured_gallery: featured_gallery.clone(), open_source, color: project.color.map(|x| x as u32), + dependencies: version.dependencies, loader_fields, project_loader_fields: project_loader_fields.clone(), // 'loaders' is aggregate of all versions' loaders @@ -433,6 +434,7 @@ struct PartialVersion { loaders: Vec, project_types: Vec, version_fields: Vec, + dependencies: Vec, } async fn index_versions( @@ -549,6 +551,20 @@ async fn index_versions( .map(|(_, version_fields)| version_fields) .unwrap_or_default(); + let dependencies: Vec = sqlx::query!( + " + SELECT mod_dependency_id as \"mod_dependency_id: DBProjectId\" + FROM dependencies + WHERE dependent_id = $1", + version_id.0 + ) + .fetch_all(pool) + .await? + .iter() + .flat_map(|r| r.mod_dependency_id) + .map(|id| crate::models::ids::ProjectId::from(id).to_string()) + .collect(); + res_versions .entry(*project_id) .or_default() @@ -557,6 +573,7 @@ async fn index_versions( loaders: version_loader_data.loaders, project_types: version_loader_data.project_types, version_fields, + dependencies, }); } } diff --git a/apps/labrinth/src/search/indexing/mod.rs b/apps/labrinth/src/search/indexing/mod.rs index 2da327ce14..557f2d1fcd 100644 --- a/apps/labrinth/src/search/indexing/mod.rs +++ b/apps/labrinth/src/search/indexing/mod.rs @@ -565,6 +565,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[ "gallery", "featured_gallery", "color", + "dependencies", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. "environment", @@ -609,6 +610,7 @@ const DEFAULT_ATTRIBUTES_FOR_FACETING: &[&str] = &[ "project_id", "open_source", "color", + "dependencies", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. "environment", diff --git a/apps/labrinth/src/search/mod.rs b/apps/labrinth/src/search/mod.rs index e64aa07071..7e0f5d3ff9 100644 --- a/apps/labrinth/src/search/mod.rs +++ b/apps/labrinth/src/search/mod.rs @@ -216,6 +216,8 @@ pub struct UploadSearchProject { pub open_source: bool, pub color: Option, + pub dependencies: Vec, + // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. pub project_loader_fields: HashMap>, // Aggregation of loader_fields from all versions of the project, allowing for reconstruction of the Project model. @@ -255,6 +257,8 @@ pub struct ResultSearchProject { pub featured_gallery: Option, pub color: Option, + pub dependencies: Vec, + // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. pub project_loader_fields: HashMap>, // Aggregation of loader_fields from all versions of the project, allowing for reconstruction of the Project model. From c14016bc850156efdc7175d947aeaf9c55be87b1 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 16 Feb 2026 20:28:15 -0500 Subject: [PATCH 2/6] Add dependency slug to project search index --- .../src/search/indexing/local_import.rs | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/labrinth/src/search/indexing/local_import.rs b/apps/labrinth/src/search/indexing/local_import.rs index 958c0eb293..f2712b71d3 100644 --- a/apps/labrinth/src/search/indexing/local_import.rs +++ b/apps/labrinth/src/search/indexing/local_import.rs @@ -553,17 +553,28 @@ async fn index_versions( let dependencies: Vec = sqlx::query!( " - SELECT mod_dependency_id as \"mod_dependency_id: DBProjectId\" - FROM dependencies + SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", m.slug as \"slug\" FROM dependencies d + INNER JOIN mods m ON m.id = d.mod_dependency_id WHERE dependent_id = $1", version_id.0 ) - .fetch_all(pool) - .await? - .iter() - .flat_map(|r| r.mod_dependency_id) - .map(|id| crate::models::ids::ProjectId::from(id).to_string()) - .collect(); + .fetch_all(pool) + .await? + .iter() + .flat_map(|r| { + let mut v = Vec::new(); + + if let Some(id) = r.mod_dependency_id { + v.push(crate::models::ids::ProjectId::from(id).to_string()) + } + + if let Some(slug) = &r.slug { + v.push(slug.to_string()) + } + + v + }) + .collect(); res_versions .entry(*project_id) From e604d7e884498bfcd01834a836e4a24f5aabf9db Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 16 Feb 2026 22:02:27 -0500 Subject: [PATCH 3/6] Run sqlx prepare --- ...f4eeff66ab4165a9f4980032e114db4dc1286.json | 26 ----------------- ...e789420301ac35f23276229f39a8de8e8a558.json | 28 +++++++++++++++++++ ...d2402f52fea71e27b08e7926fcc2a9e62c0f3.json | 20 ------------- ...afedb074492b4ec7f2457c14113f5fd13aa02.json | 18 ------------ ...e5c93783c7641b019fdb698a1ec0be1393606.json | 17 ----------- 5 files changed, 28 insertions(+), 81 deletions(-) delete mode 100644 apps/labrinth/.sqlx/query-1adbd24d815107e13bc1440c7a8f4eeff66ab4165a9f4980032e114db4dc1286.json create mode 100644 apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json delete mode 100644 apps/labrinth/.sqlx/query-b92b5bb7d179c4fcdbc45600ccfd2402f52fea71e27b08e7926fcc2a9e62c0f3.json delete mode 100644 apps/labrinth/.sqlx/query-cd5ccd618fb3cc41646a6de86f9afedb074492b4ec7f2457c14113f5fd13aa02.json delete mode 100644 apps/labrinth/.sqlx/query-cec4240c7c848988b3dfd13e3f8e5c93783c7641b019fdb698a1ec0be1393606.json diff --git a/apps/labrinth/.sqlx/query-1adbd24d815107e13bc1440c7a8f4eeff66ab4165a9f4980032e114db4dc1286.json b/apps/labrinth/.sqlx/query-1adbd24d815107e13bc1440c7a8f4eeff66ab4165a9f4980032e114db4dc1286.json deleted file mode 100644 index 921f7f92d9..0000000000 --- a/apps/labrinth/.sqlx/query-1adbd24d815107e13bc1440c7a8f4eeff66ab4165a9f4980032e114db4dc1286.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n status AS \"status: PayoutStatus\"\n FROM payouts\n ORDER BY id\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "status: PayoutStatus", - "type_info": "Varchar" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false - ] - }, - "hash": "1adbd24d815107e13bc1440c7a8f4eeff66ab4165a9f4980032e114db4dc1286" -} diff --git a/apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json b/apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json new file mode 100644 index 0000000000..bd0481fc9b --- /dev/null +++ b/apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", m.slug as \"slug\" FROM dependencies d\n INNER JOIN mods m ON m.id = d.mod_dependency_id\n WHERE dependent_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "mod_dependency_id: DBProjectId", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "slug", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + true, + true + ] + }, + "hash": "678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558" +} diff --git a/apps/labrinth/.sqlx/query-b92b5bb7d179c4fcdbc45600ccfd2402f52fea71e27b08e7926fcc2a9e62c0f3.json b/apps/labrinth/.sqlx/query-b92b5bb7d179c4fcdbc45600ccfd2402f52fea71e27b08e7926fcc2a9e62c0f3.json deleted file mode 100644 index 89bd8147dc..0000000000 --- a/apps/labrinth/.sqlx/query-b92b5bb7d179c4fcdbc45600ccfd2402f52fea71e27b08e7926fcc2a9e62c0f3.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT status AS \"status: PayoutStatus\" FROM payouts WHERE id = 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "status: PayoutStatus", - "type_info": "Varchar" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false - ] - }, - "hash": "b92b5bb7d179c4fcdbc45600ccfd2402f52fea71e27b08e7926fcc2a9e62c0f3" -} diff --git a/apps/labrinth/.sqlx/query-cd5ccd618fb3cc41646a6de86f9afedb074492b4ec7f2457c14113f5fd13aa02.json b/apps/labrinth/.sqlx/query-cd5ccd618fb3cc41646a6de86f9afedb074492b4ec7f2457c14113f5fd13aa02.json deleted file mode 100644 index 469c30168a..0000000000 --- a/apps/labrinth/.sqlx/query-cd5ccd618fb3cc41646a6de86f9afedb074492b4ec7f2457c14113f5fd13aa02.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO payouts (id, method, platform_id, status, user_id, amount, created)\n VALUES ($1, $2, $3, $4, $5, 10.0, NOW())\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Varchar", - "Int8" - ] - }, - "nullable": [] - }, - "hash": "cd5ccd618fb3cc41646a6de86f9afedb074492b4ec7f2457c14113f5fd13aa02" -} diff --git a/apps/labrinth/.sqlx/query-cec4240c7c848988b3dfd13e3f8e5c93783c7641b019fdb698a1ec0be1393606.json b/apps/labrinth/.sqlx/query-cec4240c7c848988b3dfd13e3f8e5c93783c7641b019fdb698a1ec0be1393606.json deleted file mode 100644 index 52e020ebf2..0000000000 --- a/apps/labrinth/.sqlx/query-cec4240c7c848988b3dfd13e3f8e5c93783c7641b019fdb698a1ec0be1393606.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO payouts (id, method, platform_id, status, user_id, amount, created)\n VALUES ($1, $2, NULL, $3, $4, 10.00, NOW())\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Varchar", - "Int8" - ] - }, - "nullable": [] - }, - "hash": "cec4240c7c848988b3dfd13e3f8e5c93783c7641b019fdb698a1ec0be1393606" -} From 4d42a2eb41347edbbed2e2d95c6bde8bc07e16c7 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 19 Feb 2026 18:30:17 -0500 Subject: [PATCH 4/6] Switch dependencies to use a map --- .../src/search/indexing/local_import.rs | 31 +++++++++---------- apps/labrinth/src/search/mod.rs | 4 +-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/apps/labrinth/src/search/indexing/local_import.rs b/apps/labrinth/src/search/indexing/local_import.rs index f2712b71d3..dc64fbeafa 100644 --- a/apps/labrinth/src/search/indexing/local_import.rs +++ b/apps/labrinth/src/search/indexing/local_import.rs @@ -434,7 +434,7 @@ struct PartialVersion { loaders: Vec, project_types: Vec, version_fields: Vec, - dependencies: Vec, + dependencies: HashMap>, } async fn index_versions( @@ -551,30 +551,29 @@ async fn index_versions( .map(|(_, version_fields)| version_fields) .unwrap_or_default(); - let dependencies: Vec = sqlx::query!( + let mut dependencies: HashMap> = HashMap::new(); + + let records = sqlx::query!( " - SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", m.slug as \"slug\" FROM dependencies d + SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", d.dependency_type, m.slug as \"slug\" FROM dependencies d INNER JOIN mods m ON m.id = d.mod_dependency_id WHERE dependent_id = $1", version_id.0 ) .fetch_all(pool) - .await? - .iter() - .flat_map(|r| { - let mut v = Vec::new(); + .await?; - if let Some(id) = r.mod_dependency_id { - v.push(crate::models::ids::ProjectId::from(id).to_string()) - } + for r in records { + let v = dependencies.entry(r.dependency_type.clone()).or_default(); - if let Some(slug) = &r.slug { - v.push(slug.to_string()) - } + if let Some(id) = r.mod_dependency_id { + v.push(crate::models::ids::ProjectId::from(id).to_string()) + } - v - }) - .collect(); + if let Some(slug) = &r.slug { + v.push(slug.to_string()) + } + } res_versions .entry(*project_id) diff --git a/apps/labrinth/src/search/mod.rs b/apps/labrinth/src/search/mod.rs index 7e0f5d3ff9..bf923ea76e 100644 --- a/apps/labrinth/src/search/mod.rs +++ b/apps/labrinth/src/search/mod.rs @@ -216,7 +216,7 @@ pub struct UploadSearchProject { pub open_source: bool, pub color: Option, - pub dependencies: Vec, + pub dependencies: HashMap>, // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. @@ -257,7 +257,7 @@ pub struct ResultSearchProject { pub featured_gallery: Option, pub color: Option, - pub dependencies: Vec, + pub dependencies: HashMap>, // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. From 9c7514344500ecd38d3ccffeb95227ec529fe14c Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 19 Feb 2026 19:01:19 -0500 Subject: [PATCH 5/6] Use separate vecs --- .../src/search/indexing/local_import.rs | 23 +++++++++++++++---- apps/labrinth/src/search/indexing/mod.rs | 8 +++++-- apps/labrinth/src/search/mod.rs | 8 +++++-- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/apps/labrinth/src/search/indexing/local_import.rs b/apps/labrinth/src/search/indexing/local_import.rs index dc64fbeafa..2bff516cd3 100644 --- a/apps/labrinth/src/search/indexing/local_import.rs +++ b/apps/labrinth/src/search/indexing/local_import.rs @@ -414,7 +414,9 @@ pub async fn index_local( featured_gallery: featured_gallery.clone(), open_source, color: project.color.map(|x| x as u32), - dependencies: version.dependencies, + required_dependencies: version.required_dependencies, + optional_dependencies: version.optional_dependencies, + incompatibilities: version.incompatibilities, loader_fields, project_loader_fields: project_loader_fields.clone(), // 'loaders' is aggregate of all versions' loaders @@ -434,7 +436,9 @@ struct PartialVersion { loaders: Vec, project_types: Vec, version_fields: Vec, - dependencies: HashMap>, + pub required_dependencies: Vec, + pub optional_dependencies: Vec, + pub incompatibilities: Vec, } async fn index_versions( @@ -551,7 +555,9 @@ async fn index_versions( .map(|(_, version_fields)| version_fields) .unwrap_or_default(); - let mut dependencies: HashMap> = HashMap::new(); + let mut required_dependencies: Vec = Vec::new(); + let mut optional_dependencies: Vec = Vec::new(); + let mut incompatibilities: Vec = Vec::new(); let records = sqlx::query!( " @@ -564,7 +570,12 @@ async fn index_versions( .await?; for r in records { - let v = dependencies.entry(r.dependency_type.clone()).or_default(); + let v = match r.dependency_type.as_str() { + "required" => &mut required_dependencies, + "optional" => &mut optional_dependencies, + "incompatible" => &mut incompatibilities, + _ => continue, + }; if let Some(id) = r.mod_dependency_id { v.push(crate::models::ids::ProjectId::from(id).to_string()) @@ -583,7 +594,9 @@ async fn index_versions( loaders: version_loader_data.loaders, project_types: version_loader_data.project_types, version_fields, - dependencies, + required_dependencies, + optional_dependencies, + incompatibilities, }); } } diff --git a/apps/labrinth/src/search/indexing/mod.rs b/apps/labrinth/src/search/indexing/mod.rs index 557f2d1fcd..ddf4cd16a5 100644 --- a/apps/labrinth/src/search/indexing/mod.rs +++ b/apps/labrinth/src/search/indexing/mod.rs @@ -565,7 +565,9 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[ "gallery", "featured_gallery", "color", - "dependencies", + "required_dependencies", + "optional_dependencies", + "incompatibilities", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. "environment", @@ -610,7 +612,9 @@ const DEFAULT_ATTRIBUTES_FOR_FACETING: &[&str] = &[ "project_id", "open_source", "color", - "dependencies", + "required_dependencies", + "optional_dependencies", + "incompatibilities", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. "environment", diff --git a/apps/labrinth/src/search/mod.rs b/apps/labrinth/src/search/mod.rs index bf923ea76e..2f2f639c08 100644 --- a/apps/labrinth/src/search/mod.rs +++ b/apps/labrinth/src/search/mod.rs @@ -216,7 +216,9 @@ pub struct UploadSearchProject { pub open_source: bool, pub color: Option, - pub dependencies: HashMap>, + pub required_dependencies: Vec, + pub optional_dependencies: Vec, + pub incompatibilities: Vec, // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. @@ -257,7 +259,9 @@ pub struct ResultSearchProject { pub featured_gallery: Option, pub color: Option, - pub dependencies: HashMap>, + pub required_dependencies: Vec, + pub optional_dependencies: Vec, + pub incompatibilities: Vec, // Hidden fields to get the Project model out of the search results. pub loaders: Vec, // Search uses loaders as categories- this is purely for the Project model. From 2400c107dc9b9c7fe6982bed2989b1f39a8b0bab Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 19 Feb 2026 21:04:44 -0500 Subject: [PATCH 6/6] Add support for embedded dependencies --- ...92f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json} | 10 ++++++++-- apps/labrinth/src/search/indexing/local_import.rs | 11 ++++++++--- apps/labrinth/src/search/indexing/mod.rs | 2 ++ apps/labrinth/src/search/mod.rs | 2 ++ 4 files changed, 20 insertions(+), 5 deletions(-) rename apps/labrinth/.sqlx/{query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json => query-823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json} (53%) diff --git a/apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json b/apps/labrinth/.sqlx/query-823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json similarity index 53% rename from apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json rename to apps/labrinth/.sqlx/query-823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json index bd0481fc9b..656cc73da4 100644 --- a/apps/labrinth/.sqlx/query-678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558.json +++ b/apps/labrinth/.sqlx/query-823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", m.slug as \"slug\" FROM dependencies d\n INNER JOIN mods m ON m.id = d.mod_dependency_id\n WHERE dependent_id = $1", + "query": "\n SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", d.dependency_type, m.slug as \"slug\" FROM dependencies d\n INNER JOIN mods m ON m.id = d.mod_dependency_id\n WHERE dependent_id = $1", "describe": { "columns": [ { @@ -10,6 +10,11 @@ }, { "ordinal": 1, + "name": "dependency_type", + "type_info": "Varchar" + }, + { + "ordinal": 2, "name": "slug", "type_info": "Varchar" } @@ -21,8 +26,9 @@ }, "nullable": [ true, + false, true ] }, - "hash": "678e51366948f5a41de74182e5de789420301ac35f23276229f39a8de8e8a558" + "hash": "823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84" } diff --git a/apps/labrinth/src/search/indexing/local_import.rs b/apps/labrinth/src/search/indexing/local_import.rs index 2bff516cd3..4cdf156217 100644 --- a/apps/labrinth/src/search/indexing/local_import.rs +++ b/apps/labrinth/src/search/indexing/local_import.rs @@ -416,6 +416,7 @@ pub async fn index_local( color: project.color.map(|x| x as u32), required_dependencies: version.required_dependencies, optional_dependencies: version.optional_dependencies, + embedded_dependencies: version.embedded_dependencies, incompatibilities: version.incompatibilities, loader_fields, project_loader_fields: project_loader_fields.clone(), @@ -436,9 +437,10 @@ struct PartialVersion { loaders: Vec, project_types: Vec, version_fields: Vec, - pub required_dependencies: Vec, - pub optional_dependencies: Vec, - pub incompatibilities: Vec, + required_dependencies: Vec, + optional_dependencies: Vec, + embedded_dependencies: Vec, + incompatibilities: Vec, } async fn index_versions( @@ -557,6 +559,7 @@ async fn index_versions( let mut required_dependencies: Vec = Vec::new(); let mut optional_dependencies: Vec = Vec::new(); + let mut embedded_dependencies: Vec = Vec::new(); let mut incompatibilities: Vec = Vec::new(); let records = sqlx::query!( @@ -573,6 +576,7 @@ async fn index_versions( let v = match r.dependency_type.as_str() { "required" => &mut required_dependencies, "optional" => &mut optional_dependencies, + "embedded" => &mut embedded_dependencies, "incompatible" => &mut incompatibilities, _ => continue, }; @@ -596,6 +600,7 @@ async fn index_versions( version_fields, required_dependencies, optional_dependencies, + embedded_dependencies, incompatibilities, }); } diff --git a/apps/labrinth/src/search/indexing/mod.rs b/apps/labrinth/src/search/indexing/mod.rs index ddf4cd16a5..82d1ae1773 100644 --- a/apps/labrinth/src/search/indexing/mod.rs +++ b/apps/labrinth/src/search/indexing/mod.rs @@ -567,6 +567,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[ "color", "required_dependencies", "optional_dependencies", + "embedded_dependencies", "incompatibilities", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. @@ -614,6 +615,7 @@ const DEFAULT_ATTRIBUTES_FOR_FACETING: &[&str] = &[ "color", "required_dependencies", "optional_dependencies", + "embedded_dependencies", "incompatibilities", // Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist). // TODO: remove these- as they should be automatically populated. This is a band-aid fix. diff --git a/apps/labrinth/src/search/mod.rs b/apps/labrinth/src/search/mod.rs index 2f2f639c08..3e71d5ad00 100644 --- a/apps/labrinth/src/search/mod.rs +++ b/apps/labrinth/src/search/mod.rs @@ -218,6 +218,7 @@ pub struct UploadSearchProject { pub required_dependencies: Vec, pub optional_dependencies: Vec, + pub embedded_dependencies: Vec, pub incompatibilities: Vec, // Hidden fields to get the Project model out of the search results. @@ -261,6 +262,7 @@ pub struct ResultSearchProject { pub required_dependencies: Vec, pub optional_dependencies: Vec, + pub embedded_dependencies: Vec, pub incompatibilities: Vec, // Hidden fields to get the Project model out of the search results.