Ask HN: What's the best way to add search to my website?

by lucgaganon 10/9/2023, 3:02 AMwith 12 comments

I have a quite unique website https://ray.run/

I tried to create a website like the ones I remember browsing back in early 2000s. It has questions from the users, discord forum archive, dev tools, videos, etc.

I want to find a way to add search for users. I see it on the other websites, and usually they use Algolia. However, my community is entirely free and their product is paid. What can I do instead?

by rovr138on 10/9/2023, 3:40 AM

Add a search box, on submit, open a new tab with 'site:ray.run'. You can do this on Google or DuckDuckGo,

- https://duckduckgo.com/?q=site%3Aray.run+playwright+test&t=f...

- https://www.google.com/search?q=site%3Aray.run+playwright+te...

Keep it simple for now.

by fabianholzeron 10/9/2023, 8:43 AM

If your content is mostly static, you might want to consider pre-building an index and shipping it as a whole. You could look into something like

* https://stork-search.net/ (Rust/WASM)

* tinysearch: https://github.com/tinysearch/tinysearch (Rust/WASM)

* https://lunrjs.com/ (JS, simple, stable)

* http://elasticlunr.com/ - based on the former, slightly more sophisticated tuning options

by ezedvon 10/9/2023, 2:05 PM

Your website https://ray.run/ does have that nostalgic early 2000s vibe, which is cool! Regarding the search functionality, you might want to explore open-source alternatives to Algolia.

Projects like Elasticsearch, Solr, or even using Google Custom Search can provide search capabilities without the cost. They might require a bit more setup and maintenance, but they can be budget-friendly options for a free community.

In case you need help or assistance with your project, feel free to contact us! https://www.ratherlabs.com

by james-revisoaion 10/9/2023, 10:00 AM

This thread makes me feel old... I remember seeing "Google Custom Search" with Custom Search in grey on so many websites just maybe 12-15 years ago - for it to be so unusual that people on HN don't tend to know of it, seems so odd...

by lucgaganon 10/9/2023, 3:04 AM

Looks like Google has a way of doing it https://programmablesearchengine.google.com/controlpanel/cre...