Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
weixsong authored Jun 14, 2016
1 parent d48abc2 commit 59f5571
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,42 @@ var customized_stop_words = ['an', 'hello', 'xyzabc'];
elasticlunr.addStopWords(customized_stop_words);
```

## 7. Use elasticlunr in Node.js

Elasticlunr support Node.js, you could use elastilunr in node.js as a node-module.

Install elasticlunr by:
```javascript
npm install elasticlunr
```

then in your node.js project or in node.js console:
```javascript
var elasticlunr = require('elasticlunr');

var index = elasticlunr(function () {
this.addField('title')
this.addField('body')
});

var doc1 = {
"id": 1,
"title": "Oracle released its latest database Oracle 12g",
"body": "Yestaday Oracle has released its new database Oracle 12g, this would make more money for this company and lead to a nice profit report of annual year."
}

var doc2 = {
"id": 2,
"title": "Oracle released its profit report of 2015",
"body": "As expected, Oracle released its profit report of 2015, during the good sales of database and hardware, Oracle's profit of 2015 reached 12.5 Billion."
}

index.addDoc(doc1);
index.addDoc(doc2);

index.search("Oracle database profit");
```

# Contributing

See the [`CONTRIBUTING.mdown` file](CONTRIBUTING.mdown).

0 comments on commit 59f5571

Please sign in to comment.