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, link,
clean_summary clean_summary
FROM FROM
-- Remoe tablesample when db sufficiently indexed post AS p
post AS p TABLESAMPLE SYSTEM (.1)
INNER JOIN feed AS f ON p.site = f.slug -- necessary to weed out nzb posts INNER JOIN feed AS f ON p.site = f.slug -- necessary to weed out nzb posts
WHERE search_summary IS NULL; WHERE search_summary IS NULL;

View File

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