Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arxiv-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
arxiv-api
Commits
2d7e5753
Verified
Commit
2d7e5753
authored
Feb 16, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[conduit] fixes to the searchAxv function to properly parse results
parent
a2d78abe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
31 deletions
+23
-31
Main.hs
app/Main.hs
+0
-3
Arxiv.hs
src/Arxiv.hs
+13
-17
Arxiv.hs
src/Network/Api/Arxiv.hs
+10
-11
No files found.
app/Main.hs
View file @
2d7e5753
...
...
@@ -11,6 +11,3 @@ main = do
--let resC = searchAxv $ simpleQuery ["besov fluid"]
--runConduitRes $ resC .| outSnk
src/Arxiv.hs
View file @
2d7e5753
...
...
@@ -27,7 +27,7 @@ type Limit = Int
type
Soup
=
Tag
String
batchSize
::
Int
batchSize
=
30
00
batchSize
=
4
00
------------------------------------------------------------
...
...
@@ -102,13 +102,9 @@ searchAxv q =
let
s
=
Ax
.
mkQuery
q
in
do
rsp
<-
HT
.
httpBS
=<<
liftIO
(
parseRequest
s
)
case
getResponseStatus
rsp
of
(
Status
200
_
)
->
let
body
=
getResponseBody
rsp
in
-- If no mo results, break, otherwise this keeps looping for next page forever
case
Ax
.
getEntry
(
getSoup
body
)
of
(
[]
,
_
)
->
C
.
yieldMany
[]
_
->
getSoupC
body
>>=
results
q
(
Status
200
_
)
->
case
getSoup
(
getResponseBody
rsp
)
of
[]
->
C
.
yieldMany
[]
soups
@
(
s
:
_
)
->
results
q
soups
st
->
error
$
"Error:"
++
show
st
----------------------------------------------------------------------
...
...
@@ -136,8 +132,9 @@ toSoup = C.awaitForever (C.yield . parseTags . B.unpack)
----------------------------------------------------------------------
results
::
(
Monad
m
,
C
.
MonadIO
m
)
=>
Ax
.
Query
->
[
Soup
]
->
C
.
ConduitT
()
Result
m
()
results
q
sp
=
Ax
.
forEachEntryM
sp
(
C
.
yield
.
mkResult
)
>>
searchAxv
(
Ax
.
nextPage
q
)
results
q
sp
=
do
Ax
.
forEachEntryM
sp
(
C
.
yield
.
mkResult
)
searchAxv
(
Ax
.
nextPage
q
)
----------------------------------------------------------------------
-- Get data and format
...
...
@@ -182,4 +179,3 @@ mkResult sp = let abstract = Ax.getSummary sp & clean'
----------------------------------------------------------------------
outSnk
::
(
Monad
m
,
C
.
MonadIO
m
)
=>
C
.
ConduitT
Result
C
.
Void
m
()
outSnk
=
C
.
awaitForever
(
liftIO
.
putStrLn
.
show
)
src/Network/Api/Arxiv.hs
View file @
2d7e5753
...
...
@@ -1070,4 +1070,3 @@ where
op
=
try
(
void
(
string
"ANDNOT"
)
>>
return
AndNot
)
<|>
try
(
void
(
string
"OR"
)
>>
return
Or
)
<|>
(
void
(
string
"AND"
)
>>
return
And
)
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