mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:45:08 +00:00
Help: Perform a fuzzy match on the page title when searching
This allows for slight misspellings to still return a result.
This commit is contained in:
parent
d1b5eec154
commit
a042c4e93d
1 changed files with 3 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "ManualModel.h"
|
||||
#include <AK/FuzzyMatch.h>
|
||||
#include <AK/Try.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibManual/Node.h>
|
||||
|
@ -213,7 +214,8 @@ TriState ManualModel::data_matches(const GUI::ModelIndex& index, const GUI::Vari
|
|||
if (!name.has_value())
|
||||
return TriState::False;
|
||||
|
||||
if (name.value().bytes_as_string_view().contains(term.as_string(), CaseSensitivity::CaseInsensitive))
|
||||
auto match_result = fuzzy_match(term.as_string(), name.value());
|
||||
if (match_result.score > 0)
|
||||
return TriState::True;
|
||||
|
||||
auto path = page_path(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue