Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
istex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
crawlers
istex
Commits
46cd0d95
Commit
46cd0d95
authored
Aug 27, 2019
by
Mudada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sources
parent
241037ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
ISTEX.hs
src/ISTEX.hs
+2
-2
Client.hs
src/ISTEX/Client.hs
+28
-9
No files found.
src/ISTEX.hs
View file @
46cd0d95
...
...
@@ -18,6 +18,6 @@ basicSearch :: Maybe T.Text -> IO (Either ClientError Documents)
basicSearch
rq
=
do
runIstexAPIClient
$
search
(
Just
"author,title,abstract,publicationDate"
)
(
Just
5
)
(
Just
"author,title,abstract,publicationDate
,refBibs
"
)
(
Just
5
000
)
rq
src/ISTEX/Client.hs
View file @
46cd0d95
...
...
@@ -19,21 +19,39 @@ import qualified Control.Lens as L
data
Author
=
Author
{
_name
::
T
.
Text
,
_affiliations
::
[
T
.
Text
]
_
author_
name
::
T
.
Text
,
_a
uthor_a
ffiliations
::
[
T
.
Text
]
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
A
uthor
instance
FromJSON
Author
where
parseJSON
(
Object
o
)
=
Author
<$>
(
o
.:
"name"
)
<*>
(
o
.:
"affiliations"
<|>
pure
[]
)
data
Source
=
Source
{
_source_title
::
Maybe
T
.
Text
,
_source_authors
::
[
Author
],
_source_publicationDate
::
Maybe
Int
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
S
ource
instance
FromJSON
Source
where
parseJSON
(
Object
o
)
=
Source
<$>
(
o
.:?
"title"
)
<*>
(
o
.:
"author"
)
<*>
do
pPubDate
<-
(
o
.:?
"publicationDate"
)
return
$
(
read
.
T
.
unpack
)
<$>
pPubDate
data
Document
=
Document
{
_id
::
T
.
Text
,
_title
::
Maybe
T
.
Text
,
_authors
::
[
Author
],
_abstract
::
Maybe
T
.
Text
,
_publicationDate
::
Maybe
Int
_document_id
::
T
.
Text
,
_document_title
::
Maybe
T
.
Text
,
_document_authors
::
[
Author
],
_document_abstract
::
Maybe
T
.
Text
,
_document_publicationDate
::
Maybe
Int
,
_document_sources
::
[
Source
]
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
D
ocument
...
...
@@ -46,11 +64,12 @@ instance FromJSON Document where
<*>
(
o
.:?
"abstract"
)
<*>
do
pPubDate
<-
(
o
.:?
"publicationDate"
)
return
$
(
read
.
T
.
unpack
)
<$>
pPubDate
<*>
(
o
.:
"refBibs"
<|>
pure
[]
)
data
Documents
=
Documents
{
_total
::
Int
,
_hits
::
[
Document
]
_
documents_
total
::
Int
,
_
documents_
hits
::
[
Document
]
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
D
ocuments
instance
FromJSON
Documents
where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment