Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 65566

Summary: extend "emerge -s" (fuzzy search, search options)
Product: Portage Development Reporter: Mark <mark.morschhaeuser>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: InVCS
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 604854    

Description Mark 2004-09-27 12:18:08 UTC
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
Comment 1 SpanKY gentoo-dev 2004-09-27 20:40:04 UTC
i feel like everything could be handled with a regexp (which emerge -s supports)
Comment 2 Zac Medico gentoo-dev 2016-04-03 23:45:08 UTC
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.
Comment 3 Zac Medico gentoo-dev 2016-04-04 01:09:10 UTC
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).
Comment 4 Zac Medico gentoo-dev 2016-04-04 05:06:32 UTC
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
Comment 7 Zac Medico gentoo-dev 2017-02-10 18:45:50 UTC
Fixed in portage-2.3.3.