mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-02 06:10:24 +01:00
Add back exact support
This commit is contained in:
parent
9b299e870e
commit
a708c630ae
@ -22,7 +22,7 @@ getHoogleR name = do
|
|||||||
Entity _ snapshot <- lookupSnapshot name >>= maybe notFound return
|
Entity _ snapshot <- lookupSnapshot name >>= maybe notFound return
|
||||||
mquery <- lookupGetParam "q"
|
mquery <- lookupGetParam "q"
|
||||||
mpage <- lookupGetParam "page"
|
mpage <- lookupGetParam "page"
|
||||||
exact <- isJust <$> lookupGetParam "exact" -- FIXME remove, Hoogle no longer supports
|
exact <- isJust <$> lookupGetParam "exact"
|
||||||
mresults' <- lookupGetParam "results"
|
mresults' <- lookupGetParam "results"
|
||||||
let count' =
|
let count' =
|
||||||
case decimal <$> mresults' of
|
case decimal <$> mresults' of
|
||||||
@ -46,6 +46,7 @@ getHoogleR name = do
|
|||||||
{ hqiQueryInput = query
|
{ hqiQueryInput = query
|
||||||
, hqiLimitTo = count'
|
, hqiLimitTo = count'
|
||||||
, hqiOffsetBy = offset
|
, hqiOffsetBy = offset
|
||||||
|
, hqiExact = exact
|
||||||
}
|
}
|
||||||
|
|
||||||
liftIO $ withMVar lock
|
liftIO $ withMVar lock
|
||||||
@ -92,6 +93,7 @@ data HoogleQueryInput = HoogleQueryInput
|
|||||||
{ hqiQueryInput :: Text
|
{ hqiQueryInput :: Text
|
||||||
, hqiLimitTo :: Int
|
, hqiLimitTo :: Int
|
||||||
, hqiOffsetBy :: Int
|
, hqiOffsetBy :: Int
|
||||||
|
, hqiExact :: Bool
|
||||||
}
|
}
|
||||||
deriving (Eq, Read, Show, Data, Typeable, Ord, Generic)
|
deriving (Eq, Read, Show, Data, Typeable, Ord, Generic)
|
||||||
|
|
||||||
@ -131,7 +133,7 @@ runHoogleQuery hoogledb HoogleQueryInput {..} =
|
|||||||
targets = take (min 100 hqiLimitTo)
|
targets = take (min 100 hqiLimitTo)
|
||||||
$ drop hqiOffsetBy
|
$ drop hqiOffsetBy
|
||||||
$ map fixResult allTargets
|
$ map fixResult allTargets
|
||||||
query = unpack hqiQueryInput
|
query = unpack $ hqiQueryInput ++ if hqiExact then " is:exact" else ""
|
||||||
|
|
||||||
mcount = limitedLength 0 allTargets
|
mcount = limitedLength 0 allTargets
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user