Commit 64e2a689 authored by Fabien Maniere's avatar Fabien Maniere

Merge branch '490-dev-openalex-search-fix' into 'dev'

[openalex] make search act similar to the one on openalex web

See merge request !425
parents 73a95b9f d304bb36
Pipeline #7730 passed with stages
in 63 minutes and 8 seconds
......@@ -28,8 +28,14 @@ get :: Text
-> IO (Either ClientError (Maybe Integer, ConduitT () HyperdataDocument IO ()))
get _email q lang mLimit = do
let limit = getLimit $ fromMaybe 1000 mLimit
let mFilter = (\l -> "language:" <> iso639ToText l) <$> lang
eRes <- OA.fetchWorksC Nothing mFilter $ Just $ Corpus.getRawQuery q
let filters =
[
-- see https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/490
-- see https://openalex.org/works?page=1&filter=title_and_abstract.search:brain:hawai
Just ("title_and_abstract.search:" <> Corpus.getRawQuery q)
, (\l -> "language:" <> iso639ToText l) <$> lang
]
eRes <- OA.fetchWorksC Nothing (Just $ T.intercalate "," $ catMaybes filters) Nothing
pure $ (\(len, docsC) -> (len, docsC .| takeC limit .| mapC toDoc)) <$> eRes
toDoc :: OA.Work -> HyperdataDocument
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment