diff --git a/public/admin/pages/ingest/articles.html b/public/admin/pages/ingest/articles.html index d256397..607d4fd 100644 --- a/public/admin/pages/ingest/articles.html +++ b/public/admin/pages/ingest/articles.html @@ -27,7 +27,7 @@
Total articles
-
With content
+
Intelligence ready
With embedding
Events
diff --git a/public/admin/pages/ingest/events.html b/public/admin/pages/ingest/events.html index 5cd1cc4..2ee4870 100644 --- a/public/admin/pages/ingest/events.html +++ b/public/admin/pages/ingest/events.html @@ -27,7 +27,7 @@
Total articles
-
With content
+
Intelligence ready
With embedding
Events
diff --git a/public/admin/pages/stats.html b/public/admin/pages/stats.html index a6f2f5f..1261cf0 100644 --- a/public/admin/pages/stats.html +++ b/public/admin/pages/stats.html @@ -23,7 +23,7 @@
Total articles
-
With content
+
Intelligence ready
With embedding
Events
diff --git a/src/db/index.js b/src/db/index.js index f65b854..9ea1cb2 100644 --- a/src/db/index.js +++ b/src/db/index.js @@ -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, diff --git a/src/routes/admin.js b/src/routes/admin.js index d58ff21..f756c76 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -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,