-
-
Notifications
You must be signed in to change notification settings - Fork 736
search: very slow and inefficient index initialization #739
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
Comments
Thanks for the report @evil-shrike. It'd be great to improve this. PRs are welcome 😄 |
@aciccarello the problem is that search consists of two parts separated between different repos as I understand: Given the fact that search index is being created in a plugin ( interface SearchResult {
title: stirng; // page title where term was found
text: stirng; // text where term was found
url: string; // page url to go
}
init(): Promise;
search (term: strung): Array<SearchResult>; that |
Also it's just a side note, let me suggest to look at docfx implementation of searching. It's really awesome as it builds lunr index in background (via WebWorker) - see https://github.com/dotnet/docfx/blob/dev/src/docfx.website.themes/default/styles/search-worker.js |
With #1252 we build the index at documentation time :) |
Hi.
I have an index (search.js) with 35K rows (9MB). It takes more than 35 seconds to initialize. So user have to click in search field and wait for half a minute. Obviously it's ridiculous.
I looked up into the code where index is being initialized. It seems it's very inefficient.
I understand that you're trying not to block ui thread splitting work on tasks being executed via
setTimeout
. But the end result is not good.But besides that why do you add every rows via
Index.add
?Lunr Index has
load
method - https://lunrjs.com/docs/lunr.Index.html which should be MUCH faster. All we need is just to build a proper serialized index during building stage instead of that custom structure with rows.I have search on one of my static doc site with lurn, and 8MB lunr-index initialized pretty fast.
(pageIndex is a custom structure for mapping urls to titles)
The text was updated successfully, but these errors were encountered: