Skip to content

Commit

Permalink
Ignore duplicate path/field/token links.
Browse files Browse the repository at this point in the history
This is occasionally important when dealing with arrays in metadata,
where each element is processed separately and not subject to token
deduplication; as a result, we end up attempting to insert duplicate
path/field/token links. By ignoring hese, we ensure that the index
builds, and we also save space by trimming out duplicate tokens.
  • Loading branch information
LTLA committed Jun 18, 2024
1 parent 9343078 commit 6350cf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sqlite/createTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createTables(db) {
db.prepare("CREATE INDEX index_fields ON fields(field)").run();

db.prepare(`CREATE TABLE links (pid INTEGER NOT NULL, fid INTEGER NOT NULL, tid INTEGER NOT NULL,
UNIQUE(pid, fid, tid),
UNIQUE(pid, fid, tid) ON CONFLICT IGNORE,
FOREIGN KEY(pid) REFERENCES paths(pid) ON DELETE CASCADE)`).run();
db.prepare("CREATE INDEX index_links ON links(tid, fid)").run();
return;
Expand Down

0 comments on commit 6350cf4

Please sign in to comment.