You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi 👋, my project uses Material for MkDocs, it looks great and is very practical 😍. However, because the search index is very large, loading an index of 20+ MB is too heavy for some of our users’ devices, so we deployed our own search server to implement server side search.
I learned from #6307 (comment) that native Server-Side Search will be supported in the future, which is fantastic news. But that feature is still under development, so we had to implement a temporary solution ourselves.
Our approach is to modify src/templates/assets/javascripts/integrations/search/_index.ts so that it requests and returns results from our search server.
It does work, but we ran into some problems 😩:
The input box has no debouncing, so if you type quickly it triggers a lot of API calls (especially when using Chinese pinyin input).
Some users habitually finish typing a query and press Enter immediately. Because the server’s response is slower than the user’s Enter, Enter by default selects the top match — but the currently displayed suggestions are from the previous search, so it often navigates to the wrong page.
The search server is asynchronous: when typing something like ssr it may produce results for both ss and ssr. Sometimes ssr’s response arrives first and then the older ss response arrives later, which causes the UI to display incorrect (stale) results.
I know these bugs are caused by my crude and incomplete changes, but could someone teach me how to handle these problems? Thanks 🙏🏼🌟
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋, my project uses Material for MkDocs, it looks great and is very practical 😍. However, because the search index is very large, loading an index of 20+ MB is too heavy for some of our users’ devices, so we deployed our own search server to implement server side search.
I learned from #6307 (comment) that native Server-Side Search will be supported in the future, which is fantastic news. But that feature is still under development, so we had to implement a temporary solution ourselves.
Our approach is to modify
src/templates/assets/javascripts/integrations/search/_index.ts
so that it requests and returns results from our search server.It does work, but we ran into some problems 😩:
ssr
it may produce results for bothss
andssr
. Sometimesssr
’s response arrives first and then the olderss
response arrives later, which causes the UI to display incorrect (stale) results.I know these bugs are caused by my crude and incomplete changes, but could someone teach me how to handle these problems? Thanks 🙏🏼🌟
Beta Was this translation helpful? Give feedback.
All reactions