As per the issue on github
- Clone this repo
- run
npm install - run
npm test. The output should ideally only contain English stopwords
As per the issue on github
npm installnpm test. The output should ideally only contain English stopwords| // ref https://github.com/fergiemcdowall/search-index/issues/519 | |
| // run | |
| // > npm init | |
| // > npm install search-index tape | |
| // > node 519.js | |
| const si = require('search-index') | |
| const test = require('tape') | |
| const indexName = '_519' |
| // randomise function | |
| const random = (...list) => list[Math.floor(Math.random() * list.length)] | |
| // create random numbers within a range | |
| const getRandomInt = (min, max) => { | |
| min = Math.ceil(min); | |
| max = Math.floor(max); | |
| return Math.floor(Math.random() * (max - min + 1)) + min; | |
| } |
Here is a little recipe for generating html from github-flavoured markdown. CSS extracted and modified from https://github.com/sindresorhus/github-markdown-css on 22-05-2019. At some point this CSS will probably have to be updated, but for now it works.
Install pandoc 2.x or higher
Save github-markdown.css (below) to ´~/.pandoc/github-markdown.css´
To convert a file called README.md (change as appropriate) run ´pandoc --standalone -c ~/.pandoc/github-markdown.css -f gfm -t html README.md´
| node_modules | |
| sample_index |
| var fs = require('fs'); | |
| var _ = require('lodash'); | |
| var data = JSON.parse(fs.readFileSync('world-bank-projects.json')); | |
| var padInt = function(intIn) { | |
| return ("000000000000000" + intIn).slice(-15); | |
| } | |
| var processDoc = function(datum) { |
| var si = require('search-index')({logLevel:false}); | |
| var fs = require('fs'); | |
| si.replicate(fs.createReadStream('backup1.gz'), function(msg){ | |
| console.log('restored'); | |
| }); |
| var si = require('search-index')({logLevel:false}); | |
| var fs = require('fs'); | |
| si.snapShot(function(rs) { | |
| rs.pipe(fs.createWriteStream('backup.gz')) | |
| .on('close', function() { | |
| console.log('great success dear leader') | |
| }) | |
| .on('error', function() { | |
| console.log('err') |
| {"key":"john","value":"lennon"} | |
| {"key":"paul","value":"mccartney"} | |
| {"key":"ringo","value":"starr"} | |
| {"key":"george","value":"harrison"} |
| C:\Users\fmcdowall>npm install lev -g | |
| npm http GET https://registry.npmjs.org/lev | |
| npm http 304 https://registry.npmjs.org/lev | |
| npm http GET https://registry.npmjs.org/level | |
| npm http GET https://registry.npmjs.org/optimist/0.3.4 | |
| npm http GET https://registry.npmjs.org/deepmerge | |
| npm http GET https://registry.npmjs.org/level-delete-range/0.1.0 | |
| npm http GET https://registry.npmjs.org/tabulate/0.0.1 | |
| npm http GET https://registry.npmjs.org/event-stream | |
| npm http GET https://registry.npmjs.org/reconnect |