vantagedesign / ace-documentation

A free documentation theme for Hugo, powered by Bootstrap 4. Repsonsive, search, code highlighting and more.
https://docs.vantage-design.com/ace/
MIT License
103 stars 75 forks source link

local search: download the search database (index.json) on demand #25

Closed sumpfralle closed 3 years ago

sumpfralle commented 3 years ago

Previously the search database (index.json) was always downloaded for every page request (or maybe less due to caching). Now it is downloaded only after the search form field received the "focus" event.

Benefits:

Drawbacks: There is a small delay between the user entering the input field and the indexing database being ready. For all but the most rare circumstances, the download and indexing initialization will be finished before the user entered three letters (the default minimum lenght for input to be handled by the autocompletion). If the user's input really arrived before the indexer is ready (e.g. due to pasting input), then the user needs to add or remove another character before the autocompletion results appear. This is probably an acceptable and intuitive behavior for most users.

julianflapper commented 3 years ago

Seems good, thanks. I agree that search with a small delay is fine.