Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[local search] indexing too slow to be usable for large sites #3377

Closed
4 tasks done
zhangyx1998 opened this issue Dec 26, 2023 · 0 comments · Fixed by #3374
Closed
4 tasks done

[local search] indexing too slow to be usable for large sites #3377

zhangyx1998 opened this issue Dec 26, 2023 · 0 comments · Fixed by #3374
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@zhangyx1998
Copy link
Contributor

zhangyx1998 commented Dec 26, 2023

Describe the bug

I am trying to convert an ancient documentation site into vitepress. The volume is very large (a lot of of pages, and many of them has very long content).

I waited for more than 4 hours to build my site with local search enabled. I would have to wait for the same amount of time to launch a dev server.

Unfortunately, although the build finished without any error, the rendered search index was empty. This is caused by another problem: the local search plugin use one regex to find headers, and another regex to remove tags. Which works only if the html is directly parsed from markdown, and is very likely to fail upon embedded html (or vue template).

In addition, if you've looked at the outputs from PR #3374, you might have already noticed that each file was indexed twice for each build. That doubles the wait time.

Reproduction

  vitepress v1.0.0-rc.32

⠹ building client + server bundles...
(!) Some chunks are larger than 500 kB after minification. Consider:
 - Using dynamic import() to code-split the application
 - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
 - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
/Users/Yuxuan/Lab/xorg-doc/docs/index.md
✓ building client + server bundles...
✓ rendering pages...
- build complete in 16008.00s.

16,008 seconds = 4.45 hours

Expected behavior

  1. Index faster.

  2. No double indexing for same source file.

  3. When splitting page into sections, match headers more robustly.

System Info

Not relevant

Additional context

Solution to improve performance provided here: #3374.

I want to discuss with a maintainer before proceeding to port the improved section-splitter implementation.

Also, I can provide a fix to the following issue after some discussion with maintainers:

  1. On dev server, only provide the search-index when the search box is focused (expanded), and show a loading indicator in the search dropdown before indexing completes. In this way the indexing process will not block dev preview.

  2. Fix the double indexing problem so large sites will build faster.

Validations

@zhangyx1998 zhangyx1998 added the bug: pending triage Maybe a bug, waiting for confirmation label Dec 26, 2023
@zhangyx1998 zhangyx1998 changed the title local search too slow to be usable for large sites [local search] indexing too slow to be usable for large sites Dec 26, 2023
zhangyx1998 added a commit to zhangyx1998/vitepress that referenced this issue Dec 26, 2023
zhangyx1998 added a commit to zhangyx1998/vitepress that referenced this issue Dec 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant