Skip to content

[ReaderDictionary] offer search with presets when dict fails to find match#14399

Merged
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:fuzzy-preset
Oct 4, 2025
Merged

[ReaderDictionary] offer search with presets when dict fails to find match#14399
Frenzie merged 3 commits into
koreader:masterfrom
Commodore64user:fuzzy-preset

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Oct 2, 2025

Copy link
Copy Markdown
Member

what's new

This pull request refactors and enhances the previous work done in #14343, improving user experience when no results are found. The main changes include the introduction of a unified dialog for alternative search actions, avoidance of code duplication, and better handling of search presets and fuzzy search options.

  • Added a new showNoResultsDialog method to present users with alternative search actions (fuzzy search or preset search) when a dictionary lookup yields no results, streamlining the interaction and reducing duplicated dialog code.
  • Enhanced the preset search flow by extracting dialog construction logic into a reusable showSearchWithPresetDialog method, improving code maintainability and clarity.
  • Refactored the dictionary lookup logic to delegate alternative search options to the new dialog, replacing previous inline dialog construction and callbacks.
  • Updated the dictionary lookup UI handler to use the extracted preset dialog method, further reducing code duplication.

screenshots


This change is Reviewable

@Frenzie Frenzie added this to the 2025.10 milestone Oct 2, 2025
preset_names = Presets.getPresets(self.preset_obj)
end
local current_dict_state = self:buildPreset()
local button_dialog, dialog_buttons = nil, {} -- CI won't like it if we call it buttons :( so dialog_buttons

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.

This isn't true here btw. (And it's a complaint we humans would also have lodged. ;-)

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.

touché, although you should voice your concerns more often then, since historically (in koreader's terms, not like in the iron age) they are always named buttons ;)

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 CI is there so I don't have to, but it only detects things machinally, not outdated comments that should be removed. ;-)

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.

can you re run the CI, why id it fail?

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.

Probably just a busy server.

@Commodore64user

Commodore64user commented Oct 3, 2025

Copy link
Copy Markdown
Member Author

if only @poire-z would look at this PR the way he looks at all the other ones...

@poire-z

poire-z commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

I just can't put myself in your mind full of presets and non-fuzzy searches to appreciate the workflow.
Looks like it doesn't hurt codewise with 2 dedicated functions.
So, fine with me.

@Commodore64user

Copy link
Copy Markdown
Member Author

pretty simple really, if you use fuzzy and have presets, then you get the screenshot on the right hand side, if like me, you have fuzzy off, then the screenshot on the left hand side is it. if you have fuzzy and no presets, then you get the usual quickdict widget saying "no results" and fuzzy off and no presets is just the fuzzy offer from the previous pr.

@Frenzie Frenzie merged commit 99f4eae into koreader:master Oct 4, 2025
4 checks passed
@Commodore64user Commodore64user deleted the fuzzy-preset branch October 4, 2025 11:02
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.

3 participants