-
Notifications
You must be signed in to change notification settings - Fork 858
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
[Feature Request] Add option to debounce keystrokes in API search #10043
Comments
Just as a point of reference, what is the size of the I thought current docfx
I've tested before to switch search engine from Demo Site Custom template to change search backend to pagefind The advantages of using Pagefind include.
|
Are you sure you meant There is no I'll see if I can find some time to try out that pagefind-based search template. Perhaps if it's "just generally superior" to Lunr without any downsides then perhaps DocFx could adopt it officially as a default. |
That said, for at least one concern listed:
Apparently this can already be solved in Lunr, it just needs to be configured. |
Sorry for the confusion. |
Hmm, we don't have an The only files which are generated into the root of
I've had a look at some of the subfolders and there's no |
I've tried This file is generated by Is it able to test following steps?
|
Interesting, on a blank project it is generated but on our main solution's docco project it does not. I compared the
I suspect that this is because our config file was generated from an older version of docfx. I guess the default behaviour changed over time, we upgraded versions and left our config file unchanged. If there was a docco/release note saying "Please review/regenerate your config because things changed" then we didn't spot it. Anyway, I'll review that |
@filzrev I have updated our config, thanks for leading me to discover that it was outdated/malformed. Our docco site has done a full CI and re-published internally. An |
Thanks for your confirmation. I'm also tried to reproduce problems on local environment. And the following results were obtained.
|
Is your feature request related to a problem? Please describe.
I use DocFX to generate the docs for a very large solution with a huge API. I like the API search feature in the template but when typing a search string, due to the size of the searched code, this introduces high web browser CPU usage and freezes my browser UI for a few seconds. I appreciate that it's probably not possible to simply make the search quicker but I noticed that the search seems to begin the very moment I type the first character of my search string. That seems to be wasting compute resources performing a search which is going to be discarded. It also means I can't see the rest of characters I'm typing into the search text box until the search has completed. Sometimes that means I have to use backspace and correct typos, triggering more wasteful search operations.
Describe the solution you'd like
I'd like a template option, likely alongside
_enableSearch
which is of type nullable integer. Ifnull
then the behaviour is as the template currently functions; the client side logic begins searching as soon as a character is received in the textbox. If not null and a positive integer is specified then this is the number of milliseconds that the input is debounced before a search begins. Obviously a negative integer here is nonsense; it should either be treated the same as null or should raise an error, as appropriate to DocFx's conventions.A default value of
null
seems sensible, to maintain the current behaviour, for small-to-medium sized solutions. In my solution, I would try an initial debounce-timer of around 350ms. That seems long enough that someone who is typing - and knows what they are typing - can likely type it all without triggering wasteful searches. It should be short enough though, that they aren't frustrated waiting for it.Describe alternatives you've considered
In truly large projects I imagine that the entire search functionality should be moved server-side with a completely custom impl that is outside the scope of DocFX. We don't have the capacity/motivation to do that.
I suppose I could work around the problem by copy-pasting my search term into the search text box, but that is not as convenient.
Additional context
For reference, this is the API search tool I'm referring to.
The text was updated successfully, but these errors were encountered: