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
c9cd5e03
Commit
c9cd5e03
authored
Jan 17, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Scores at insertion
parent
4e3342db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
NgramsByContext.hs
src/Gargantext/Database/Action/Metrics/NgramsByContext.hs
+1
-1
NodesNodes.hs
src/Gargantext/Database/Admin/Trigger/NodesNodes.hs
+8
-4
Node.hs
src/Gargantext/Database/Admin/Types/Node.hs
+6
-5
No files found.
src/Gargantext/Database/Action/Metrics/NgramsByContext.hs
View file @
c9cd5e03
...
...
@@ -28,7 +28,7 @@ import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
import
Gargantext.Core
import
Gargantext.API.Ngrams.Types
(
NgramsTerm
(
..
))
import
Gargantext.Data.HashMap.Strict.Utils
as
HM
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, Node
Id)
import
Gargantext.Database.Admin.Types.Node
(
ListId
,
CorpusId
,
NodeId
(
..
),
ContextId
,
MasterCorpusId
,
NodeType
(
NodeDocument
),
UserCorpusId
,
Doc
Id
)
import
Gargantext.Database.Prelude
(
Cmd
,
runPGSQuery
)
import
Gargantext.Database.Schema.Ngrams
(
ngramsTypeId
,
NgramsType
(
..
))
import
Gargantext.Prelude
...
...
src/Gargantext/Database/Admin/Trigger/NodesNodes.hs
View file @
c9cd5e03
...
...
@@ -35,14 +35,18 @@ triggerInsertCount lId = execPGSQuery query (lId, nodeTypeId NodeList)
AS $$
BEGIN
INSERT INTO node_node_ngrams (node1_id, node2_id, ngrams_id, ngrams_type, weight)
SELECT new1.node_id, lists.id, nnn.ngrams_id, nnn.ngrams_type, count(*) as weight
SELECT lists.parent_id
, lists.id
, cnn.ngrams_id
, cnn.ngrams_type
, count(*) AS weight
FROM NEW as new1
INNER JOIN contexts doc ON doc.id = new1.context_id
INNER JOIN nodes lists ON lists.parent_id =
new1.node
_id
INNER JOIN context_node_ngrams
nnn ON n
nn.context_id = doc.id
INNER JOIN nodes lists ON lists.parent_id =
lists.parent
_id
INNER JOIN context_node_ngrams
cnn ON c
nn.context_id = doc.id
WHERE lists.id in (?, lists.id)
AND lists.typename = ?
GROUP BY
new1.node_id, lists.id, nnn.ngrams_id, n
nn.ngrams_type
GROUP BY
lists.parent_id, lists.id, cnn.ngrams_id, c
nn.ngrams_type
ON CONFLICT (node1_id, node2_id, ngrams_id, ngrams_type)
DO UPDATE set weight = node_node_ngrams.weight + excluded.weight
;
...
...
src/Gargantext/Database/Admin/Types/Node.hs
View file @
c9cd5e03
...
...
@@ -212,6 +212,7 @@ pgContextId = pgNodeId
newtype
NodeId
=
NodeId
Int
deriving
(
Read
,
Generic
,
Num
,
Eq
,
Ord
,
Enum
,
ToJSONKey
,
FromJSONKey
,
ToJSON
,
FromJSON
,
Hashable
,
Csv
.
ToField
)
-- TODO make another type?
type
ContextId
=
NodeId
...
...
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