Skip to content
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

Implement a search #203

Open
stefanjudis opened this issue Feb 26, 2020 · 7 comments
Open

Implement a search #203

stefanjudis opened this issue Feb 26, 2020 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@stefanjudis
Copy link
Owner

After discussing the possibility of an in-page search (#61), it can now be added. :)

Requirements for a search are that it's:

  • accessible
  • reflected in the URL
  • in best case works without JS
@stefanjudis stefanjudis added the help wanted Extra attention is needed label Feb 26, 2020
@JonUK
Copy link
Contributor

JonUK commented Feb 26, 2020

  • in best case works without JS

Do you mean you would ideally like some server-side logic to execute so the server can dynamically render the page with filtering already applied?

Given most / potentially almost all of the tools listed on the page utilise JavaScript to actually work and this page is developer focussed, is it likely that people won't have JS enabled? Perhaps a progressive enhancement approach could be used so you only see the search capability and therefore can only use search if JS is enabled?

I have a basic site that uses Eleventy so have some knowledge of the tech and would like to help with this feature if I can... seeing I've kept on going on about it! :)

@stefanjudis
Copy link
Owner Author

@JonUK Thank you for the open discussion and the offer to help and join the party! 🎉🙇‍♂️

in best case works without JS

Sorry, that was poorly phrased. Let me explain. 🙈

I'm not against a JS search, and I think you're right that almost everybody has JS enabled these days. But I'd love to implement a search "that just works" – no matter what. Let me dig deeper a little what I have in mind. :)

The improvements I see for the in issue #61 mentioned frontend masters search are the following:

  • it is not reflecting the search query in the URL – ideally, it would do that to share queries. Tiny helpers seem to grow and grow, and that would be nice for the future.
    • if it's reflecting the search query then some server logic would be needed I guess?

The ideal state, in my opinion, is an approach like you see on perf-tooling.today. The search works client-side, updates the URL, shows the correct results immediately on refresh and works even when JS is pending or broken. It just works. :)

Perhaps a progressive enhancement approach could be used so you only see the search capability and therefore can only use search if JS is enabled?

Yay, I'm all up for PE (progressive enhancement). :) Question is then, how to handle the updated URL, though. I'm up for ideas. :)

I hope that all makes sense, and thank you again!

@JonUK
Copy link
Contributor

JonUK commented Feb 27, 2020

So I think the main Q is whether server-side rendering is used so the initial HTML page response from the server is rendered with just the filtered items (probably by hiding via CSS the non-matched items) based on the query string param.

Using a JS only approach, we could still read the query string param and hide the non-matches so the page could render in the same way as server-side rendering but this wouldn't work if JS was actually disabled. With HTML5 History API / pushState we should be able to change the query string when a new search term is entered (without performing a full page reload).

@JonUK
Copy link
Contributor

JonUK commented Mar 9, 2020

I've worked on a bare-bones implementation of client-side searching
#221

Deployment links with example queries
https://tiny-helpers-5k7727egl.now.sh/?q=hash
https://tiny-helpers-5k7727egl.now.sh/?q=pwa

It's still work in progress but if this is an approach to go forwards with then let me know. Any feedback welcome.

@stefanjudis
Copy link
Owner Author

Nice! Thank you so much @JonUK. I'll have a look at it tmrw then! 🙇🏻‍♂️🎉

@stefanjudis
Copy link
Owner Author

Oh man, I'm so sorry Jon. The PR is high on my todo-list. Sorry. :/

@ndom91
Copy link
Contributor

ndom91 commented Jul 12, 2022

Came across this other self-hostable web search plugin. Based on Rust (wasm) + JS. Stork-Search.

Think its all client-side as well though..

EDIT: Another one 😂 - https://pagefind.app/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants