Skip to content
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

Use hackage dependency count to rank "of a kind" matches #16

Closed
jwiegley opened this issue Mar 20, 2013 · 2 comments
Closed

Use hackage dependency count to rank "of a kind" matches #16

jwiegley opened this issue Mar 20, 2013 · 2 comments

Comments

@jwiegley
Copy link
Contributor

If you search for "Map" right now in the current Hoogle (the one in this github repository), Data.Map from containers will be many places down on the list, because there are many exact matches for the Map type and module, and Hoogle lists these exact matches alphabetically.

What I think should happen is that we use Hackage's dependency data to give each hit a ranking based on how widely used the package it's in is. That is, we count the number of packages in Hackage that depend on every other package, and this number is used to sort like-kinded matches.

With this scheme, "Map" will find Data.Map from containers before anything else, simply because containers is used more heavily than all the other packages containing Map as a typename or module name.

@ndmitchell
Copy link
Owner

Each package already has a priority assigned, see Hoogle.Type.Item.itemPriority. Currently, that value is set in Hoogle.Language.Haskell.setPriority where Prelude=0 (highest priority), base=1 and everything else =2. Combined with only searching the platform by default, you can consider the haskell-platform to be higher priority than everything else. I'd still keep the Prelude boost, but the other things should be equivalent to use, so it seems like a good idea.

@ndmitchell
Copy link
Owner

I now use the popularity rankings of reverse dependencies to order results, see the new code at https://github.com/ndmitchell/hogle/ - in particular https://github.com/ndmitchell/hogle/blob/master/src/Input/Reorder.hs. As expected Map the module and Map the data type are the first two hits at http://hoogle.haskell.org/?hoogle=Map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants