dotnet / dotnet/docfx

search within ~10 seconds of page load is very slow

Open
#4,751 7 comments 10 reactions 0 assignees View on GitHub
search
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 9m
Merged PRs (30d)
11

Description

**Operation System**: (`Windows` or `Linux` or `MacOS`)
Windows
**DocFX Version Used**:
All of them
**Template used**: (`default` or `statictoc` or contain custom template)
default
**Steps to Reproduce**:

1. browse to https://aka.ms/kusto
2. any search within the ~10 seconds of page load will return only after 10 seconds passed from time page loads.

**Expected Behavior**:
wait less than a second.
This is _very_ common in documentation websites to load the page and the immediately search.
**Actual Behavior**:
wait for more than 10 seconds

Looks like the issue is that lunr.js is building the index on-the-fly on page-load in a search-worker.js.
but this is a static website - the index can be persisted and then just loaded instead of building an index every time.

[here](https://lunrjs.com/guides/index_prebuilding.html) is documentation on that from lunr.js website on how to use pre-build indexes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.