Skip to content

[ReaderDictionary] Offer fuzzy search when dict query fails [to find a match] - #14343

Merged
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:offer-fuzzy
Sep 19, 2025
Merged

[ReaderDictionary] Offer fuzzy search when dict query fails [to find a match]#14343
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:offer-fuzzy

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Sep 17, 2025

Copy link
Copy Markdown
Member

what's new

  • When a dictionary lookup finds no results and fuzzy search is not already enabled, KOReader now offers the user an offer they can't refuse, the option of performing a one-time fuzzy search.
  • The logic for handling lookup cancellation has been refactored into a local function (lookupCancelled) to avoid code duplication and improve readability. This function is now used both when a lookup is interrupted quickly and when the user cancels the fuzzy search prompt.
name

related issues


This change is Reviewable

@Commodore64user Commodore64user changed the title [ReaderDictionary] Offer fuzzy search when dict query fails [ReaderDictionary] Offer fuzzy search when dict query fails [to find a match] Sep 17, 2025
@Frenzie
Frenzie requested a review from poire-z September 17, 2025 14:49
@poire-z

poire-z commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Fine with me.
Does it really make sense to propose via a popup, instead of just going to do it ?

@Commodore64user

Copy link
Copy Markdown
Member Author

it's called consent @poire-z, get on with the times ;)

"why not just do it?" why not just have fuzzy always on then?

@poire-z

poire-z commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

"why not just do it?" why not just have fuzzy always on then?

That's what I have set up - so I can't say why not :)
Dunno how fuzzy search works when there is an exact match - does it bring more "fuzzy" results ?
I meant that if there is not exact match, the user would always expect to do fuzzy search and see something. Or is worthy to tell there is no exact result, and ask if you want to do a fuzzy search - would someone really stop at no result and don't wish for a fuzzy search that may bring something related ?

it's called consent @poire-z, get on with the times ;)

Complications...

@Commodore64user

Copy link
Copy Markdown
Member Author

if I accidentally start a query (which happens more often that I am willing to admit), and get that prompt, I would surely want to cancel, so there are times where I'd like it to stop yes.

@mergen3107

Copy link
Copy Markdown
Contributor

I am also having fuzzy on at all times, but I would imagine if someone has it off, they might become mildly annoyed by these popups at every search.

I would think about adding an option "Offer fuzzy search if nothing found" (or something like that) in the top menu settings, right next to the fuzzy search toggle itself. Grayed out if fuzzy search is on, of course, but otherwise available (as disabled by default?).

@poire-z

poire-z commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

When that happens to us, we just tap to cancel :) which one could still do at any point in this PR no ?
If you accidentally start a search, I think you don't really need to know there was or not a exact match.
For non accidental searches, I guess you'd like to know if there was an exact match - but can't you guess that from the time it will take to display a result ? I guess with exact search, you're used to getting it immediatelt. If not, I guess you can assume it is doing a fuzzy search, and you could tap to cancel.

@Commodore64user

Commodore64user commented Sep 17, 2025

Copy link
Copy Markdown
Member Author

but @mergen3107 that is exactly what is happening here, if no matches, we offer fuzzy, if your dict finds a match, you won't see the prompt.

I sometimes try to cancel, but it is already too late, my fingering [speed] is not what it used to be ;)
as a user, I like to know if my dictionary is the real deal or a wimpy one that needs help, joke aside, it conveys the information to the user... I think that is valuable

@mergen3107

Copy link
Copy Markdown
Contributor

exactly what is happening here, if no matches, we offer fuzzy, if your dict finds a match, you won't see the prompt

I am talking about when no results were found and the user wants no prompts whatsoever.

Case: when you are a linguist and you know exactly what you are looking for. If you didn't find it, you want to start another exact word search immediately after that

Comment on lines +1243 to +1250
UIManager:show(ConfirmBox:new{
text = _("No results were found. Would you like to perform a fuzzy search?"),
ok_text = _("Search"),
ok_callback = function()
self:stardictLookup(word, dict_names, true, boxes, link, dict_close_callback)
end,
cancel_callback = lookupCancelled,
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of a ConfirmBox it'd be nicer to show the prefilled search dialog (with an added fuzzy checkbox, perhaps prechecked in this case).

You maintain the ability to cancel while also gaining the ability to immediately shorten épuisantes to the headword épuisant.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

At first i thought, oh no, why didn’t i think of this? But now I’m wondering, but there is a keyboard to deal with now…

@Commodore64user Commodore64user Sep 18, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not too sure about it...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The left is more consistent. Just shorten the hint text a bit.

No results. Retry as fuzzy search?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Screenshot 2025-09-18 at 11 54 42

what about this? the description, really doesn't look good at all...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Just wondering: is this Window title "Fuzzy search" ok, for something that pops up when no results and we have not yet done a fuzzy search ? Shouldn't it be just "No results" ?)

@Commodore64user Commodore64user Sep 18, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

which one? I can only see a ? so not sure which of the two you are highlighting

Screenshot 2025-09-18 at 12 36 41

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The last one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Screenshot 2025-09-18 at 15 09 12

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fine by me.

@Frenzie

Frenzie commented Sep 17, 2025

Copy link
Copy Markdown
Member

I am talking about when no results were found and the user wants no prompts whatsoever.

Aren't you just describing a less efficient regular fuzzy search. ;-) Which does something similar, but without starting up, returning results and starting back up again.

@mergen3107

Copy link
Copy Markdown
Contributor

Nope. I am talking about

  • if you didn't find the word - fine, go for the next one (do not modify existing one)

@mergen3107

Copy link
Copy Markdown
Contributor

All I am saying is that this new feature needs to be guarded behind a setting, turned off by default. Otherwise people who got used to it will find it annoying :D

Or you guys better have them come back and complain about it themselves anyway?

@Commodore64user

Copy link
Copy Markdown
Member Author

On mobile atm, so can't answer all, but this seems to have gone from hypothetical to real pretty quick, name and shame, who is the alleged linguist?

@mergen3107

Copy link
Copy Markdown
Contributor

I've seen a couple on discord (Kindle Modding Community) and reddit. They were sharing linguistic-specific dictionaries :D with like, all forms and kinds for each word

Lingvo-nerds

@Commodore64user

Copy link
Copy Markdown
Member Author

I was bracing myself for the big reveal, but then i was slightly disappointed 😞. I think you might be giving agency to some imaginary “linguists” here, i’m happy to hear them complain first ;). In all seriousness, not getting results is unusual so is unlikely to be something that would annoy any wanna be linguist out there.

@Commodore64user

Commodore64user commented Sep 17, 2025

Copy link
Copy Markdown
Member Author

what I would like to get to the bottom of, is why do you regard these "linguists" with such disdain and contempt? Surely you realise, someone is out there saying... look at those koreader nerds over there, writing their own app and all, could they be any nerdier? ;) We need to learn not to thrown stones from the confines of our own glass house...

@mergen3107

Copy link
Copy Markdown
Contributor

I know only 4 linguists in real life (none of them know about ereaders), and I have hard time talking to them (such an irony), maybe that's why I can't hide my feelings :D

@Commodore64user

Copy link
Copy Markdown
Member Author

@poire-z ?

@Frenzie
Frenzie merged commit 65de86a into koreader:master Sep 19, 2025
4 checks passed
@Frenzie Frenzie added this to the 2025.10 milestone Sep 19, 2025
@Commodore64user
Commodore64user deleted the offer-fuzzy branch September 19, 2025 22:28
@Commodore64user

Copy link
Copy Markdown
Member Author

I was thinking this morning, mmm... why didn't i add presets to this as well? Since it seems that is the correct path forward, look forward to it ;)

0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants