-
-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: better fuzzy matches #1238
Conversation
Thanks for the PR, it is easy to see what have been done, comment etc... IIUC the point of this PR is to take in account the separators in matching regexp. |
Thanks for reviewing, clearly I should have given you a branch to begin with so review is easier. I'll remember that in the future. As for "more efficiently" see my response above, I think you missed something crucial about I'll look into |
That's only half of it and part of the reason why For example, the top result helm currently returns for That's a terrible fuzzy match. |
@thierryvolpiatto Here's the To enable us to find really "good" candidates before the general pass, we pin a new slot on the source called This is still not meant to be merged, it's just an example to see what you think about doing For anyone following along, this is currently only enabled for the "Emacs Commands" source. |
Even better matches now with a tweaked regex, |
Better fuzzy matches implemented for all describe-* functions (in-source-buffer), |
Alfred Kapote notifications@github.com writes:
I don't think doing two passes is a good thing, it will alter Keep in mind that for fuzzy matching, the difficult part is finding the |
Alfred Kapote notifications@github.com writes:
Depend, maybe yes, maybe no, if you focus on elm=emacs-lisp-mode, yes it e.g "emlsp" => emacs-lisp-mode. |
Yes, but slower isn't itself a problem only "too slow" and it should be an opt-in thing like fuzzy matchng anyway. My cpu isn't very fast and for me this is acceptable even in apropos with 10k+ entries.
I don't see why. Constructing the regex happens once after a query is updated, when the closure is constructed. Do you mean something else?
Absolutely, otherwise you could simply use the score function over all candidates. But, I would add
Sure It works for some queries but also often enough it doesn't do what I expect. The problem is I'd like helm to guess what I'm thinking more of the time and I think this demo shows this could Also, I would love to do the same kind of "preferred-matching" for "EMacs-Lisp-Mode" but I think the regex for all combinations will be too slow. |
@thierryvolpiatto, not sure if this is what you meant with "regex caching" but if it was, it's a good idea. Once a scan of all candidates for This doesn't make a huge difference afaict (it seems fast enough already) but maybe it will for some queries. Please consider cherry-picking: |
Cleaned up. Much smaller patch now and there's no longer a need to modify the existing sources. |
(defun helm-match-from-candidates (cands matchfns match-part-fn limit source) | ||
(let (matches) | ||
|
||
(defun helm--mapconcat-initials-pattern (pattern seperators) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this pattern is so restrictive?
If this is a preliminary filtering step, then inserting ".*" in between characters should be enough. Is there benchmarking to prove this is necessary?
The more candidates flx sees the better your results will be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you're suggesting I've already covered in the original issue #1237, please read it.
Also, Inserting greedy matching operators can and will drop the best match from the list in some cases.
The more candidates flx sees the better your results will be.
Right, but I've had to set the limit at 2500 at one point to get the matches I wanted, perf was acceptable but not great and ocassionaly caused long GCs (yes, I know about the GC tuning you recommend). Most of that work is completely unnecessary - ranking 2000 poor quality "matches" with a complicated lisp function to get the one I want is inefficient.
As for benchmarks, if you think this can all be handled by flx directly I'd love for you to finish that implementation and make all this work obsolete. For now, this is better than any other solution available for helm afaik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is designed to not need flx? That's really interesting. I will follow along and see how it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it works best as a companion to helm-flx
. The idea is to keep the number of matches sent to flx
small-ish while trying harder to have the best candidates included in those flx
gets to see.
You could use the latest iteration of the regex to replace helm's stock one for fuzzy matching
and even without flx it should work quite well. I haven't tried it though.
Turns out this works just fine after all, so I've added a new knob to trade off speed for accuracy.
I don't notice a slowdown even with this on and it seems to work fantastically well.
|
Now that the full candidate list is cached on first invocation instead of living in a slot on the source, (fixed) @thierryvolpiatto, I've cleaned this up, added support for What else should I test? |
helm-preferred-max-group-length controls the generation of the regexp for matching preferred candidates. query: "abcd" With a value of 1 will match a-b-c-d With a value of 2 will also match ab-c-d a-bc-d, etc' With a value of 3 will also match abc-d a-bcd etc'
MikeSanMichel2 notifications@github.com writes:
I haven't had the time to look at all your code carefully, but from the As I said I think there is a better approach to fix this issue -- better So thanks for your work, we can keep it around and work on it |
I am closing this because I see you have now a ghost account, feel free to submit again. |
Rough Demo for better results as described #1237
To see the difference, try
helm-M-x
with the defaulthelm-candidate-number-limit
of 100and see what "elm" brings up compared to unpatched version.