Skip to content

Commit

Permalink
read me updated
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenn77 committed Aug 16, 2023
1 parent 94c328b commit 37251fd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,54 @@ module.exports = {
],
}
```
### includeRoutes

You can include only specific routes for search by using this option:

```
module.exports = {
// ...
plugins: [
[require.resolve('docusaurus-lunr-search'), {
includeRoutes: [
'docs/changelogs/**/*', // include only changelogs from indexing
]
}]
],
}
```

### stopWords

You can add stop words(words that are exclude from search result) to the search index by using this option:
You can find the default list of stop words used by lunrjs [here](https://lunrjs.com/docs/stop_word_filter.js.html)

```
module.exports = {
// ...
plugins: [
[require.resolve('docusaurus-lunr-search'), {
stopWords: ['a', 'an', 'the']
}]
],
}
```

### excludeTags

You can exclude certain tags from the search by using this option:

```
module.exports = {
// ...
plugins: [
[require.resolve('docusaurus-lunr-search'), {
excludeTags: ['h3'] // exclude h3 tags from indexing
}]
],
}
```

### indexBaseUrl
Base url will not indexed by default, if you want to index the base url set this option to `true`
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-lunr-search",
"version": "2.3.2",
"version": "2.4.0",
"description": "Offline search component for Docusaurus V2",
"main": "src/index.js",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = function (context, options) {
lunrBuilder.pipeline.remove(lunr.stopWordFilter);
}
const addToSearchData = (d) => {
if (options.excludeTag && options.excludeTag.includes(d.tagName)) {
if (options.excludeTags && options.excludeTags.includes(d.tagName)) {
return;
}
lunrBuilder.add({
Expand Down

0 comments on commit 37251fd

Please sign in to comment.