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
04186169
Commit
04186169
authored
Nov 24, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX][DB][FLOW] Bug insertion of duplicates.
parent
514a2c5e
Pipeline
#21
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
Flow.hs
src/Gargantext/Database/Flow.hs
+7
-5
No files found.
src/Gargantext/Database/Flow.hs
View file @
04186169
...
...
@@ -29,7 +29,7 @@ import GHC.Show (Show)
import
System.FilePath
(
FilePath
)
import
Data.Maybe
(
Maybe
(
..
),
catMaybes
)
import
Data.Text
(
Text
,
splitOn
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
,
lookup
)
import
Data.Tuple.Extra
(
both
,
second
)
import
qualified
Data.Map
as
DM
...
...
@@ -79,6 +79,7 @@ flowDatabase ff fp cName = do
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
toInsert
hyperdataDocuments
)
-- printDebug "documentsWithId" documentsWithId
-- docsWithNgrams <- documentIdWithNgrams documentsWithId extractNgramsT
let
docsWithNgrams
=
documentIdWithNgrams
extractNgramsT
documentsWithId
printDebug
"docsWithNgrams"
docsWithNgrams
...
...
@@ -152,10 +153,11 @@ data DocumentWithId =
}
deriving
(
Show
)
mergeData
::
Map
HashId
ReturnId
->
Map
HashId
HyperdataDocument
->
[
DocumentWithId
]
mergeData
rs
hs
=
map
(
\
(
hash
,
hpd
)
->
DocumentWithId
(
lookup'
hash
rs
)
hpd
)
$
DM
.
toList
hs
where
lookup'
h
xs
=
maybe
(
panic
$
message
<>
h
)
reId
(
DM
.
lookup
h
xs
)
message
=
"Database.Flow.mergeData: Error with "
mergeData
rs
=
catMaybes
.
map
toDocumentWithId
.
DM
.
toList
where
toDocumentWithId
(
hash
,
hpd
)
=
DocumentWithId
<$>
fmap
reId
(
lookup
hash
rs
)
<*>
Just
hpd
------------------------------------------------------------------------
...
...
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