Closed jwiegley closed 9 years ago
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.
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.
If you search for "Map" right now in the current Hoogle (the one in this github repository),
Data.Map
fromcontainers
will be many places down on the list, because there are many exact matches for theMap
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.