"Up deps"
This commit is contained in:
parent
143dd9e77c
commit
bf011f0141
22
archivist.js
22
archivist.js
|
@ -11,8 +11,9 @@
|
|||
import fs from 'fs';
|
||||
// search related
|
||||
import FlexSearch from 'flexsearch';
|
||||
import { createIndex as NDX, addDocumentToIndex as ndx } from 'ndx';
|
||||
import { query as NDXQuery } from 'ndx-query';
|
||||
//import { createIndex as NDX, addDocumentToIndex as ndx } from 'ndx';
|
||||
//import { query as NDXQuery } from 'ndx-query';
|
||||
import { DocumentIndex } from 'ndx';
|
||||
import Nat from 'natural';
|
||||
|
||||
import args from './args.js';
|
||||
|
@ -623,13 +624,12 @@ export default Archivist;
|
|||
|
||||
State.Cache = new Map(JSON.parse(Fs.readFileSync(cacheFile)));
|
||||
State.Index = new Map(JSON.parse(Fs.readFileSync(indexFile)));
|
||||
console.log(Flex);
|
||||
Fs.readdirSync(ftsDir, {withFileTypes:true}).forEach(dirEnt => {
|
||||
if ( dirEnt.isFile() ) {
|
||||
const content = Fs.readFileSync(Path.resolve(ftsDir, dirEnt.name)).toString();
|
||||
const result = Flex.import(dirEnt.name, JSON.parse(content));
|
||||
console.log('Imported', dirEnt.name, result);
|
||||
console.log(Flex);
|
||||
DEBUG && console.log('Imported', dirEnt.name, result);
|
||||
DEBUG && console.log(Flex);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -774,6 +774,8 @@ export default Archivist;
|
|||
}
|
||||
|
||||
function NDXIndex(fields) {
|
||||
// Old code (from newer, in my opinion, worse, version)
|
||||
/*
|
||||
// source:
|
||||
// adapted from:
|
||||
// https://github.com/ndx-search/docs/blob/94530cbff6ae8ea66c54bba4c97bdd972518b8b4/README.md#creating-a-simple-indexer-with-a-search-function
|
||||
|
@ -824,6 +826,16 @@ export default Archivist;
|
|||
q,
|
||||
),
|
||||
};
|
||||
*/
|
||||
// Even older code (from older but, to me, much better, version: 0.4.1)
|
||||
|
||||
const index = new DocumentIndex();
|
||||
fields.forEach(name => index.addField(name));
|
||||
|
||||
return {
|
||||
search: query => index.search(query),
|
||||
add: doc => index.add(doc.url, doc)
|
||||
};
|
||||
}
|
||||
|
||||
function toNDXDoc({url, title, pageText}) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"flexsearch": "latest",
|
||||
"hasha": "latest",
|
||||
"natural": "^5.1.11",
|
||||
"ndx": "^1.0.2",
|
||||
"ndx": "^0.4.1",
|
||||
"ndx-query": "^1.0.1",
|
||||
"ndx-serializable": "^1.0.0",
|
||||
"node-fetch": "latest",
|
||||
|
@ -3987,9 +3987,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/ndx": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-1.0.2.tgz",
|
||||
"integrity": "sha512-/TbqqemJ80lGKRoRuXsz7VgA0erkIxilCUbkMfRL1h2VBGBLGvQnI+FdHvWDqJnUhgOP/T9+SYeWS84wbXGBFA=="
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-0.4.1.tgz",
|
||||
"integrity": "sha512-iXpb4uQmgBxqiPtO1PojXxYoTJyC0TmeFE20VTkGYakiihnO84atCLiRZQmzYW3UqzFL8FaXPMGOJDm276tjUA=="
|
||||
},
|
||||
"node_modules/ndx-query": {
|
||||
"version": "1.0.1",
|
||||
|
@ -3999,6 +3999,11 @@
|
|||
"ndx": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/ndx-query/node_modules/ndx": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-1.0.2.tgz",
|
||||
"integrity": "sha512-/TbqqemJ80lGKRoRuXsz7VgA0erkIxilCUbkMfRL1h2VBGBLGvQnI+FdHvWDqJnUhgOP/T9+SYeWS84wbXGBFA=="
|
||||
},
|
||||
"node_modules/ndx-serializable": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ndx-serializable/-/ndx-serializable-1.0.0.tgz",
|
||||
|
@ -11007,9 +11012,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"ndx": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-1.0.2.tgz",
|
||||
"integrity": "sha512-/TbqqemJ80lGKRoRuXsz7VgA0erkIxilCUbkMfRL1h2VBGBLGvQnI+FdHvWDqJnUhgOP/T9+SYeWS84wbXGBFA=="
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-0.4.1.tgz",
|
||||
"integrity": "sha512-iXpb4uQmgBxqiPtO1PojXxYoTJyC0TmeFE20VTkGYakiihnO84atCLiRZQmzYW3UqzFL8FaXPMGOJDm276tjUA=="
|
||||
},
|
||||
"ndx-query": {
|
||||
"version": "1.0.1",
|
||||
|
@ -11017,6 +11022,13 @@
|
|||
"integrity": "sha512-ybm/bt2WDwDzoUDXKrqW+oHKPV9qF9E8ICqZUWZDYgPvogMZ49eaXnCJ1jP9V+bkgR98EebS7ylE1DIjwqvl4g==",
|
||||
"requires": {
|
||||
"ndx": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ndx": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ndx/-/ndx-1.0.2.tgz",
|
||||
"integrity": "sha512-/TbqqemJ80lGKRoRuXsz7VgA0erkIxilCUbkMfRL1h2VBGBLGvQnI+FdHvWDqJnUhgOP/T9+SYeWS84wbXGBFA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ndx-serializable": {
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
"flexsearch": "latest",
|
||||
"hasha": "latest",
|
||||
"natural": "^5.1.11",
|
||||
"ndx": "^1.0.2",
|
||||
"ndx-query": "^1.0.1",
|
||||
"ndx-serializable": "^1.0.0",
|
||||
"ndx": "^0.4.1",
|
||||
"node-fetch": "latest",
|
||||
"ws": "latest"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue