praveenn77/docusaurus-lunr-search

Lunr indexing 0 files out of 100

romainbou opened this issue ยท 12 comments

Lunr doesn't index any files out of my docs folder .md files

I have about 98 .md files in my docusaurus site:

> find docs/ -name '*.md' | wc -l
98

When I docusaurus build the site. it shows:

[INFO] [en] Creating an optimized production build...
[...]
docusaurus-lunr-search:: Building search docs and lunr index file
docusaurus-lunr-search:: Start scanning documents in 16 threads
docusaurus-lunr-search:: Indexing time: 454.61ms
docusaurus-lunr-search:: indexed 0 documents out of 100
docusaurus-lunr-search:: writing search-doc.json
docusaurus-lunr-search:: writing search-doc-1644309064310.json
docusaurus-lunr-search:: writing lunr-index.json
docusaurus-lunr-search:: writing lunr-index-1644309064310.json
docusaurus-lunr-search:: End of process

I do have broken links in my Markdown files, could this affect lunr indexing?

[WARNING] Docusaurus found broken links!

I'm using the following versions

@docusaurus/core@2.0.0-beta.15
docusaurus-lunr-search@2.1.15

My configuration in docusaurus.config.js is simply:

// ...
  plugins: [
    [
      'docusaurus-lunr-search', {
      }
    ]
  ],

Any idea what could cause this? Let me know if you need more info to reproduce it.

I've got the same issue. Did you end up finding what the problem was?

I actually tried again, and the issue seems fixed in the current master with commit 0f83df1 ๐Ÿ‘
I got the issue with the v2.1.15. So I guess it will be solved once a new release is done.

Awesome, thanks, fixed my issue too.

Had the same issue which was fixed by @romainbou's work around. Hopefully a release is coming soon! Thanks

Release done v2.1.16

I'm still getting this issue on 2.1.16

docusaurus-lunr-search:: Building search docs and lunr index file
docusaurus-lunr-search:: Start scanning documents in 12 threads
docusaurus-lunr-search:: Indexing time: 390.406ms
docusaurus-lunr-search:: indexed 0 documents out of 237
docusaurus-lunr-search:: writing search-doc.json
docusaurus-lunr-search:: writing search-doc-1661315689657.json
docusaurus-lunr-search:: writing lunr-index.json
docusaurus-lunr-search:: writing lunr-index-1661315689657.json
docusaurus-lunr-search:: End of process
"dependencies": {
    "@docusaurus/core": "^2.0.1",
    "@docusaurus/plugin-client-redirects": "^2.0.1",
    "@docusaurus/preset-classic": "^2.0.1",
    "@mdx-js/react": "^1.6.22",
    "clsx": "^1.2.1",
    "docusaurus-lunr-search": "^2.1.16",

i am getting this issue now.. hmmm

i fixed it for my fork. thx though. i think you might want to check your code as well. it tries the url with

route/.html <- this like.
missing the index in the front.

@bclabs-kylian I'm able to confirm 2.1.16 does not fix the issue when using the trailingSlash option in docusaurus.config.js. I just submitted a PR (#86) to handle that case.
cc: @praveenn77

Thanks for the @davidmarquis, new version 2.2.0 is published

After the release of 2.2.0, the issue still persists for my project -
docusaurus.config.js:

module.exports = {
  trailingSlash: undefined, // trailing-slash is unset
}

Let's say my docs folder looks like this:

- overview
| - overview.md
| - contact.md

After docusaurus build, the build folder looks like this:

- build
| - docs
| | - overview
| | | - index.html
| | | - contact
| | | | - index.html

the routesPaths passed through the postBuild function in index.js is:

[
  "/baseUrl/overview",
  "/baseUrl/overview/contact",
]

The 2.2.0 version can correctly link /baseUrl/overview to /build/docs/overview/index.html; but it is not able to link /baseUrl/overview/contact to /build/docs/overview/contact/index.html.

anyway, i am using my own folk for now :) but hope it gets fixed here.

anyway, i am using my own folk for now :) but hope it gets fixed here.

@bclabs-kylian how did you fix this problem?