server: index all search summaries on refresh

This commit is contained in:
Bill Thiede 2025-01-29 16:13:09 -08:00
parent 80454cbc7e
commit d681612e8e
2 changed files with 5 additions and 4 deletions

View File

@ -3,7 +3,6 @@ SELECT
link,
clean_summary
FROM
-- Remoe tablesample when db sufficiently indexed
post AS p TABLESAMPLE SYSTEM (.1)
post AS p
INNER JOIN feed AS f ON p.site = f.slug -- necessary to weed out nzb posts
WHERE search_summary IS NULL;

View File

@ -13,7 +13,7 @@ use async_trait::async_trait;
use cacher::{Cacher, FilesystemCacher};
use css_inline::{CSSInliner, InlineError, InlineOptions};
use linkify::{LinkFinder, LinkKind};
use log::{error, info, warn};
use log::{debug, error, info, warn};
use lol_html::{
element, errors::RewritingError, html_content::ContentType, rewrite_str, text,
RewriteStrSettings,
@ -23,7 +23,6 @@ use regex::Regex;
use scraper::{Html, Selector};
use sqlx::types::time::PrimitiveDateTime;
use thiserror::Error;
use tokio::sync::Mutex;
use url::Url;
use crate::{
@ -288,6 +287,7 @@ impl<'c> Transformer for SlurpContents<'c> {
// configuration found for this site, use the local InlineStyle
// transform.
if self.inline_css && self.get_selectors(test_link).is_none() {
debug!("local inline CSS for {link:?}");
return InlineStyle {}.transform(link, html).await;
}
}
@ -308,6 +308,7 @@ impl<'c> Transformer for SlurpContents<'c> {
let body = Arc::new(body);
let base_url = Some(link.clone());
let body = if self.inline_css {
debug!("inlining CSS for {link}");
let inner_body = Arc::clone(&body);
let res = tokio::task::spawn_blocking(move || {
let css = concat!(
@ -341,6 +342,7 @@ impl<'c> Transformer for SlurpContents<'c> {
}
}
} else {
debug!("using body as-is for {link:?}");
Arc::into_inner(body).expect("failed to take body out of Arc")
};