Fuzzy Search -- use diff-match-patch or other algorithms

Hi @zhurnaly, the easiest way would probably be to manually overwrite the core shadow tiddlers in your wiki (editing them will overwrite them automatically) with the code from the two files changed with the PR:
TiddlyWiki5/core/modules/filters/search.js at 484acefb29841b75d02bc00bba87683f56fee6d3 · TiddlyWiki/TiddlyWiki5
TiddlyWiki5/core/modules/wiki.js at 484acefb29841b75d02bc00bba87683f56fee6d3 · TiddlyWiki/TiddlyWiki5

However, I must advise against this. wiki.js contains a lot of internal functions that are fundamental to the functioning of TW. By overwriting it, you will no longer get automatic updates with future releases, I also cannot guarantee that I didn’t mess up the legacy search code somehow.

If the PR is not merged (and I don’t think it will be) and if there was enough interest, I might turn it into a plugin for a fuzzy[] search operator that wouldn’t touch any core files and could simply be installed by drag-n-drop.

2 Likes

Hi @Scott_Sauyet, ruminating on it a bit, I was thinking that it might be useful to implement your string similarity calculation in an operator akin to levenshtein that can be used for sorting search results instead of searching directly.

To get a list of approximate results we would still use fuzzy searching with d-m-p or another library and then :sort out or rather :filter out the bad ones with the string similarity score.

I guess I’m looking at making two operator plugins…

2 Likes

That makes sense. I still haven’t investigated how d-m-p does searching. I thought I would do that this weekend, by my wife just reminded me of numerous weekend plans, and I don’t think I’m going to be doing much tech work. At some point…

Yes please.

Best, TiddlyTitch

1 Like

Right. That distinction makes a difference.

TT

yes-yes-yes! – a plugin for fuzzy[] would be incredibly awesome – thank you!

ps if it would help you write the plugin, pls drop me a note (z (at) his (dot) com) so i can buy you more coffee!