From 0835686a331f54e2b4a29a35c3d6746f914082a8 Mon Sep 17 00:00:00 2001 From: Cris Stringfellow <22254235+crislin2046@users.noreply.github.com> Date: Sun, 19 Dec 2021 22:27:33 +0800 Subject: [PATCH] "NDX should be improved" --- archivist.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/archivist.js b/archivist.js index 339789f..ba7029d 100644 --- a/archivist.js +++ b/archivist.js @@ -394,15 +394,15 @@ export default Archivist; const pageText = processDoc(flatDoc); const {title, url} = Targets.get(sessionId); - let id; + let id, ndx_id; if ( State.Index.has(url) ) { - ({id} = State.Index.get(url)); + ({ndx_id, id} = State.Index.get(url)); } else { Id++; id = Id; } const doc = toNDXDoc({id, url, title, pageText}); - State.Index.set(url, {id:doc.id, title}); + State.Index.set(url, {id:doc.id, ndx_id:doc.ndx_id, title}); State.Index.set(doc.id, url); State.Index.set('ndx'+doc.ndx_id, url); @@ -410,9 +410,9 @@ export default Archivist; Flex.update(doc.id, doc.title + ' ' + doc.content + ' ' + doc.url.split(URI_SPLIT).join(' ')); //New NDX code - const res = NDX_FTSIndex.update(doc); + const res = NDX_FTSIndex.update(doc, ndx_id); - console.log("NDX updated", doc.id); + console.log("NDX updated", doc.ndx_id); UpdatedKeys.add(url); @@ -958,8 +958,8 @@ export default Archivist; removeDocumentFromIndex(retVal.index, NDXRemoved, id); maybeClean(); }, - update: doc => { - retVal.remove(doc.ndx_id); + update: (doc, old_id) => { + retVal.remove(old_id); maybeClean(); retVal.add(doc); },