Closed aaaaargZombies closed 1 year ago
By default elasticlunr is configured to work with english. There are some other language options available here
But no welsh, this means we should think particularly about stop words we need.
Oh that's very annoying about the Welsh.
In the first instance we maybe hide the search form if Welsh is toggled on?
I've been looking at alternatives and honestly nothing looks like it's going to have purpose built welsh support. I guess shouldn't be a surprise if so much software isn't even built for huge languages like chinese or spanish.
A useful comparison/demo of JS search options https://github.com/fiatjaf/search-comparison
Lunr based looks to be stricter, fuse is more fuzzy. which might be good for people who can't spell plant/animal names perfectly but might also produce more irrelevant results.
questionably named http://www.gaddafipsum.com/ provides welsh gibberish, though it might be better to find some real welsh writing to test with.
Worth asking the discord for suggestions here?
welsh sample text options
@aaaaargZombies Is any of this ready to merge?
@aaaaargZombies I was attempting to verify this as:
I re-jigged your AC into criteria + plan and have come to think that AC you left un-ticked didn't happen.
I'm not marking this as verified because I think the list returned is not always a very good match, so am wondering if we need to look into this a little more? I've not dug very deep, but for example https://team-wilder-proto.pages.dev/guides/making-sure-everyone-can-access-your-group-or-project comes up in a search for climate
and this comes up in a search for woody
https://www.wildlifetrusts.org/actions/reduce-food-waste.
I fee like we should think about improvements to search in the next cycle, but wanted you to verify first what the intent is as it is now. So if you can remember what you think you had working, update the AC here and we can verify as a baseline.
Some more intel on this from discord:
hey all, you can adjust that here https://fusejs.io/api/options.html#distance I left the default. also if it finds no options it doesn't filter but maybe that's misleading...
now the plumbings in place it will probably be a quick fix to switch search libraries, I went for this one based on npm downloads, most recent code contributions and eyeballing the results on the live test I listed in the issue
@undividual I have this to implement
There is some indication of what has been searched for (e.g. text at the top of the page)
Do you have any suggestions about how you'd like it to look. I was thinking of just adding a little subtitle below guides that says something like
Filtering on: XXXX showing NNN guides
We could update the actual guides title to be like
NN Guides on XXX
where X = query string and N = num guides
search accessibility
https://technology.blog.gov.uk/2014/08/14/improving-accessibility-on-gov-uk-search/
- [ ] Search happens when I click submit (arrow? + text)
removed based on conversation in meeting today
Search results are ordered based on how close of a match they are
resulting JSON is in order, in elm it is displaying in alphabetical order of title
Acceptance Criteria
Implementation Notes
[x] use fuse search library based on this comparison test
[x] search result are displayed using one of these methods
we want to include Actions in this search, so this needs doing first: #31
Elasticlunr
http://elasticlunr.com/
from the getting started …
If all the json has uniform fields this will probably work nicely
some elm packages that do search
https://package.elm-lang.org/packages/jxxcarlson/elm-text-search/latest/
https://package.elm-lang.org/packages/jxxcarlson/elm-search/latest/
https://github.com/elm/package.elm-lang.org/ has some sort of search on the side and on the homepage
Fuse (probably the better option?)
https://fusejs.io/
Looks to be more actively maintained than elasticlunr
Search-index
https://github.com/fergiemcdowall/search-index
External JS in Elm
Ports
Web component
Examples