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
195
Issues
195
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
f8470b23
Commit
f8470b23
authored
Feb 04, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Adding a List size for others lists
parent
41fe94e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+3
-2
Types.hs
src/Gargantext/API/Ngrams/Types.hs
+1
-1
List.hs
src/Gargantext/Core/Text/List.hs
+7
-5
No files found.
src/Gargantext/API/Ngrams.hs
View file @
f8470b23
...
@@ -523,14 +523,13 @@ getTableNgrams _nType nId tabType listId limit_ offset
...
@@ -523,14 +523,13 @@ getTableNgrams _nType nId tabType listId limit_ offset
selected_inner
roots
n
=
maybe
False
(`
Set
.
member
`
roots
)
(
n
^.
ne_root
)
selected_inner
roots
n
=
maybe
False
(`
Set
.
member
`
roots
)
(
n
^.
ne_root
)
---------------------------------------
---------------------------------------
sortOnOrder
Nothing
=
identity
sortOnOrder
Nothing
=
sortOnOrder
(
Just
ScoreDesc
)
sortOnOrder
(
Just
TermAsc
)
=
List
.
sortOn
$
view
ne_ngrams
sortOnOrder
(
Just
TermAsc
)
=
List
.
sortOn
$
view
ne_ngrams
sortOnOrder
(
Just
TermDesc
)
=
List
.
sortOn
$
Down
.
view
ne_ngrams
sortOnOrder
(
Just
TermDesc
)
=
List
.
sortOn
$
Down
.
view
ne_ngrams
sortOnOrder
(
Just
ScoreAsc
)
=
List
.
sortOn
$
view
ne_occurrences
sortOnOrder
(
Just
ScoreAsc
)
=
List
.
sortOn
$
view
ne_occurrences
sortOnOrder
(
Just
ScoreDesc
)
=
List
.
sortOn
$
Down
.
view
ne_occurrences
sortOnOrder
(
Just
ScoreDesc
)
=
List
.
sortOn
$
Down
.
view
ne_occurrences
---------------------------------------
---------------------------------------
filteredNodes
::
Map
NgramsTerm
NgramsElement
->
[
NgramsElement
]
filteredNodes
::
Map
NgramsTerm
NgramsElement
->
[
NgramsElement
]
filteredNodes
tableMap
=
rootOf
<$>
list
&
filter
selected_node
filteredNodes
tableMap
=
rootOf
<$>
list
&
filter
selected_node
where
where
...
@@ -587,11 +586,13 @@ getTableNgrams _nType nId tabType listId limit_ offset
...
@@ -587,11 +586,13 @@ getTableNgrams _nType nId tabType listId limit_ offset
let
scoresNeeded
=
needsScores
orderBy
let
scoresNeeded
=
needsScores
orderBy
tableMap1
<-
getNgramsTableMap
listId
ngramsType
tableMap1
<-
getNgramsTableMap
listId
ngramsType
t1
<-
getTime
t1
<-
getTime
tableMap2
<-
tableMap1
&
v_data
%%~
setScores
scoresNeeded
tableMap2
<-
tableMap1
&
v_data
%%~
setScores
scoresNeeded
.
Map
.
mapWithKey
ngramsElementFromRepo
.
Map
.
mapWithKey
ngramsElementFromRepo
fltr
<-
tableMap2
&
v_data
%%~
fmap
NgramsTable
.
setScores
(
not
scoresNeeded
)
fltr
<-
tableMap2
&
v_data
%%~
fmap
NgramsTable
.
setScores
(
not
scoresNeeded
)
.
filteredNodes
.
filteredNodes
let
fltrCount
=
length
$
fltr
^.
v_data
.
_NgramsTable
let
fltrCount
=
length
$
fltr
^.
v_data
.
_NgramsTable
t2
<-
getTime
t2
<-
getTime
...
...
src/Gargantext/API/Ngrams/Types.hs
View file @
f8470b23
...
@@ -578,7 +578,7 @@ ngramsElementFromRepo
...
@@ -578,7 +578,7 @@ ngramsElementFromRepo
,
_ne_parent
=
p
,
_ne_parent
=
p
,
_ne_children
=
c
,
_ne_children
=
c
,
_ne_ngrams
=
ngrams
,
_ne_ngrams
=
ngrams
,
_ne_occurrences
=
panic
$
"API.Ngrams.Types._ne_occurrences"
,
_ne_occurrences
=
0
--
panic $ "API.Ngrams.Types._ne_occurrences"
{-
{-
-- Here we could use 0 if we want to avoid any `panic`.
-- Here we could use 0 if we want to avoid any `panic`.
-- It will not happen using getTableNgrams if
-- It will not happen using getTableNgrams if
...
...
src/Gargantext/Core/Text/List.hs
View file @
f8470b23
...
@@ -76,15 +76,16 @@ buildNgramsLists :: ( HasNodeStory env err m
...
@@ -76,15 +76,16 @@ buildNgramsLists :: ( HasNodeStory env err m
buildNgramsLists
user
uCid
mCid
mfslw
gp
=
do
buildNgramsLists
user
uCid
mCid
mfslw
gp
=
do
ngTerms
<-
buildNgramsTermsList
user
uCid
mCid
mfslw
gp
(
NgramsTerms
,
MapListSize
350
)
ngTerms
<-
buildNgramsTermsList
user
uCid
mCid
mfslw
gp
(
NgramsTerms
,
MapListSize
350
)
othersTerms
<-
mapM
(
buildNgramsOthersList
user
uCid
mfslw
GroupIdentity
)
othersTerms
<-
mapM
(
buildNgramsOthersList
user
uCid
mfslw
GroupIdentity
)
[
(
Authors
,
MapListSize
9
)
[
(
Authors
,
MapListSize
9
,
MaxListSize
1000
)
,
(
Sources
,
MapListSize
9
)
,
(
Sources
,
MapListSize
9
,
MaxListSize
1000
)
,
(
Institutes
,
MapListSize
9
)
,
(
Institutes
,
MapListSize
9
,
MaxListSize
1000
)
]
]
pure
$
Map
.
unions
$
[
ngTerms
]
<>
othersTerms
pure
$
Map
.
unions
$
[
ngTerms
]
<>
othersTerms
data
MapListSize
=
MapListSize
{
unMapListSize
::
!
Int
}
data
MapListSize
=
MapListSize
{
unMapListSize
::
!
Int
}
data
MaxListSize
=
MaxListSize
{
unMaxListSize
::
!
Int
}
buildNgramsOthersList
::
(
HasNodeError
err
buildNgramsOthersList
::
(
HasNodeError
err
,
CmdM
env
err
m
,
CmdM
env
err
m
...
@@ -95,9 +96,9 @@ buildNgramsOthersList :: ( HasNodeError err
...
@@ -95,9 +96,9 @@ buildNgramsOthersList :: ( HasNodeError err
->
UserCorpusId
->
UserCorpusId
->
Maybe
FlowSocialListWith
->
Maybe
FlowSocialListWith
->
GroupParams
->
GroupParams
->
(
NgramsType
,
MapListSize
)
->
(
NgramsType
,
MapListSize
,
MaxListSize
)
->
m
(
Map
NgramsType
[
NgramsElement
])
->
m
(
Map
NgramsType
[
NgramsElement
])
buildNgramsOthersList
user
uCid
mfslw
_groupParams
(
nt
,
MapListSize
mapListSize
)
=
do
buildNgramsOthersList
user
uCid
mfslw
_groupParams
(
nt
,
MapListSize
mapListSize
,
MaxListSize
maxListSize
)
=
do
allTerms
::
HashMap
NgramsTerm
(
Set
NodeId
)
<-
getContextsByNgramsUser
uCid
nt
allTerms
::
HashMap
NgramsTerm
(
Set
NodeId
)
<-
getContextsByNgramsUser
uCid
nt
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
...
@@ -118,6 +119,7 @@ buildNgramsOthersList user uCid mfslw _groupParams (nt, MapListSize mapListSize)
...
@@ -118,6 +119,7 @@ buildNgramsOthersList user uCid mfslw _groupParams (nt, MapListSize mapListSize)
listSize
=
mapListSize
-
(
List
.
length
mapTerms
)
listSize
=
mapListSize
-
(
List
.
length
mapTerms
)
(
mapTerms'
,
candiTerms
)
=
both
HashMap
.
fromList
(
mapTerms'
,
candiTerms
)
=
both
HashMap
.
fromList
$
List
.
splitAt
listSize
$
List
.
splitAt
listSize
$
List
.
take
maxListSize
$
List
.
sortOn
(
Down
.
viewScore
.
snd
)
$
List
.
sortOn
(
Down
.
viewScore
.
snd
)
$
HashMap
.
toList
tailTerms'
$
HashMap
.
toList
tailTerms'
...
...
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