Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: elasticlunr
node v8.17.0
version:
master
endpoint
share
tweet
var elasticlunr = require("elasticlunr") var index = elasticlunr(function () { this.addField('title'); this.addField('body'); this.addField('section'); this.setRef('id'); }); index.addDoc({ id: 1, title: 'Title', body: 'body body', section: 'whatever' }); index.addDoc({ id: 2, title: 'Another TItle', body: 'face face', section: 'another' }); console.log(index.search('title', { fields: { title: {boost: 2}, body: {boost: 1} }, bool: 'OR', expand: true }));
Created from: https://npm.runkit.com/elasticlunr
Loading…
no comments
sign in
to comment