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
e6836bb7
Commit
e6836bb7
authored
Mar 31, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test case, implement docs count query
parent
3bf77f28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
1 deletion
+44
-1
Main.hs
app/Main.hs
+28
-0
crawlerHAL.cabal
crawlerHAL.cabal
+5
-1
package.yaml
package.yaml
+1
-0
HAL.hs
src/HAL.hs
+10
-0
No files found.
app/Main.hs
View file @
e6836bb7
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module
Main
where
import
NeatInterpolation
(
text
)
import
Network.HTTP.Client
(
newManager
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Servant.Client
...
...
@@ -13,6 +15,32 @@ import HAL
import
Tree
import
qualified
Data.Text
as
T
yearReq
=
[
text
|
(language_t:en)
AND (producedDateY_i:2015
OR producedDateY_i:2016
OR producedDateY_i:2017
OR producedDateY_i:2018
OR producedDateY_i:2021
OR producedDateY_i:2022)
AND (structId_i:302102
OR structId_i:469216
OR structId_i:6279
OR structId_i:224096
OR structId_i:144103
OR structId_i:497330
OR structId_i:1076752
OR structId_i:84538
OR structId_i:301262
OR structId_i:481355
OR structId_i:29212
OR structId_i:301442
OR structId_i:542824
OR structId_i:300362
OR structId_i:1048346
OR structId_i:352124)
|]
imt
::
[
T
.
Text
]
imt
=
[
"224096"
...
...
crawlerHAL.cabal
View file @
e6836bb7
...
...
@@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash:
509e772465870fbf771b5c61338c6ae265f9eb1cd69ff040abb0b8421acb20f2
-- hash:
69a4bea2da13bc040b9bc7cb24f4f1ec8fcdfbd22873422aba7b7bb962810628
name: crawlerHAL
version: 0.1.0.0
...
...
@@ -25,6 +25,7 @@ source-repository head
library
exposed-modules:
ConduitTest
HAL
HAL.Client
HAL.Doc
...
...
@@ -53,6 +54,7 @@ library
, http-client
, http-client-tls
, lens
, neat-interpolation
, scientific
, servant
, servant-client
...
...
@@ -87,6 +89,7 @@ executable crawlerHAL-exe
, http-client
, http-client-tls
, lens
, neat-interpolation
, scientific
, servant
, servant-client
...
...
@@ -122,6 +125,7 @@ test-suite halCrawler-test
, http-client
, http-client-tls
, lens
, neat-interpolation
, scientific
, servant
, servant-client
...
...
package.yaml
View file @
e6836bb7
...
...
@@ -29,6 +29,7 @@ dependencies:
-
http-client
-
http-client-tls
-
lens
-
neat-interpolation
-
scientific
-
servant
-
servant-client
...
...
src/HAL.hs
View file @
e6836bb7
...
...
@@ -57,6 +57,16 @@ getMetadataWithC q start rows = do
print
$
show
_corpus_title
pure
c
countResults
::
Text
->
IO
(
Either
ClientError
Integer
)
countResults
q
=
do
manager'
<-
newManager
tlsManagerSettings
-- First, estimate the total number of documents
eRes
<-
runHalAPIClient
$
search
(
Just
requestedFields
)
[
q
]
Nothing
(
Just
0
)
(
Just
1
)
pure
$
count'
<$>
eRes
where
count'
::
Response
Corpus
->
Integer
count'
(
Response
{
_numFound
})
=
_numFound
requestedFields
::
Text
requestedFields
=
"docid,title_s,abstract_s,submittedDate_s,source_s,authFullName_s,authOrganism_s"
...
...
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