Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
haskell-gargantext
Commits
13b3d633
Commit
13b3d633
authored
Jan 22, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Query route simple to get started
parent
acfeeae0
Pipeline
#704
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
New.hs
src/Gargantext/API/Corpus/New.hs
+5
-4
Core.hs
src/Gargantext/Core.hs
+12
-1
No files found.
src/Gargantext/API/Corpus/New.hs
View file @
13b3d633
...
...
@@ -113,6 +113,7 @@ info _u = pure $ ApiInfo API.externalAPIs
data
WithQuery
=
WithQuery
{
_wq_query
::
!
Text
,
_wq_databases
::
!
[
ExternalAPIs
]
,
_wq_lang
::
!
(
Maybe
Lang
)
}
deriving
Generic
...
...
@@ -148,10 +149,10 @@ type Upload = Summary "Corpus Upload endpoint"
type
AddWithQuery
=
Summary
"Add with Query to corpus endpoint"
:>
"
query
"
:>
"
corpus
"
:>
Capture
"corpus_id"
CorpusId
:>
"add"
:>
"
corpus
"
:>
"
query
"
:>
"async"
:>
AsyncJobsAPI
ScraperStatus
WithQuery
ScraperStatus
...
...
@@ -180,7 +181,7 @@ addToCorpusJobFunction :: FlowCmdM env err m
->
WithQuery
->
(
ScraperStatus
->
m
()
)
->
m
ScraperStatus
addToCorpusJobFunction
_cid
(
WithQuery
_q
_dbs
)
logStatus
=
do
addToCorpusJobFunction
_cid
(
WithQuery
_q
_dbs
_l
)
logStatus
=
do
-- TODO ...
logStatus
ScraperStatus
{
_scst_succeeded
=
Just
10
,
_scst_failed
=
Just
2
...
...
@@ -223,7 +224,7 @@ addToCorpusWithForm :: FlowCmdM env err m
addToCorpusWithForm
cid
(
WithForm
_ft
d
)
logStatus
=
do
let
docs
=
splitEvery
500
$
take
10000
$
take
10000
00
$
parseHal'
(
cs
d
)
logStatus
ScraperStatus
{
_scst_succeeded
=
Just
1
...
...
src/Gargantext/Core.hs
View file @
13b3d633
...
...
@@ -9,9 +9,17 @@ Portability : POSIX
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Core
where
import
Gargantext.Prelude
import
GHC.Generics
(
Generic
)
import
Data.Aeson
import
Data.Swagger
------------------------------------------------------------------------
-- | Language of a Text
-- For simplicity, we suppose text has an homogenous language
...
...
@@ -29,8 +37,11 @@ module Gargantext.Core
-- | All languages supported
-- TODO : DE | SP | CH
data
Lang
=
EN
|
FR
deriving
(
Show
,
Eq
,
Ord
,
Bounded
,
Enum
)
deriving
(
Show
,
Eq
,
Ord
,
Bounded
,
Enum
,
Generic
)
instance
ToJSON
Lang
instance
FromJSON
Lang
instance
ToSchema
Lang
allLangs
::
[
Lang
]
allLangs
=
[
minBound
..
]
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