@voidwire/lore 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/indexer.ts +4 -1
- package/lib/indexers/flux.ts +7 -1
- package/lib/indexers/obsidian.ts +2 -0
- package/package.json +1 -1
package/lib/indexer.ts
CHANGED
|
@@ -150,8 +150,11 @@ export function createIndexerContext(
|
|
|
150
150
|
// Chunk content if needed
|
|
151
151
|
const chunks = chunkContent(entry.content);
|
|
152
152
|
|
|
153
|
-
// Insert each chunk
|
|
153
|
+
// Insert each chunk (dedup at chunk level)
|
|
154
154
|
for (const chunk of chunks) {
|
|
155
|
+
const chunkHash = createHash("sha256").update(chunk).digest("hex");
|
|
156
|
+
if (seenHashes.has(chunkHash)) continue;
|
|
157
|
+
seenHashes.add(chunkHash);
|
|
155
158
|
insertStmt.run(
|
|
156
159
|
entry.source,
|
|
157
160
|
entry.title,
|
package/lib/indexers/flux.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Timestamp: captured date if present, otherwise empty
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { readdirSync, readFileSync, existsSync } from "fs";
|
|
15
|
+
import { readdirSync, readFileSync, existsSync, statSync } from "fs";
|
|
16
16
|
import { join, basename } from "path";
|
|
17
17
|
import type { IndexerContext } from "../indexer";
|
|
18
18
|
|
|
@@ -82,6 +82,7 @@ function parseFluxFile(
|
|
|
82
82
|
status: string,
|
|
83
83
|
): void {
|
|
84
84
|
const raw = readFileSync(filePath, "utf-8");
|
|
85
|
+
const mtime = statSync(filePath).mtime;
|
|
85
86
|
const lines = raw.split("\n");
|
|
86
87
|
|
|
87
88
|
for (const line of lines) {
|
|
@@ -112,6 +113,11 @@ function parseFluxFile(
|
|
|
112
113
|
);
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
// Fall back to file mtime if no captured date
|
|
117
|
+
if (!timestamp) {
|
|
118
|
+
timestamp = mtime.toISOString();
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
// Extract archived date if present (strip from description)
|
|
116
122
|
rest = rest.replace(/\s*archived::\s*\S+/, "");
|
|
117
123
|
|
package/lib/indexers/obsidian.ts
CHANGED