From c5b243de280e4fbd2f16d5666b13fa393f9fece4 Mon Sep 17 00:00:00 2001 From: Joshua Chia Date: Sat, 18 Apr 2026 02:49:10 +0800 Subject: [PATCH 1/2] Updated getScope() to specially treat set:all just like set:stackage --- html/hoogle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/hoogle.js b/html/hoogle.js index 494746f6..8c0dbd83 100644 --- a/html/hoogle.js +++ b/html/hoogle.js @@ -74,7 +74,7 @@ $(function(){ if (!instant) return; function getScope(){ var v = $scope ? $scope.val() : ""; - return v == null || v == "set:stackage" ? "" : v; + return v == null || v == "set:stackage" || v == "set:all" ? "" : v; } var nowHoogle = $hoogle.val(); From 833e7fb6e890d8d2f9433ed262a2330f08c2807f Mon Sep 17 00:00:00 2001 From: Joshua Chia Date: Thu, 21 May 2026 21:33:06 +0800 Subject: [PATCH 2/2] Hide subquery links only for real narrowings Exempt is:exact / is:module / is:package from hiding the subquery links. Also treat set:all the same as set:stackage: both are "no real scope chosen" defaults and no longer hides the subquery links. --- src/Action/Server.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Action/Server.hs b/src/Action/Server.hs index 0f080bad..8f2fb884 100644 --- a/src/Action/Server.hs +++ b/src/Action/Server.hs @@ -94,7 +94,7 @@ replyServer log local links haddock store cdn home htmlDir scope Input{..} = cas let qScope = let xs = grab "scope" in [scope | null xs && scope /= ""] ++ xs let qSearch = grabBy (`elem` ["hoogle","q"]) - let qSource = qSearch ++ filter (/= "set:stackage") qScope + let qSource = qSearch ++ filter (`notElem` ["set:stackage","set:all"]) qScope let q = concatMap parseQuery qSource let (q2, results) = search store q let body = showResults local links haddock (filter ((/= "mode") . fst) inputArgs) q2 $ @@ -200,12 +200,15 @@ showResults local links haddock args query results = do H.div ! H.class_ "links" $ H.a ! H.href (H.stringValue link) $ "Uses" H.div ! H.class_ "from" $ showFroms local haddock is H.div ! H.class_ "doc newline shut" $ H.preEscapedString targetDocs - H.ul ! H.id "left" $ -- if there's already a scope query we don't show subquery links because bots will get lost in a maze of links. - if (any isQueryScope query) then pure () else do + H.ul ! H.id "left" $ -- if there's already a restrictive scope query we don't show subquery links because bots will get lost in a maze of links. + if (any isRestrictiveScope query) then pure () else do H.li $ H.b "Packages" mconcat [H.li $ f cat val | (cat,val) <- itemCategories $ concat results, QueryScope True cat val `notElem` query] where + isRestrictiveScope (QueryScope _ cat _) = cat /= "is" + isRestrictiveScope _ = False + useLink :: [Target] -> Maybe String useLink [t] | isNothing $ targetPackage t = Just $ "https://packdeps.haskellers.com/reverse/" ++ extractName (targetItem t)