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
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
df677e55
Commit
df677e55
authored
Oct 21, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore union of terms in buildNgramsLists
parent
da2c151a
Pipeline
#7987
passed with stages
in 55 minutes and 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
List.hs
src/Gargantext/Core/Text/List.hs
+9
-5
No files found.
src/Gargantext/Core/Text/List.hs
View file @
df677e55
...
@@ -30,7 +30,7 @@ import Data.Text qualified as T
...
@@ -30,7 +30,7 @@ import Data.Text qualified as T
import
Data.Tuple.Extra
(
both
)
import
Data.Tuple.Extra
(
both
)
import
Gargantext.API.Ngrams
(
NgramsRepoElement
)
import
Gargantext.API.Ngrams
(
NgramsRepoElement
)
import
Gargantext.API.Ngrams.Tools
(
getNodeStory
)
import
Gargantext.API.Ngrams.Tools
(
getNodeStory
)
import
Gargantext.API.Ngrams.Types
(
NgramsElement
,
NgramsTerm
(
..
),
ngramsElementFromRepo
,
ne_ngrams
,
ne_list
)
import
Gargantext.API.Ngrams.Types
(
NgramsElement
(
..
),
ngramsElementFromRepo
,
NgramsTerm
(
..
)
,
ne_ngrams
,
ne_list
)
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Core.Text
(
size
)
import
Gargantext.Core.Text
(
size
)
import
Gargantext.Core.Text.List.Group
(
toGroupedTree
,
setScoresWithMap
,
toGroupedTreeInstitutes
)
import
Gargantext.Core.Text.List.Group
(
toGroupedTree
,
setScoresWithMap
,
toGroupedTreeInstitutes
)
...
@@ -105,9 +105,7 @@ buildNgramsLists env user (nodeId, listId) mCid pref gp = do
...
@@ -105,9 +105,7 @@ buildNgramsLists env user (nodeId, listId) mCid pref gp = do
-- such that if we run multiple searches the maplist will evolve organically.
-- such that if we run multiple searches the maplist will evolve organically.
$
(
txLogLocM
)
DEBUG
"Trying to fetch existing terms..."
$
(
txLogLocM
)
DEBUG
"Trying to fetch existing terms..."
let
buildStrategy
=
toNgramsBuildStrategy
pref
let
buildStrategy
=
toNgramsBuildStrategy
pref
existingTerms
<-
case
buildStrategy
of
existingTerms
<-
do
MergeWithExistingNgrams
->
pure
mempty
OverrideExistingNgrams
->
do
archiveState
<-
getNodeStory
env
listId
archiveState
<-
getNodeStory
env
listId
let
(
ngramsState
::
Map
NgramsType
(
Map
NgramsTerm
NgramsRepoElement
))
=
archiveState
^.
a_state
let
(
ngramsState
::
Map
NgramsType
(
Map
NgramsTerm
NgramsRepoElement
))
=
archiveState
^.
a_state
let
(
ngramsState'
::
Map
.
Map
NgramsType
(
Map
NgramsTerm
NgramsElement
))
=
let
(
ngramsState'
::
Map
.
Map
NgramsType
(
Map
NgramsTerm
NgramsElement
))
=
...
@@ -120,7 +118,7 @@ buildNgramsLists env user (nodeId, listId) mCid pref gp = do
...
@@ -120,7 +118,7 @@ buildNgramsLists env user (nodeId, listId) mCid pref gp = do
-- Combine the maplist just computed with the existing one (see #517).
-- Combine the maplist just computed with the existing one (see #517).
let
freshTerms
=
Map
.
unions
$
ngTerms
:
instTerms
:
othersTerms
let
freshTerms
=
Map
.
unions
$
ngTerms
:
instTerms
:
othersTerms
case
buildStrategy
of
case
buildStrategy
of
MergeWithExistingNgrams
->
pure
fresh
Terms
MergeWithExistingNgrams
->
pure
$
Map
.
unionWith
merge
freshTerms
existing
Terms
OverrideExistingNgrams
->
pure
$
Map
.
differenceWith
diffy
freshTerms
existingTerms
OverrideExistingNgrams
->
pure
$
Map
.
differenceWith
diffy
freshTerms
existingTerms
newtype
IndexedNgramsElement
=
IndexedNgramsElement
{
_IndexedNgramsElement
::
NgramsElement
}
newtype
IndexedNgramsElement
=
IndexedNgramsElement
{
_IndexedNgramsElement
::
NgramsElement
}
...
@@ -138,6 +136,12 @@ diffy fresh existing = Just $ unwrap $ Set.toList $ Set.difference (wrap fresh)
...
@@ -138,6 +136,12 @@ diffy fresh existing = Just $ unwrap $ Set.toList $ Set.difference (wrap fresh)
wrap
=
Set
.
fromList
.
map
IndexedNgramsElement
wrap
=
Set
.
fromList
.
map
IndexedNgramsElement
unwrap
=
map
_IndexedNgramsElement
unwrap
=
map
_IndexedNgramsElement
merge
::
[
NgramsElement
]
->
[
NgramsElement
]
->
[
NgramsElement
]
merge
fresh
existing
=
unwrap
$
Set
.
toList
$
Set
.
union
(
wrap
fresh
)
(
wrap
existing
)
where
wrap
=
Set
.
fromList
.
map
IndexedNgramsElement
unwrap
=
map
_IndexedNgramsElement
_debugDumpExisting
::
Map
NgramsType
[
NgramsElement
]
->
Text
_debugDumpExisting
::
Map
NgramsType
[
NgramsElement
]
->
Text
_debugDumpExisting
mp
=
T
.
unlines
$
map
processIt
$
Map
.
toList
mp
_debugDumpExisting
mp
=
T
.
unlines
$
map
processIt
$
Map
.
toList
mp
where
where
...
...
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