diff --git a/quickpeep_indexer/src/bin/qp-indexer.rs b/quickpeep_indexer/src/bin/qp-indexer.rs index dd20ec0..b81d6c6 100644 --- a/quickpeep_indexer/src/bin/qp-indexer.rs +++ b/quickpeep_indexer/src/bin/qp-indexer.rs @@ -15,7 +15,8 @@ use quickpeep_seed_parser::loader::{ find_seed_files, seed_loader, Seed, UrlOrUrlPattern, SEED_EXTENSION, }; use quickpeep_structs::rake_entries::{ - IconEntry, PackRecord, RakedPageEntry, SCHEMA_RAKED_ICONS, SCHEMA_RAKED_PAGES, + AnalysisAntifeatures, IconEntry, PackRecord, RakedPageEntry, SCHEMA_RAKED_ICONS, + SCHEMA_RAKED_PAGES, }; use quickpeep_utils::urls::get_reduced_domain; use smartstring::alias::CompactString; @@ -112,6 +113,27 @@ pub fn handle_page_pack( .map(|seed: &Seed| seed.tags.iter().map(|cs| cs.to_string()).collect()) .unwrap_or_else(|| Vec::with_capacity(0)); + // TODO(temporary): add antifeatures as tags, for now. + let antifeatures = page_record.record.analysed_antifeatures; + if antifeatures.contains(AnalysisAntifeatures::CLOUDFLARE) { + tags.push("ZCloudflare".to_owned()); + } + if antifeatures.contains(AnalysisAntifeatures::ADVERTS) { + tags.push("ZAdverts".to_owned()); + } + if antifeatures.contains(AnalysisAntifeatures::ANNOYANCE) { + tags.push("ZAnnoyance".to_owned()); + } + if antifeatures.contains(AnalysisAntifeatures::COOKIE_NAG) { + tags.push("ZCookieNags".to_owned()); + } + if antifeatures.contains(AnalysisAntifeatures::PRIVACY) { + tags.push("ZTrackers".to_owned()); + } + if antifeatures.contains(AnalysisAntifeatures::SOCIAL) { + tags.push("ZSocialTrackers".to_owned()); + } + // TODO Store the actual structure of the document in the store? let favicon_url_relative = document.head.effective_favicon_url();