Skip to content

Conversation

martakam
Copy link
Member

@martakam martakam commented Nov 5, 2026 •

This PR adds fuzzy matching whenever there are no results in the book page. This allows us to show real suggestions, because the search hary poter shows Harry Potter books as suggestions. Fuzzy matching is explained a little more in the issue #92.

Some of the code in this pull request has been created with the assistance of AI.

To be merged after #91, because this PR builds upon that one.

Closes #92

@martakam martakam added the enhancement New feature or request label Nov 5, 2026
@martakam martakam added this to the Deliverable 4 milestone Nov 5, 2026
@martakam martakam self-assigned this Nov 5, 2026
@martakam martakam requested a review from a team as a code owner November 5, 2026 20:27
@martakam martakam changed the title feat: show similar books using fuzzy matching when no results feat: show similar books using fuzzy matching when no results found Nov 5, 2026
hestro
hestro previously approved these changes Nov 7, 2026
Copy link
Member

@hestro hestro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a very nice addition, and it makes searching for books a much better experience!

One small thought from testing: when I search for “hary poter”, showing “No books found for this search” and “Books with similar titles” feels a bit unnecessary, since the suggestions are clearly what I was looking for. Also, only 12 books are shown with no pagination, which is a bit annoying since you wanted Harry Potter books and there are more than 12 of them.
At the same time, “No books found for this search” works well when the query is quite different from a title and not just a very small typo.

I have no idea if this can be fixed in a good way. I'll still approve since the experience works well as it is, so these are just small things I noticed.
(I hope this makes sense, it was a bit difficult to describe)

@martakam
Copy link
Member Author

martakam commented Nov 7, 2026 •

Alright, this was quite difficult to get right.

I want to (a) let users know we have this functionality, while (b) not taking up too much of the screen space and (c) not being distracting. I think I managed to achieve this combination a little better now.

The big title is removed and kept only for screen readers (for accessibility). Also, pagination is always on, and sorting can be chosen only if we get some similar results based on the title. The top-rated books have a predefined sorting (best ratings), so it does not make sense to give the user an option to change this.

Copy link
Member

@hestro hestro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This solves exactly what I was talking about. The balance between the factors mentioned is well calibrated now.

I agree that sorting only makes sense when the results come from a search with similar results based on the title

@martakam martakam merged commit c25ca82 into main Nov 7, 2026
@martakam martakam deleted the feat/fuzzy-searching branch November 11, 2026 21:59
Sign in to join this conversation on GitHub.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add fuzzy matching so typos and similar mistakes are handled
2 participants