News for hackers. Stuff that matters.
Re:How MDN's Autocomplete Search Works by winrid on Tuesday August 03, 2021 @02:44PM (#28052642)
We took a similar approach for our documentation search. [0]

You can see the "inverted index" is rendered inline in the page, since everything is generated at build time.

When you type something that matches a key in the index, we fetch that index key and add it to the results. [1] [2]

Obviously we could do a lot better in terms of relevancy, but it's simple and fast.

[0] https://docs.fastcomments.com/

[1] https://docs.fastcomments.com/index-ublJLBnXgz88.json

[2] https://github.com/FastComments/fastcomments-docs/blob/main/...

Re:How MDN's Autocomplete Search Works by peterbe on Tuesday August 03, 2021 @04:11PM (#28053562)
Relevancy is the huge game-changer. MDN uses pageviews analytics to determine was a "popular" age is.
Re:How MDN's Autocomplete Search Works by winrid on Tuesday August 03, 2021 @04:22PM (#28053672)
Indeed, that's a great idea.