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
208176cb
Commit
208176cb
authored
Jul 09, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[OPTIM] Query Occ Ngrams.
parent
686f7f12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+8
-4
No files found.
src/Gargantext/API/Ngrams.hs
View file @
208176cb
...
...
@@ -72,7 +72,7 @@ import GHC.Generics (Generic)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
-- import Gargantext.Database.Schema.Ngrams (NgramsTypeId, ngramsTypeId, NgramsTableData(..))
import
Gargantext.Database.Config
(
userMaster
)
import
Gargantext.Database.Metrics.NgramsByNode
(
getOccByNgramsOnly
Slow
)
import
Gargantext.Database.Metrics.NgramsByNode
(
getOccByNgramsOnly
Fast
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
)
import
Gargantext.Database.Types.Node
(
NodeType
(
..
))
import
Gargantext.Database.Utils
(
fromField'
,
HasConnection
)
...
...
@@ -888,10 +888,10 @@ getTableNgrams :: forall env err m.
->
Maybe
OrderBy
->
(
NgramsTerm
->
Bool
)
->
m
(
Versioned
NgramsTable
)
getTableNgrams
nType
nId
tabType
listId
limit_
offset
getTableNgrams
_
nType
nId
tabType
listId
limit_
offset
listType
minSize
maxSize
orderBy
searchQuery
=
do
lIds
<-
selectNodesWithUsername
NodeList
userMaster
_
lIds
<-
selectNodesWithUsername
NodeList
userMaster
let
ngramsType
=
ngramsTypeFromTabType
tabType
offset'
=
maybe
0
identity
offset
...
...
@@ -935,11 +935,15 @@ getTableNgrams nType nId tabType listId limit_ offset
setScores
False
table
=
pure
table
setScores
True
table
=
do
let
ngrams_terms
=
(
table
^..
each
.
ne_ngrams
)
occurrences
<-
getOccByNgramsOnlyFast
nId
ngramsType
ngrams_terms
{-
occurrences <- getOccByNgramsOnlySlow nType nId
(lIds <> [listId])
ngramsType
ngrams_terms
-}
let
setOcc
ne
=
ne
&
ne_occurrences
.~
sumOf
(
at
(
ne
^.
ne_ngrams
)
.
_Just
)
occurrences
...
...
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