Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
hal
Commits
95e8f01a
Commit
95e8f01a
authored
Dec 08, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] need a start
parent
a8799bb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
Main.hs
app/Main.hs
+1
-1
HAL.hs
src/HAL.hs
+3
-3
Client.hs
src/HAL/Client.hs
+5
-5
No files found.
app/Main.hs
View file @
95e8f01a
...
...
@@ -36,7 +36,7 @@ imt = [
main
::
IO
()
main
=
do
res
<-
getMetadataWith
(
generateRequestByStructID
"artificial intelligence"
imt
)
(
Just
10
)
res
<-
getMetadataWith
(
generateRequestByStructID
"artificial intelligence"
imt
)
(
Just
0
)
(
Just
55
)
case
res
of
(
Left
err
)
->
print
err
(
Right
val
)
->
print
$
_docs
val
src/HAL.hs
View file @
95e8f01a
...
...
@@ -17,10 +17,10 @@ import HAL.Doc.Struct
import
Servant.API
import
Data.Aeson
getMetadataWith
::
Text
->
Maybe
Int
->
IO
(
Either
ClientError
(
Response
Corpus
))
getMetadataWith
q
l
=
do
getMetadataWith
::
Text
->
Maybe
Int
->
Maybe
Int
->
IO
(
Either
ClientError
(
Response
Corpus
))
getMetadataWith
q
start
rows
=
do
manager'
<-
newManager
tlsManagerSettings
runHalAPIClient
$
search
(
Just
requestedFields
)
[
q
]
Nothing
l
Nothing
runHalAPIClient
$
search
(
Just
requestedFields
)
[
q
]
Nothing
start
rows
requestedFields
::
Text
requestedFields
=
"docid,title_s,abstract_s,submittedDate_s,source_s,authFullName_s,authOrganism_s"
...
...
src/HAL/Client.hs
View file @
95e8f01a
...
...
@@ -46,8 +46,9 @@ type Structure doc = "ref" :> "structure"
-- Get's argument type
data
SortField
=
Asc
Text
|
Desc
Text
deriving
(
Show
)
instance
ToHttpApiData
SortField
where
toUrlPiece
(
Asc
t
)
=
t
<>
" asc"
toUrlPiece
(
Asc
t
)
=
t
<>
" asc"
toUrlPiece
(
Desc
t
)
=
t
<>
" desc"
asc
::
Text
->
Maybe
SortField
...
...
@@ -58,10 +59,9 @@ desc = Just . Desc
-- Response type
data
Response
doc
=
Response
{
_numFound
::
Integer
,
_start
::
Int
,
_docs
::
[
doc
]
{
_numFound
::
Integer
,
_start
::
Int
,
_docs
::
[
doc
]
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
R
esponse
...
...
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