From 2e6539cbc5c3c98cd94271f94afa217e783f874d Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Oct 2022 19:38:35 +0200 Subject: [PATCH] Fix redirect importing --- brood/src/commands/ingest.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/brood/src/commands/ingest.rs b/brood/src/commands/ingest.rs index c4c82d5..8a9526d 100644 --- a/brood/src/commands/ingest.rs +++ b/brood/src/commands/ingest.rs @@ -79,12 +79,20 @@ fn first_stage() -> io::Result<(AdjacencyList, Titles)> { }, }); - for (to, start, end) in json_page.links { + if let Some(to) = json_page.redirect { let to = titles.insert(util::normalize_link(&to)); result.links.push(Link { to, - data: LinkInfo { start, end }, + data: LinkInfo { start: 0, end: 0 }, }); + } else { + for (to, start, end) in json_page.links { + let to = titles.insert(util::normalize_link(&to)); + result.links.push(Link { + to, + data: LinkInfo { start, end }, + }); + } } if (i + 1) % 100_000 == 0 {