downforacross / downforacross.com

Web frontend for downforacross.com -- continuation of stevenhao/crosswordsio
https://downforacrosscom.downforacross1.now.sh
MIT License
229 stars 91 forks source link

Use a tokenizing filter #117

Closed multimeric closed 3 years ago

multimeric commented 3 years ago

Instead of the current (confusing) filter behaviour, we instead:

Then, each token must be present within the (lowercase) author name, or puzzle title or it is filtered out.

This is a draft PR until I can actually test it (see #116)

Closes #92.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/downforacross/downforacrosscom/795gaqo9x
✅ Preview: https://downforacrosscom-git-fork-tmiguelt-token-search.downforacross1.vercel.app

stevenhao commented 3 years ago

Love this, fully support the idea! You should be able to test this without running a local backend, since filtering is done client-side.

You can also test on the autodeploy links posted by vercel: https://downforacrosscom-git-fork-tmiguelt-token-search.downforacross1.vercel.app.

multimeric commented 3 years ago

You can also test on the autodeploy links posted by vercel: https://downforacrosscom-git-fork-tmiguelt-token-search.downforacross1.vercel.app.

I tried that, but as in the other issue, I'm not able to actually upload puzzles to the site. And the puzzle list is empty, so I can't really test out this behaviour.

multimeric commented 3 years ago

And... now they're all visible. I have no idea what was going on there.

stevenhao commented 3 years ago

image sweet, going to merge this. maybe a follow-up can be highlighting the parts of the puzzle that matches the search term.

multimeric commented 3 years ago

I suppose there's some argument for supporting search quotes, such that "LA Times" will only return that substring, and not "la" somewhere in the text and "times" somewhere in the text. But it depends on how you want the search to work: as a Google-esque plaintext search that implements features via search syntax, or as a kind of form with lots of fields that you can tweak.

This question also matters for the other thing search is missing: searching by date. Under the plaintext system you might type date:2020-07-22, whereas a form-based search might have a calendar popup for this purpose.

stevenhao commented 3 years ago

Yeah, I like the idea of coming up with a more powerful syntax -- something like gmail's operators.

Another extension would be to hold the filter state (the Size / Status checkboxes) in the search bar itself, so checking & unchecking would just insert/delete search terms.

Another extension would be to persist search state in the url bar, so you can bookmark URLS like "Unsolved Monday Puzzles".

multimeric commented 3 years ago

That all seems quite doable. I wonder if there's a React or vanilla JS library that provides a framework for implementing an operator search like this. I can't find one, but admittedly it wouldn't be so hard to do manually.