fix: keep archive indexing off API startup

This commit is contained in:
ImBenji
2026-08-04 21:39:20 +01:00
parent bd162606b6
commit 2020a0fde2
5 changed files with 11 additions and 17 deletions
-10
View File
@@ -47,12 +47,7 @@ db.exec(`
CREATE INDEX IF NOT EXISTS idx_articles_normalized_title ON articles(normalized_title);
CREATE INDEX IF NOT EXISTS idx_articles_event_id ON articles(event_id);
CREATE INDEX IF NOT EXISTS idx_articles_has_embedding ON articles(has_embedding);
CREATE INDEX IF NOT EXISTS idx_articles_content_status ON articles(content_status);
CREATE INDEX IF NOT EXISTS idx_articles_content_attempted_at ON articles(content_attempted_at);
CREATE INDEX IF NOT EXISTS idx_articles_pub_date_effective ON articles(pub_date_effective DESC);
CREATE INDEX IF NOT EXISTS idx_articles_has_content
ON articles(id)
WHERE content IS NOT NULL AND content != '';
CREATE INDEX IF NOT EXISTS idx_articles_usable_pub_date
ON articles(pub_date_effective DESC, id DESC)
WHERE content IS NOT NULL
@@ -79,11 +74,6 @@ db.exec(`
);
`);
db.exec(`
CREATE INDEX IF NOT EXISTS idx_article_embedding_meta_embedded_at
ON article_embedding_meta(embedded_at);
`);
db.exec(`
CREATE VIRTUAL TABLE IF NOT EXISTS article_embeddings USING vec0(
article_id INTEGER PRIMARY KEY,
+8 -4
View File
@@ -843,10 +843,12 @@ async function adminRoutes(fastify) {
}
const counts = db.prepare(`
SELECT
(SELECT COUNT(*) FROM articles) AS total,
(SELECT COUNT(*) FROM articles WHERE content IS NOT NULL AND content != '') AS withContent,
COALESCE((SELECT seq FROM sqlite_sequence WHERE name='articles'), 0) AS total,
(SELECT COUNT(*) FROM articles
WHERE content IS NOT NULL AND content != ''
AND is_index_page = 0 AND has_embedding = 1) AS withContent,
(SELECT COUNT(*) FROM articles WHERE has_embedding = 1) AS withEmbedding,
(SELECT COUNT(*) FROM events) AS eventCount
COALESCE((SELECT seq FROM sqlite_sequence WHERE name='events'), 0) AS eventCount
`).get();
statsSummaryCache = { at: Date.now(), value: counts };
return counts;
@@ -863,7 +865,9 @@ async function adminRoutes(fastify) {
const counts = db.prepare(`
SELECT
(SELECT COUNT(*) FROM articles) as total,
(SELECT COUNT(*) FROM articles WHERE content IS NOT NULL AND content != '') as withContent,
(SELECT COUNT(*) FROM articles
WHERE content IS NOT NULL AND content != ''
AND is_index_page = 0 AND has_embedding = 1) as withContent,
(SELECT COUNT(*) FROM articles WHERE has_embedding = 1) as withEmbedding,
(SELECT COUNT(*) FROM events) as eventCount,
(SELECT COUNT(*) FROM articles WHERE ingested_at >= datetime('now', '-1 hour')) as ingestedPerHour,