feat(db): remove token computations on import

This commit is contained in:
2025-11-12 10:08:55 +02:00
parent 27e791f3b1
commit 495e3ea996
+9 -8
View File
@@ -1,7 +1,7 @@
import { RowDataPacket } from "mysql2/promise"; import { RowDataPacket } from "mysql2/promise";
import { Pool, PoolClient } from "pg"; import { Pool, PoolClient } from "pg";
import { computeReadingTime, computeTokenStatistics } from "@/utils/computed"; import { computeReadingTime } from "@/utils/computed";
type SourceOptions = { type SourceOptions = {
host: string; host: string;
@@ -293,13 +293,14 @@ export class Engine {
} }
} }
if (t === "article") { // TODO: this is to heavy for the import process need to find a way to compute on creation or later
clone.token_statistics = computeTokenStatistics({ // if (t === "article") {
body: String(clone.body ?? ""), // clone.token_statistics = computeTokenStatistics({
categories: Array.isArray(clone.categories) ? clone.categories : [], // body: String(clone.body ?? ""),
title: String(clone.title ?? ""), // categories: Array.isArray(clone.categories) ? clone.categories : [],
}); // title: String(clone.title ?? ""),
} // });
// }
return clone; return clone;
} }