blob: bea1216504a201dc327d9f599b553111e063d3b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
let documents = [{
"name": "Lunr",
"text": "Like Solr, but much smaller, and not as bright."
}, {
"name": "React",
"text": "A JavaScript library for building user interfaces."
}, {
"name": "Lodash",
"text": "A modern JavaScript utility library delivering modularity, performance & extras."
}];
function search() {
let searchIndex = lunr(function() {
this.ref("name")
this.field("text")
documents.forEach(function(doc) {
this.add(doc)
}, this)
});
return searchIndex.search("bright");
}
|