{"action":"created","issue":{"url":"https://api.github.com/repos/ndmitchell/hoogle/issues/206","repository_url":"https://api.github.com/repos/ndmitchell/hoogle","labels_url":"https://api.github.com/repos/ndmitchell/hoogle/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/ndmitchell/hoogle/issues/206/comments","events_url":"https://api.github.com/repos/ndmitchell/hoogle/issues/206/events","html_url":"https://github.com/ndmitchell/hoogle/issues/206","id":220664451,"number":206,"title":"Hoogle server returns the url to the oldest package (ranked by pvp) when multiple package versions live on the same server","user":{"login":"fredericcogny","id":15909740,"avatar_url":"https://avatars3.githubusercontent.com/u/15909740?v=3","gravatar_id":"","url":"https://api.github.com/users/fredericcogny","html_url":"https://github.com/fredericcogny","followers_url":"https://api.github.com/users/fredericcogny/followers","following_url":"https://api.github.com/users/fredericcogny/following{/other_user}","gists_url":"https://api.github.com/users/fredericcogny/gists{/gist_id}","starred_url":"https://api.github.com/users/fredericcogny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredericcogny/subscriptions","organizations_url":"https://api.github.com/users/fredericcogny/orgs","repos_url":"https://api.github.com/users/fredericcogny/repos","events_url":"https://api.github.com/users/fredericcogny/events{/privacy}","received_events_url":"https://api.github.com/users/fredericcogny/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-04-10T14:34:16Z","updated_at":"2017-04-17T09:02:42Z","closed_at":"2017-04-17T09:02:42Z","body":"Hi Neil\r\n\r\nHope this finds you well.\r\n\r\n*Background*\r\nWe've set-up our own doc server with hoogle for the packages we develop internally\r\nOne of our requirements was too keep older versions of the docs on the server as well.\r\nSo we now have side by side folders like: `mylib-1.0.0`, `mylib-1.0.1`,  `mylib-2.0.0` etc ...\r\nSo when we run `hoogle generate` they all get captured in the db and that's all good.\r\n\r\n*Issue*\r\nThe issue we have though comes from the fact that when we get back the results of the search, the URL that is displayed points to the oldest package. The desired behaviour would be to have it _pointing to the latest instead_. [the whole list of modules and packages appear fine just below]\r\n\r\n*Solution?*\r\nLooking at the module `Action.Server` I think this is coming from the function `showResults` (pasted below) where, for each result, you pattern match against the head of the list of `Targets`. (cf l 166). So naturally the `targetURL` is the first of your Targets.\r\nIf we were to order that list by a \"reverse\"-natural version policy ordering (or even simpler maybe, by reverse lexicographic ordering) it would take care of our problem.\r\nIf you wish I'm happy to give it a try but first I wanted to check with you whether the `[[Targets]]` that come to `showResults` are pre-ordered following some other rules. In which case, can those rules be modified or was the choice of the order deliberate for some other reason ?\r\n\r\nThanks in advance\r\n\r\nFred\r\n\r\n```\r\nshowResults :: Bool -> Maybe FilePath -> [(String, String)] -> [Query] -> [[Target]] -> String\r\nshowResults local haddock args query results = unlines $\r\n    [\"<h1>\" ++ renderQuery query ++ \"</h1>\"\r\n    ,\"<ul id=left>\"\r\n    ,\"<li><b>Packages</b></li>\"] ++\r\n    [tag_ \"li\" $ f cat val | (cat,val) <- itemCategories $ concat results, QueryScope True cat val `notElem` query] ++\r\n    [\"</ul>\"] ++\r\n    [\"<p>No results found</p>\" | null results] ++\r\n    [\"<div class=result>\" ++\r\n     \"<div class=ans><a href=\\\"\" ++ showURL local haddock targetURL ++ \"\\\">\" ++ displayItem query targetItem ++ \"</a></div>\" ++\r\n     \"<div class=from>\" ++ showFroms local haddock is  ++ \"</div>\" ++\r\n     \"<div class=\\\"doc newline shut\\\">\" ++ targetDocs ++ \"</div>\" ++\r\n     \"</div>\"\r\n    | is@(Target{..}:_) <- results]\r\n```"},"comment":{"url":"https://api.github.com/repos/ndmitchell/hoogle/issues/comments/294436066","html_url":"https://github.com/ndmitchell/hoogle/issues/206#issuecomment-294436066","issue_url":"https://api.github.com/repos/ndmitchell/hoogle/issues/206","id":294436066,"user":{"login":"fredericcogny","id":15909740,"avatar_url":"https://avatars3.githubusercontent.com/u/15909740?v=3","gravatar_id":"","url":"https://api.github.com/users/fredericcogny","html_url":"https://github.com/fredericcogny","followers_url":"https://api.github.com/users/fredericcogny/followers","following_url":"https://api.github.com/users/fredericcogny/following{/other_user}","gists_url":"https://api.github.com/users/fredericcogny/gists{/gist_id}","starred_url":"https://api.github.com/users/fredericcogny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredericcogny/subscriptions","organizations_url":"https://api.github.com/users/fredericcogny/orgs","repos_url":"https://api.github.com/users/fredericcogny/repos","events_url":"https://api.github.com/users/fredericcogny/events{/privacy}","received_events_url":"https://api.github.com/users/fredericcogny/received_events","type":"User","site_admin":false},"created_at":"2017-04-17T09:02:41Z","updated_at":"2017-04-17T09:02:41Z","body":"Hi Neil\r\nHappy Easter\r\nI just checked and it works fine for me now. Thanks again"}}
{"actor":{"display_login":"fredericcogny"}}