Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
262a880b
Commit
262a880b
authored
Sep 02, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] data import, database upsert returning ids
parent
4838c6b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+3
-3
List.hs
src/Gargantext/Core/Text/List.hs
+1
-1
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+5
-2
Insert.hs
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
+7
-6
No files found.
src/Gargantext/API/Ngrams.hs
View file @
262a880b
...
@@ -908,9 +908,9 @@ putListNgrams' :: RepoCmdM env err m
...
@@ -908,9 +908,9 @@ putListNgrams' :: RepoCmdM env err m
->
Map
NgramsTerm
NgramsRepoElement
->
Map
NgramsTerm
NgramsRepoElement
->
m
()
->
m
()
putListNgrams'
nodeId
ngramsType
ns
=
do
putListNgrams'
nodeId
ngramsType
ns
=
do
printDebug
"[putLictNgrams'] nodeId"
nodeId
--
printDebug "[putLictNgrams'] nodeId" nodeId
printDebug
"[putLictNgrams'] ngramsType"
ngramsType
--
printDebug "[putLictNgrams'] ngramsType" ngramsType
printDebug
"[putListNgrams'] ns"
ns
--
printDebug "[putListNgrams'] ns" ns
var
<-
view
repoVar
var
<-
view
repoVar
liftBase
$
modifyMVar_
var
$
\
r
->
do
liftBase
$
modifyMVar_
var
$
\
r
->
do
pure
$
r
&
r_version
+~
1
pure
$
r
&
r_version
+~
1
...
...
src/Gargantext/Core/Text/List.hs
View file @
262a880b
...
@@ -156,7 +156,7 @@ buildNgramsTermsList _l _n _m s uCid mCid = do
...
@@ -156,7 +156,7 @@ buildNgramsTermsList _l _n _m s uCid mCid = do
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
MapTerm
)
candidatesHead
)
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
MapTerm
)
candidatesHead
)
<>
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
CandidateTerm
)
candidatesTail
)
<>
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
CandidateTerm
)
candidatesTail
)
ngs
=
List
.
concat
$
map
toNgramsElement
$
map
(
\
(
lt
,
(
t
,
d
))
->
(
lt
,
((
t
,
(
d
,
empty
)))))
termList
ngs
=
List
.
concat
$
map
toNgramsElement
$
map
(
\
(
lt
,
(
t
,
d
))
->
(
lt
,
((
t
,
(
d
,
Set
.
singleton
t
)))))
termList
pure
$
Map
.
fromList
[(
NgramsTerms
,
ngs
)]
pure
$
Map
.
fromList
[(
NgramsTerms
,
ngs
)]
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
262a880b
...
@@ -206,7 +206,7 @@ flowCorpusUser l user corpusName ctype ids = do
...
@@ -206,7 +206,7 @@ flowCorpusUser l user corpusName ctype ids = do
-- TODO: check if present already, ignore
-- TODO: check if present already, ignore
_
<-
Doc
.
add
userCorpusId
ids
_
<-
Doc
.
add
userCorpusId
ids
_
tId
<-
insertDefaultNode
NodeTexts
userCorpusId
userId
--
tId <- insertDefaultNode NodeTexts userCorpusId userId
-- printDebug "Node Text Id" tId
-- printDebug "Node Text Id" tId
-- User List Flow
-- User List Flow
...
@@ -233,8 +233,11 @@ insertDocs :: ( FlowCmdM env err m
...
@@ -233,8 +233,11 @@ insertDocs :: ( FlowCmdM env err m
->
CorpusId
->
CorpusId
->
m
([
DocId
],
[
DocumentWithId
a
])
->
m
([
DocId
],
[
DocumentWithId
a
])
insertDocs
hs
uId
cId
=
do
insertDocs
hs
uId
cId
=
do
printDebug
"hs"
(
length
hs
)
let
docs
=
map
addUniqId
hs
let
docs
=
map
addUniqId
hs
printDebug
"docs"
(
length
docs
)
ids
<-
insertDb
uId
cId
docs
ids
<-
insertDb
uId
cId
docs
printDebug
"ids"
(
length
ids
)
let
let
ids'
=
map
reId
ids
ids'
=
map
reId
ids
documentsWithId
=
mergeData
(
toInserted
ids
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
documentsWithId
=
mergeData
(
toInserted
ids
)
(
Map
.
fromList
$
map
viewUniqId'
docs
)
...
...
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
262a880b
...
@@ -153,7 +153,8 @@ queryInsert = [sql|
...
@@ -153,7 +153,8 @@ queryInsert = [sql|
, ins AS (
, ins AS (
INSERT INTO nodes (typename,user_id,parent_id,name,date,hyperdata)
INSERT INTO nodes (typename,user_id,parent_id,name,date,hyperdata)
SELECT * FROM input_rows
SELECT * FROM input_rows
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO NOTHING -- on unique index
ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO UPDATE SET user_id=EXCLUDED.user_id -- on unique index
-- ON CONFLICT ((hyperdata ->> 'uniqIdBdd')) DO NOTHING -- on unique index -- this does not return the ids
-- ON CONFLICT (typename, parent_id, (hyperdata ->> 'uniqId')) DO NOTHING -- on unique index
-- ON CONFLICT (typename, parent_id, (hyperdata ->> 'uniqId')) DO NOTHING -- on unique index
RETURNING id,hyperdata
RETURNING id,hyperdata
)
)
...
...
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