It would be great to have a fuzzy search in emerge because when you search a program and don't know it's exact name, you cannot find it with emerge. Example: maybe you want to find "gkrellkam" but don't know it's name, so you're searching for gkrellm and cam and both searches will not find it. The only way is a manual search in x11-plugins. Furtheron it would be nice to have AND+OR+NOT+ONLY search-parameters like: emerge -s gettext NOT ruby emerge -s http ONLY perl
i feel like everything could be handled with a regexp (which emerge -s supports)
I'd like to implement this. We've already got fuzzy package name search build into the ambiguous package name response, using difflib. (In reply to SpanKY from comment #1) > i feel like everything could be handled with a regexp (which emerge -s > supports) In comparison, fuzzy search is effortless for users.
Using the difflib.get_close_matches function as an example, we can use the SequenceMatcher.ratio() method to measure how similar a package name is to the given search string. We can have options to specify cutoff ratio and maximum number of close matches to return. If a maximum number of matches is specified, it is not be possible to display fuzzy results incrementally, though exact matches can still be displayed incrementally (bug 412471).
There's a patch in the following branch: https://github.com/zmedico/portage/tree/bug_65566 I've posted it for review here: https://archives.gentoo.org/gentoo-portage-dev/message/8994f6f733d4b49a08721526531a7867
Patch updated and posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/43aba739d5f9b629b98f23bd618a6310 https://github.com/gentoo/portage/pull/37
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7f0937a811ef4859333ccc45f8076dca109dc2f
Fixed in portage-2.3.3.