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
e3660357
Verified
Commit
e3660357
authored
Mar 30, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] fix score ordering
parent
534d0f6e
Pipeline
#3826
failed with stage
in 30 minutes and 20 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
gargantext.cabal
gargantext.cabal
+0
-1
Facet.hs
src/Gargantext/Database/Query/Facet.hs
+9
-4
Types.hs
src/Gargantext/Database/Query/Facet/Types.hs
+3
-3
No files found.
gargantext.cabal
View file @
e3660357
...
@@ -45,7 +45,6 @@ library
...
@@ -45,7 +45,6 @@ library
Gargantext.API.Node.Share
Gargantext.API.Node.Share
Gargantext.API.Prelude
Gargantext.API.Prelude
Gargantext.Core
Gargantext.Core
Gargantext.Core.NLP
Gargantext.Core.Methods.Similarities
Gargantext.Core.Methods.Similarities
Gargantext.Core.NLP
Gargantext.Core.NLP
Gargantext.Core.NodeStory
Gargantext.Core.NodeStory
...
...
src/Gargantext/Database/Query/Facet.hs
View file @
e3660357
...
@@ -136,6 +136,7 @@ runViewDocuments cId t o l order query year = do
...
@@ -136,6 +136,7 @@ runViewDocuments cId t o l order query year = do
remapNgramsCount
(
FacetDoc
{
..
})
=
remapNgramsCount
(
FacetDoc
{
..
})
=
FacetDoc
{
facetDoc_ngramCount
=
Just
$
fromIntegral
facetDoc_ngramCount
FacetDoc
{
facetDoc_ngramCount
=
Just
$
fromIntegral
facetDoc_ngramCount
,
facetDoc_score
=
Just
$
fromIntegral
facetDoc_score
,
..
}
,
..
}
runCountDocuments
::
(
HasDBid
NodeType
,
HasNodeError
err
)
runCountDocuments
::
(
HasDBid
NodeType
,
HasNodeError
err
)
...
@@ -160,7 +161,7 @@ viewDocuments cId lId t ntId mQuery mYear =
...
@@ -160,7 +161,7 @@ viewDocuments cId lId t ntId mQuery mYear =
,
facetDoc_hyperdata
=
OAgg
.
groupBy
,
facetDoc_hyperdata
=
OAgg
.
groupBy
,
facetDoc_category
=
OAgg
.
groupBy
,
facetDoc_category
=
OAgg
.
groupBy
,
facetDoc_ngramCount
=
OAgg
.
sumInt4
,
facetDoc_ngramCount
=
OAgg
.
sumInt4
,
facetDoc_score
=
OAgg
.
sum
})
,
facetDoc_score
=
OAgg
.
sum
Int4
})
(
viewDocumentsAgg
cId
lId
t
ntId
mQuery
mYear
)
(
viewDocumentsAgg
cId
lId
t
ntId
mQuery
mYear
)
viewDocumentsAgg
::
CorpusId
viewDocumentsAgg
::
CorpusId
...
@@ -175,14 +176,18 @@ viewDocumentsAgg cId lId t ntId mQuery mYear = proc () -> do
...
@@ -175,14 +176,18 @@ viewDocumentsAgg cId lId t ntId mQuery mYear = proc () -> do
cnng
<-
optionalRestrict
queryContextNodeNgramsTable
-<
cnng
<-
optionalRestrict
queryContextNodeNgramsTable
-<
\
cnng'
->
(
cnng'
^.
cnng_node_id
)
.==
pgNodeId
lId
.&&
-- (nc ^. nc_node_id) .&&
\
cnng'
->
(
cnng'
^.
cnng_node_id
)
.==
pgNodeId
lId
.&&
-- (nc ^. nc_node_id) .&&
(
cnng'
^.
cnng_context_id
)
.==
(
c
^.
cs_id
)
(
cnng'
^.
cnng_context_id
)
.==
(
c
^.
cs_id
)
let
ngramCount
=
fromMaybeFields
0
$
_cnng_doc_count
<$>
cnng
returnA
-<
FacetDoc
{
facetDoc_id
=
_cs_id
c
returnA
-<
FacetDoc
{
facetDoc_id
=
_cs_id
c
,
facetDoc_created
=
_cs_date
c
,
facetDoc_created
=
_cs_date
c
,
facetDoc_title
=
_cs_name
c
,
facetDoc_title
=
_cs_name
c
,
facetDoc_hyperdata
=
_cs_hyperdata
c
,
facetDoc_hyperdata
=
_cs_hyperdata
c
,
facetDoc_category
=
nc
^.
nc_category
,
facetDoc_category
=
nc
^.
nc_category
,
facetDoc_ngramCount
=
fromMaybeFields
0
$
_cnng_doc_count
<$>
cnng
-- toNullable $ nc^.nc_score
,
facetDoc_ngramCount
=
ngramCount
-- , facetDoc_ngramCount = toNullable $ toFields cnt
-- NOTE This is a slight abuse of "score" but
,
facetDoc_score
=
nc
^.
nc_score
-- currently it is all 0's in the DB and the
-- search functionality on the frontend orders
-- by Score.
,
facetDoc_score
=
ngramCount
}
}
-- TODO Join with context_node_ngrams at context_id/node_id and sum by
-- TODO Join with context_node_ngrams at context_id/node_id and sum by
...
...
src/Gargantext/Database/Query/Facet/Types.hs
View file @
e3660357
...
@@ -31,7 +31,7 @@ type Title = Text
...
@@ -31,7 +31,7 @@ type Title = Text
-- TODO remove Title
-- TODO remove Title
type
FacetDoc
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
(
Maybe
Category
)
(
Maybe
Double
)
(
Maybe
Score
)
type
FacetDoc
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
(
Maybe
Category
)
(
Maybe
Double
)
(
Maybe
Score
)
type
FacetDocAgg'
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
(
Maybe
Category
)
Int64
(
Maybe
Score
)
type
FacetDocAgg'
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
(
Maybe
Category
)
Int64
Int64
-- type FacetSources = FacetDoc
-- type FacetSources = FacetDoc
-- type FacetAuthors = FacetDoc
-- type FacetAuthors = FacetDoc
-- type FacetTerms = FacetDoc
-- type FacetTerms = FacetDoc
...
@@ -144,7 +144,7 @@ type FacetDocAgg = Facet (Field SqlInt4 )
...
@@ -144,7 +144,7 @@ type FacetDocAgg = Facet (Field SqlInt4 )
(
Field
SqlJsonb
)
(
Field
SqlJsonb
)
(
Field
SqlInt4
)
-- Category
(
Field
SqlInt4
)
-- Category
(
Field
SqlInt8
)
-- Ngrams Count
(
Field
SqlInt8
)
-- Ngrams Count
(
Field
Sql
Floa
t8
)
-- Score
(
Field
Sql
In
t8
)
-- Score
type
FacetDocAggPart
=
Facet
(
Field
SqlInt4
)
type
FacetDocAggPart
=
Facet
(
Field
SqlInt4
)
(
Field
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
...
@@ -152,7 +152,7 @@ type FacetDocAggPart = Facet (Field SqlInt4 )
...
@@ -152,7 +152,7 @@ type FacetDocAggPart = Facet (Field SqlInt4 )
(
Field
SqlJsonb
)
(
Field
SqlJsonb
)
(
Field
SqlInt4
)
-- Category
(
Field
SqlInt4
)
-- Category
(
Field
SqlInt4
)
-- Ngrams Count
(
Field
SqlInt4
)
-- Ngrams Count
(
Field
Sql
Float8
)
-- Score
(
Field
Sql
Int4
)
-- Score
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
...
...
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