diff --git a/.sqlx/query-ec8de4a2533e34cee61e610496099c57d99ac0c16be1b36e476e7670a00fd7b5.json b/.sqlx/query-794b781594db938d7e0e53f957ee614066bd7f7b3f653f186f1262d448ef89a1.json similarity index 65% rename from .sqlx/query-ec8de4a2533e34cee61e610496099c57d99ac0c16be1b36e476e7670a00fd7b5.json rename to .sqlx/query-794b781594db938d7e0e53f957ee614066bd7f7b3f653f186f1262d448ef89a1.json index 50a0e557..6e8e6d3a 100644 --- a/.sqlx/query-ec8de4a2533e34cee61e610496099c57d99ac0c16be1b36e476e7670a00fd7b5.json +++ b/.sqlx/query-794b781594db938d7e0e53f957ee614066bd7f7b3f653f186f1262d448ef89a1.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT v.id id, m.id mod_id, u.username owner_username\n \n FROM versions v\n INNER JOIN mods m ON v.mod_id = m.id AND m.status = ANY($2)\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.role = $3 AND tm.accepted = TRUE\n INNER JOIN users u ON tm.user_id = u.id\n WHERE v.status != ANY($1)\n GROUP BY v.id, m.id, u.id\n ORDER BY m.id DESC;\n ", + "query": "\n SELECT v.id id, m.id mod_id, u.username owner_username\n \n FROM versions v\n INNER JOIN mods m ON v.mod_id = m.id AND m.status = ANY($2)\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.is_owner = TRUE AND tm.accepted = TRUE\n INNER JOIN users u ON tm.user_id = u.id\n WHERE v.status != ANY($1)\n GROUP BY v.id, m.id, u.id\n ORDER BY m.id DESC;\n ", "describe": { "columns": [ { @@ -22,8 +22,7 @@ "parameters": { "Left": [ "TextArray", - "TextArray", - "Text" + "TextArray" ] }, "nullable": [ @@ -32,5 +31,5 @@ false ] }, - "hash": "ec8de4a2533e34cee61e610496099c57d99ac0c16be1b36e476e7670a00fd7b5" + "hash": "794b781594db938d7e0e53f957ee614066bd7f7b3f653f186f1262d448ef89a1" } diff --git a/.sqlx/query-94de8109ff9f95be5e9f70c629fa9b1cfb2e9a1c094bc5e0d529a314a77fb4d7.json b/.sqlx/query-94de8109ff9f95be5e9f70c629fa9b1cfb2e9a1c094bc5e0d529a314a77fb4d7.json deleted file mode 100644 index e3f37c5f..00000000 --- a/.sqlx/query-94de8109ff9f95be5e9f70c629fa9b1cfb2e9a1c094bc5e0d529a314a77fb4d7.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH version_fields_cte AS (\n SELECT version_id, field_id, int_value, enum_value, string_value\n FROM version_fields\n ),\n version_fields_json AS (\n SELECT DISTINCT version_id,\n JSONB_AGG( \n DISTINCT jsonb_build_object('field_id', field_id, 'int_value', int_value, 'enum_value', enum_value, 'string_value', string_value)\n ) version_fields_json\n FROM version_fields_cte\n GROUP BY version_id\n ),\n loader_fields_cte AS (\n SELECT DISTINCT vf.version_id, lf.*, l.loader\n FROM loader_fields lf\n INNER JOIN version_fields_cte vf ON lf.id = vf.field_id\n LEFT JOIN loaders_versions lv ON vf.version_id = lv.version_id\n LEFT JOIN loaders l ON lv.loader_id = l.id\n GROUP BY vf.version_id, lf.enum_type, lf.id, l.loader\n ),\n loader_fields_json AS (\n SELECT DISTINCT version_id,\n JSONB_AGG(\n DISTINCT jsonb_build_object(\n 'version_id', lf.version_id,\n 'lf_id', id, 'loader_name', loader, 'field', field, 'field_type', field_type, 'enum_type', enum_type, 'min_val', min_val, 'max_val', max_val, 'optional', optional\n )\n ) filter (where lf.id is not null) loader_fields_json\n FROM loader_fields_cte lf\n GROUP BY version_id\n ),\n loader_field_enum_values_json AS (\n SELECT DISTINCT version_id,\n JSONB_AGG(\n DISTINCT jsonb_build_object(\n 'id', lfev.id, 'enum_id', lfev.enum_id, 'value', lfev.value, 'ordering', lfev.ordering, 'created', lfev.created, 'metadata', lfev.metadata\n ) \n ) filter (where lfev.id is not null) loader_field_enum_values_json\n FROM loader_field_enum_values lfev\n INNER JOIN loader_fields_cte lf on lf.enum_type = lfev.enum_id\n GROUP BY version_id\n )\n\n SELECT m.id id, v.id version_id, m.name name, m.description description, m.downloads downloads, m.follows follows,\n m.icon_url icon_url, m.published published, m.approved approved, m.updated updated,\n m.team_id team_id, m.license license, m.slug slug, m.status status_name, m.color color,\n u.username username,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is false) categories,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is true) additional_categories,\n ARRAY_AGG(DISTINCT lo.loader) filter (where lo.loader is not null) loaders,\n ARRAY_AGG(DISTINCT pt.name) filter (where pt.name is not null) project_types,\n ARRAY_AGG(DISTINCT g.slug) filter (where g.slug is not null) games,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is false) gallery,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is true) featured_gallery,\n vf.version_fields_json version_fields,\n lf.loader_fields_json loader_fields,\n lfev.loader_field_enum_values_json loader_field_enum_values\n FROM versions v\n INNER JOIN mods m ON v.mod_id = m.id AND m.status = ANY($2)\n LEFT OUTER JOIN mods_categories mc ON joining_mod_id = m.id\n LEFT OUTER JOIN categories c ON mc.joining_category_id = c.id\n LEFT OUTER JOIN loaders_versions lv ON lv.version_id = v.id\n LEFT OUTER JOIN loaders lo ON lo.id = lv.loader_id\n LEFT JOIN loaders_project_types lpt ON lpt.joining_loader_id = lo.id\n LEFT JOIN project_types pt ON pt.id = lpt.joining_project_type_id\n LEFT JOIN loaders_project_types_games lptg ON lptg.loader_id = lo.id AND lptg.project_type_id = pt.id\n LEFT JOIN games g ON lptg.game_id = g.id\n LEFT OUTER JOIN mods_gallery mg ON mg.mod_id = m.id\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.is_owner = TRUE AND tm.accepted = TRUE\n INNER JOIN users u ON tm.user_id = u.id\n LEFT OUTER JOIN version_fields_json vf ON v.id = vf.version_id\n LEFT OUTER JOIN loader_fields_json lf ON v.id = lf.version_id\n LEFT OUTER JOIN loader_field_enum_values_json lfev ON v.id = lfev.version_id\n WHERE v.status != ANY($1)\n GROUP BY v.id, vf.version_fields_json, lf.loader_fields_json, lfev.loader_field_enum_values_json, m.id, u.id;\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "version_id", - "type_info": "Int8" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 4, - "name": "downloads", - "type_info": "Int4" - }, - { - "ordinal": 5, - "name": "follows", - "type_info": "Int4" - }, - { - "ordinal": 6, - "name": "icon_url", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "published", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "approved", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "updated", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "team_id", - "type_info": "Int8" - }, - { - "ordinal": 11, - "name": "license", - "type_info": "Varchar" - }, - { - "ordinal": 12, - "name": "slug", - "type_info": "Varchar" - }, - { - "ordinal": 13, - "name": "status_name", - "type_info": "Varchar" - }, - { - "ordinal": 14, - "name": "color", - "type_info": "Int4" - }, - { - "ordinal": 15, - "name": "username", - "type_info": "Varchar" - }, - { - "ordinal": 16, - "name": "categories", - "type_info": "VarcharArray" - }, - { - "ordinal": 17, - "name": "additional_categories", - "type_info": "VarcharArray" - }, - { - "ordinal": 18, - "name": "loaders", - "type_info": "VarcharArray" - }, - { - "ordinal": 19, - "name": "project_types", - "type_info": "VarcharArray" - }, - { - "ordinal": 20, - "name": "games", - "type_info": "VarcharArray" - }, - { - "ordinal": 21, - "name": "gallery", - "type_info": "VarcharArray" - }, - { - "ordinal": 22, - "name": "featured_gallery", - "type_info": "VarcharArray" - }, - { - "ordinal": 23, - "name": "version_fields", - "type_info": "Jsonb" - }, - { - "ordinal": 24, - "name": "loader_fields", - "type_info": "Jsonb" - }, - { - "ordinal": 25, - "name": "loader_field_enum_values", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "TextArray", - "TextArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - true, - false, - false, - false, - true, - false, - true, - false, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ] - }, - "hash": "94de8109ff9f95be5e9f70c629fa9b1cfb2e9a1c094bc5e0d529a314a77fb4d7" -} diff --git a/src/models/v2/search.rs b/src/models/v2/search.rs index c396be41..746710fc 100644 --- a/src/models/v2/search.rs +++ b/src/models/v2/search.rs @@ -140,7 +140,7 @@ impl LegacyResultSearchProject { slug: result_search_project.slug, author: result_search_project.author, title: result_search_project.name, - description: result_search_project.description, + description: result_search_project.summary, display_categories, downloads: result_search_project.downloads, follows: result_search_project.follows, diff --git a/src/models/v3/projects.rs b/src/models/v3/projects.rs index c3ce6f9b..62103708 100644 --- a/src/models/v3/projects.rs +++ b/src/models/v3/projects.rs @@ -317,7 +317,7 @@ impl Project { .map(|x| GalleryItem { url: x.image_url, featured: x.featured, - title: x.title, + name: x.name, description: x.description, created: x.created, ordering: x.ordering, @@ -329,12 +329,11 @@ impl Project { slug: m.slug, project_types: m.project_types, games, - team: team_id, + team_id, organization: organization_id, - title: m.title, - description: m.description, - body: "".to_string(), // Body is potentially huge, do not store in search - body_url: None, // Deprecated + name: m.name, + summary: m.summary, + description: "".to_string(), // Body is potentially huge, do not store in search published, updated, approved, diff --git a/src/search/indexing/local_import.rs b/src/search/indexing/local_import.rs index 4671efb6..c5485eb5 100644 --- a/src/search/indexing/local_import.rs +++ b/src/search/indexing/local_import.rs @@ -171,7 +171,7 @@ pub async fn index_local( version_id: version_id.to_string(), project_id: project_id.to_string(), name: m.inner.name.clone(), - description: m.inner.description.clone(), + summary: m.inner.summary.clone(), categories, follows: m.inner.follows, downloads: m.inner.downloads, diff --git a/src/search/indexing/mod.rs b/src/search/indexing/mod.rs index dd3656f9..7fbef6e4 100644 --- a/src/search/indexing/mod.rs +++ b/src/search/indexing/mod.rs @@ -191,7 +191,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[ "slug", "author", "name", - "description", + "summary", "categories", "display_categories", "downloads", @@ -223,7 +223,7 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[ "loaders", // search uses loaders as categories- this is purely for the Project model. ]; -const DEFAULT_SEARCHABLE_ATTRIBUTES: &[&str] = &["name", "description", "author", "slug"]; +const DEFAULT_SEARCHABLE_ATTRIBUTES: &[&str] = &["name", "summary", "author", "slug"]; const DEFAULT_ATTRIBUTES_FOR_FACETING: &[&str] = &[ "categories", diff --git a/src/search/mod.rs b/src/search/mod.rs index 25158ab6..83160325 100644 --- a/src/search/mod.rs +++ b/src/search/mod.rs @@ -81,7 +81,7 @@ pub struct UploadSearchProject { pub slug: Option, pub author: String, pub name: String, - pub description: String, + pub summary: String, pub categories: Vec, pub display_categories: Vec, pub follows: i32, @@ -137,7 +137,7 @@ pub struct ResultSearchProject { pub slug: Option, pub author: String, pub name: String, - pub description: String, + pub summary: String, pub categories: Vec, pub display_categories: Vec, pub downloads: i32, diff --git a/tests/common/search.rs b/tests/common/search.rs index 73dd5fa0..58678f45 100644 --- a/tests/common/search.rs +++ b/tests/common/search.rs @@ -83,7 +83,7 @@ pub async fn setup_search_projects(test_env: &TestEnvironment) -> Arc) -> Arc