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
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
Julien Moutinho
haskell-gargantext
Commits
84c2a44a
Commit
84c2a44a
authored
Jan 10, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[corpus] export json as attachment, doesn't open web page with json content
parent
b3109276
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Export.hs
src/Gargantext/API/Node/Corpus/Export.hs
+7
-5
Types.hs
src/Gargantext/API/Node/Corpus/Export/Types.hs
+1
-1
No files found.
src/Gargantext/API/Node/Corpus/Export.hs
View file @
84c2a44a
...
@@ -19,11 +19,12 @@ module Gargantext.API.Node.Corpus.Export
...
@@ -19,11 +19,12 @@ module Gargantext.API.Node.Corpus.Export
import
Data.Map
(
Map
)
import
Data.Map
(
Map
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Set
(
Set
)
import
Data.Set
(
Set
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
,
pack
)
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.Set
as
Set
import
qualified
Data.Set
as
Set
import
qualified
Data.HashMap.Strict
as
HashMap
import
qualified
Data.HashMap.Strict
as
HashMap
import
Servant
(
Headers
,
Header
,
addHeader
)
import
Gargantext.API.Node.Corpus.Export.Types
import
Gargantext.API.Node.Corpus.Export.Types
import
qualified
Gargantext.API.Node.Document.Export.Types
as
DocumentExport
import
qualified
Gargantext.API.Node.Document.Export.Types
as
DocumentExport
...
@@ -50,7 +51,7 @@ import Gargantext.Prelude
...
@@ -50,7 +51,7 @@ import Gargantext.Prelude
getCorpus
::
CorpusId
getCorpus
::
CorpusId
->
Maybe
ListId
->
Maybe
ListId
->
Maybe
NgramsType
->
Maybe
NgramsType
->
GargNoServer
Corpus
->
GargNoServer
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
Corpus
)
getCorpus
cId
lId
nt'
=
do
getCorpus
cId
lId
nt'
=
do
let
let
...
@@ -61,7 +62,7 @@ getCorpus cId lId nt' = do
...
@@ -61,7 +62,7 @@ getCorpus cId lId nt' = do
listId
<-
case
lId
of
listId
<-
case
lId
of
Nothing
->
defaultList
cId
Nothing
->
defaultList
cId
Just
l
->
pure
l
Just
l
->
pure
l
ns
<-
Map
.
fromList
ns
<-
Map
.
fromList
<$>
map
(
\
n
->
(
_context_id
n
,
n
))
<$>
map
(
\
n
->
(
_context_id
n
,
n
))
<$>
selectDocNodes
cId
<$>
selectDocNodes
cId
...
@@ -79,8 +80,9 @@ getCorpus cId lId nt' = do
...
@@ -79,8 +80,9 @@ getCorpus cId lId nt' = do
d_hash
a
b
=
hash
[
fromMaybe
""
(
_hd_uniqId
$
_context_hyperdata
a
)
d_hash
a
b
=
hash
[
fromMaybe
""
(
_hd_uniqId
$
_context_hyperdata
a
)
,
hash
b
,
hash
b
]
]
pure
$
Corpus
{
_c_corpus
=
Map
.
elems
r
pure
$
addHeader
(
"attachment; filename=GarganText_corpus-"
<>
(
pack
$
show
cId
)
<>
".json"
)
,
_c_hash
=
hash
$
List
.
map
DocumentExport
.
_d_hash
$
Map
.
elems
r
}
$
Corpus
{
_c_corpus
=
Map
.
elems
r
,
_c_hash
=
hash
$
List
.
map
DocumentExport
.
_d_hash
$
Map
.
elems
r
}
getContextNgrams
::
HasNodeError
err
getContextNgrams
::
HasNodeError
err
=>
CorpusId
=>
CorpusId
...
...
src/Gargantext/API/Node/Corpus/Export/Types.hs
View file @
84c2a44a
...
@@ -42,6 +42,6 @@ type API = Summary "Corpus Export"
...
@@ -42,6 +42,6 @@ type API = Summary "Corpus Export"
:>
"export"
:>
"export"
:>
QueryParam
"listId"
ListId
:>
QueryParam
"listId"
ListId
:>
QueryParam
"ngramsType"
NgramsType
:>
QueryParam
"ngramsType"
NgramsType
:>
Get
'[
J
SON
]
Corpus
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Corpus
)
$
(
deriveJSON
(
unPrefix
"_c_"
)
''
C
orpus
)
$
(
deriveJSON
(
unPrefix
"_c_"
)
''
C
orpus
)
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