From 77d35b61a9ea3d10205f6e39a7f65bfef0fc5ce1 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Thu, 15 Oct 2020 09:56:41 -0700 Subject: [PATCH] Fix indexing (#76) --- src/search/indexing/curseforge_import.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/search/indexing/curseforge_import.rs b/src/search/indexing/curseforge_import.rs index bdd21f13a..46be0d412 100644 --- a/src/search/indexing/curseforge_import.rs +++ b/src/search/indexing/curseforge_import.rs @@ -186,9 +186,17 @@ pub async fn index_curseforge( .date_modified .parse::>()?; + let mut author = String::new(); + let mut author_url = String::new(); + + if curseforge_mod.authors.len() > 0 { + author = (&curseforge_mod.authors[0].name).to_string(); + author_url = (&curseforge_mod.authors[0].url).to_string(); + } + docs_to_add.push(UploadSearchMod { mod_id: format!("curse-{}", curseforge_mod.id), - author: (&curseforge_mod.authors[0].name).to_string(), + author, title: curseforge_mod.name, description: curseforge_mod.summary.chars().take(150).collect(), categories: mod_categories, @@ -196,7 +204,7 @@ pub async fn index_curseforge( downloads: curseforge_mod.download_count as i32, page_url: curseforge_mod.website_url, icon_url, - author_url: (&curseforge_mod.authors[0].url).to_string(), + author_url, date_created: created, created_timestamp: created.timestamp(), date_modified: modified,