Commit 4c02496c authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/parser-fixes-feedbacks'

parents eef5c951 c1aba603
......@@ -16,7 +16,7 @@ getMetadataWith :: Text -> Maybe Int -> IO (Either ClientError Documents)
getMetadataWith q n = do
runIstexAPIClient $
search
(Just "author,title,abstract,publicationDate,refBibs")
(Just "author,title,abstract,publicationDate,host")
n
(Just q)
......@@ -41,7 +41,7 @@ getMetadataScroll q scroll scrollId page = do
-- Prelude.putStrLn $ "[getMetadataScroll] page: " <> show page
eRes <- runIstexScrollAPIClient $
searchScroll
(Just "author,title,abstract,publicationDate,refBibs")
(Just "author,title,abstract,publicationDate,host")
scroll
(Just q)
scrollId
......@@ -58,7 +58,7 @@ getMetadataScrollProgress :: Text -> Text -> Maybe Text -> Progress -> ErrorHand
getMetadataScrollProgress q scroll scrollId progress errorHandler = do
eRes <- runIstexScrollAPIClient $
searchScroll
(Just "author,title,abstract,publicationDate,refBibs")
(Just "author,title,abstract,publicationDate,host")
scroll
(Just q)
scrollId
......
......@@ -26,7 +26,7 @@ instance FromJSON Author where
data Source = Source
{ _source_title :: Maybe T.Text
, _source_authors :: [Author]
-- , _source_authors :: [Author]
, _source_publicationDate :: Maybe Int
} deriving (Show, Generic)
L.makeLenses ''Source
......@@ -42,9 +42,9 @@ parsePubDate (Just pubDate) =
instance FromJSON Source where
parseJSON (Object o) = do
_source_title <- o .:? "title"
_source_authors <- o .: "author"
mPubDate <- o .:? "publicationDate"
_source_title <- o .:? "title"
-- _source_authors <- o .:? "author"
mPubDate <- o .:? "publicationDate"
pure $ Source { _source_publicationDate = parsePubDate mPubDate
, .. }
......@@ -55,17 +55,17 @@ data Document = Document
, _document_authors :: [Author]
, _document_abstract :: Maybe T.Text
, _document_publicationDate :: Maybe Int
, _document_sources :: [Source]
, _document_sources :: Source
} deriving (Show, Generic)
L.makeLenses ''Document
instance FromJSON Document where
parseJSON (Object o) = do
_document_id <- o .: "id"
_document_id <- o .: "id" <|> o .: "_id"
_document_title <- o .:? "title"
_document_authors <- o .: "author" <|> pure []
_document_abstract <- o .:? "abstract"
_document_sources <- o .: "refBibs" <|> pure []
_document_sources <- o .: "host"
mPubDate <- o .:? "publicationDate"
pure $ Document { _document_publicationDate = parsePubDate mPubDate, .. }
......
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