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
4eb0b1c2
Commit
4eb0b1c2
authored
Oct 12, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Optim count table
parent
56f7eea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
Table.hs
src/Gargantext/API/Table.hs
+5
-6
Facet.hs
src/Gargantext/Database/Query/Facet.hs
+6
-0
No files found.
src/Gargantext/API/Table.hs
View file @
4eb0b1c2
...
...
@@ -45,7 +45,7 @@ import Gargantext.API.Ngrams.Types (TabType(..))
import
Gargantext.API.Prelude
(
GargServer
)
import
Gargantext.Core.Types
(
Offset
,
Limit
,
TableResult
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
runViewAuthorsDoc
)
import
Gargantext.Database.Query.Facet
(
FacetDoc
,
runViewDocuments
,
runCountDocuments
,
OrderBy
(
..
),
runViewAuthorsDoc
)
import
Gargantext.Database.Action.Learn
(
FavOrTrash
(
..
),
moreLike
)
import
Gargantext.Database.Action.Search
import
Gargantext.Database.Admin.Types.Node
...
...
@@ -116,7 +116,7 @@ searchInCorpus' :: CorpusId
->
Maybe
OrderBy
->
Cmd
err
FacetTableResult
searchInCorpus'
cId
t
q
o
l
order
=
do
docs
<-
searchInCorpus
cId
t
q
o
l
order
docs
<-
searchInCorpus
cId
t
q
o
l
order
countAllDocs
<-
searchCountInCorpus
cId
t
q
pure
$
TableResult
{
tr_docs
=
docs
,
tr_count
=
countAllDocs
}
...
...
@@ -125,10 +125,9 @@ getTable :: NodeId -> Maybe TabType
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
FacetTableResult
getTable
cId
ft
o
l
order
=
do
docs
<-
getTable'
cId
ft
o
l
order
-- TODO: Rewrite to use runCountOpaQuery and avoid (length allDocs)
allDocs
<-
getTable'
cId
ft
Nothing
Nothing
Nothing
pure
$
TableResult
{
tr_docs
=
docs
,
tr_count
=
length
allDocs
}
docs
<-
getTable'
cId
ft
o
l
order
docsCount
<-
runCountDocuments
cId
(
if
ft
==
Just
Trash
then
True
else
False
)
pure
$
TableResult
{
tr_docs
=
docs
,
tr_count
=
docsCount
}
getTable'
::
NodeId
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
...
...
src/Gargantext/Database/Query/Facet.hs
View file @
4eb0b1c2
...
...
@@ -21,6 +21,7 @@ Portability : POSIX
module
Gargantext.Database.Query.Facet
(
runViewAuthorsDoc
,
runViewDocuments
,
runCountDocuments
,
filterWith
,
Pair
(
..
)
...
...
@@ -281,6 +282,11 @@ runViewDocuments cId t o l order =
where
ntId
=
nodeTypeId
NodeDocument
runCountDocuments
::
CorpusId
->
IsTrash
->
Cmd
err
Int
runCountDocuments
cId
t
=
runCountOpaQuery
$
viewDocuments
cId
t
$
nodeTypeId
NodeDocument
viewDocuments
::
CorpusId
->
IsTrash
->
NodeTypeId
->
Query
FacetDocRead
viewDocuments
cId
t
ntId
=
proc
()
->
do
n
<-
queryNodeTable
-<
()
...
...
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