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
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
Changes
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)
...
@@ -29,7 +29,7 @@ import GHC.Show (Show)
import
System.FilePath
(
FilePath
)
import
System.FilePath
(
FilePath
)
import
Data.Maybe
(
Maybe
(
..
),
catMaybes
)
import
Data.Maybe
(
Maybe
(
..
),
catMaybes
)
import
Data.Text
(
Text
,
splitOn
)
import
Data.Text
(
Text
,
splitOn
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
,
lookup
)
import
Data.Tuple.Extra
(
both
,
second
)
import
Data.Tuple.Extra
(
both
,
second
)
import
qualified
Data.Map
as
DM
import
qualified
Data.Map
as
DM
...
@@ -79,6 +79,7 @@ flowDatabase ff fp cName = do
...
@@ -79,6 +79,7 @@ flowDatabase ff fp cName = do
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
toInsert
hyperdataDocuments
)
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
toInsert
hyperdataDocuments
)
-- printDebug "documentsWithId" documentsWithId
-- printDebug "documentsWithId" documentsWithId
-- docsWithNgrams <- documentIdWithNgrams documentsWithId extractNgramsT
let
docsWithNgrams
=
documentIdWithNgrams
extractNgramsT
documentsWithId
let
docsWithNgrams
=
documentIdWithNgrams
extractNgramsT
documentsWithId
printDebug
"docsWithNgrams"
docsWithNgrams
printDebug
"docsWithNgrams"
docsWithNgrams
...
@@ -152,10 +153,11 @@ data DocumentWithId =
...
@@ -152,10 +153,11 @@ data DocumentWithId =
}
deriving
(
Show
)
}
deriving
(
Show
)
mergeData
::
Map
HashId
ReturnId
->
Map
HashId
HyperdataDocument
->
[
DocumentWithId
]
mergeData
::
Map
HashId
ReturnId
->
Map
HashId
HyperdataDocument
->
[
DocumentWithId
]
mergeData
rs
hs
=
map
(
\
(
hash
,
hpd
)
->
DocumentWithId
(
lookup'
hash
rs
)
hpd
)
$
DM
.
toList
hs
mergeData
rs
=
catMaybes
.
map
toDocumentWithId
.
DM
.
toList
where
where
lookup'
h
xs
=
maybe
(
panic
$
message
<>
h
)
reId
(
DM
.
lookup
h
xs
)
toDocumentWithId
(
hash
,
hpd
)
=
message
=
"Database.Flow.mergeData: Error with "
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