diff --git a/src/Gargantext/Database/Flow.hs b/src/Gargantext/Database/Flow.hs index ecc63511a03e391bcd4487a4b08bb36204ebb51c..5725f57aee1f0d0b23634c1072e16a2f48e3c52e 100644 --- a/src/Gargantext/Database/Flow.hs +++ b/src/Gargantext/Database/Flow.hs @@ -65,7 +65,7 @@ import Gargantext.Database.Root (getRoot) import Gargantext.Database.Schema.Ngrams -- (insertNgrams, Ngrams(..), NgramsIndexed(..), indexNgrams, NgramsType(..), text2ngrams, ngramsTypeId) import Gargantext.Database.Schema.Node -- (mkRoot, mkCorpus, getOrMkList, mkGraph, {-mkPhylo,-} mkDashboard, mkAnnuaire, getCorporaWithParentId, HasNodeError, NodeError(..), nodeError) -import Gargantext.Database.Schema.NodeNgrams (listInsertDb, getCgramsId) +import Gargantext.Database.Schema.NodeNgrams (listInsertDb , getCgramsId) import Gargantext.Database.Schema.NodeNodeNgrams2 -- (NodeNodeNgrams2, insertNodeNodeNgrams2) import Gargantext.Database.Schema.User (getUser, UserLight(..)) import Gargantext.Database.TextSearch (searchInDatabase) @@ -75,7 +75,7 @@ import Gargantext.Ext.IMT (toSchoolName) import Gargantext.Ext.IMTUser (deserialiseImtUsersFromFile) import Gargantext.Prelude import Gargantext.Text.Terms.Eleve (buildTries, toToken) ---import Gargantext.Text.List (buildNgramsLists,StopSize(..)) +import Gargantext.Text.List (buildNgramsLists,StopSize(..)) import Gargantext.Text.Corpus.Parsers (parseFile, FileFormat) import qualified Gargantext.Text.Corpus.API.Isidore as Isidore import Gargantext.Text.Terms (TermType(..), tt_lang, extractTerms, uniText) @@ -214,7 +214,7 @@ flowCorpusUser :: (FlowCmdM env err m, MkCorpus c) -> Maybe c -> [NodeId] -> m CorpusId -flowCorpusUser _l userName corpusName ctype ids = do +flowCorpusUser l userName corpusName ctype ids = do -- User Flow (userId, _rootId, userCorpusId) <- getOrMk_RootWithCorpus userName corpusName ctype listId <- getOrMkList userCorpusId userId @@ -226,10 +226,10 @@ flowCorpusUser _l userName corpusName ctype ids = do -- printDebug "Node Text Id" tId -- User List Flow - (_masterUserId, _masterRootId, _masterCorpusId) <- getOrMk_RootWithCorpus userMaster (Left "") ctype - --ngs <- buildNgramsLists l 2 3 (StopSize 3) userCorpusId masterCorpusId - -- _userListId <- flowList_DbRepo listId ngs - --mastListId <- getOrMkList masterCorpusId masterUserId + (masterUserId, _masterRootId, masterCorpusId) <- getOrMk_RootWithCorpus userMaster (Left "") ctype + ngs <- buildNgramsLists l 2 3 (StopSize 3) userCorpusId masterCorpusId + _userListId <- flowList_DbRepo listId ngs + _mastListId <- getOrMkList masterCorpusId masterUserId -- _ <- insertOccsUpdates userCorpusId mastListId -- printDebug "userListId" userListId -- User Graph Flow diff --git a/src/Gargantext/Database/Init.hs b/src/Gargantext/Database/Init.hs index 17477197025b68f00eab1a8f08af8e624b7b8608..8505d090fdb9d95c2a4efc7aa3a7256622ca18d5 100644 --- a/src/Gargantext/Database/Init.hs +++ b/src/Gargantext/Database/Init.hs @@ -23,7 +23,7 @@ module Gargantext.Database.Init import Gargantext.Database.Utils (Cmd) import Gargantext.Prelude import Gargantext.Database.Triggers.Nodes (triggerSearchUpdate) -import Gargantext.Database.Triggers.NodesNodes (triggerDeleteCount, triggerInsertCount, triggerUpdateAdd, triggerUpdateDel, MasterListId, triggerCoocInsert) +import Gargantext.Database.Triggers.NodesNodes (triggerDeleteCount, triggerInsertCount, triggerUpdateAdd, triggerUpdateDel, MasterListId) -- , triggerCoocInsert) import Gargantext.Database.Triggers.NodeNodeNgrams (triggerCountInsert, triggerCountInsert2) ------------------------------------------------------------------------ @@ -32,7 +32,7 @@ initTriggers lId = do t0 <- triggerSearchUpdate t1 <- triggerCountInsert t1' <- triggerCountInsert2 - t1'' <- triggerCoocInsert lId + -- t1'' <- triggerCoocInsert lId t2 <- triggerDeleteCount lId t3 <- triggerInsertCount lId t4 <- triggerUpdateAdd lId @@ -40,7 +40,7 @@ initTriggers lId = do pure [t0 ,t1 ,t1' - ,t1'' + -- ,t1'' ,t2 ,t3 ,t4 diff --git a/src/Gargantext/Database/Schema/NodeNgrams.hs b/src/Gargantext/Database/Schema/NodeNgrams.hs index ee22b3e5d9138c9b2f87060acd5c297763451717..6d15271d1c8e3dc1dde742765f4e286d102f58bb 100644 --- a/src/Gargantext/Database/Schema/NodeNgrams.hs +++ b/src/Gargantext/Database/Schema/NodeNgrams.hs @@ -167,8 +167,8 @@ insertNodeNgrams nns = runPGSQuery query (PGS.Only $ Values fields nns') INSERT INTO node_ngrams (node_id, node_subtype, ngrams_id, ngrams_type, ngrams_field, ngrams_tag, ngrams_class, weight) SELECT i.node_id, i.node_subtype, ng.id, i.ngrams_type, i.ngrams_field, i.ngrams_tag, i.ngrams_class, i.weight FROM input as i INNER JOIN ngrams as ng ON ng.terms = i.ngrams_terms - ON CONFLICT(node_id, node_subtype, ngrams_id) - DO UPDATE SET node_subtype = excluded.node_subtype, ngrams_type = excluded.ngrams_type, ngrams_field = excluded.ngrams_field, ngrams_tag = excluded.ngrams_tag, ngrams_class = excluded.ngrams_class, weight = excluded.weight + ON CONFLICT(node_id, node_subtype, ngrams_id) DO NOTHING + -- DO UPDATE SET node_subtype = excluded.node_subtype, ngrams_type = excluded.ngrams_type, ngrams_field = excluded.ngrams_field, ngrams_tag = excluded.ngrams_tag, ngrams_class = excluded.ngrams_class, weight = excluded.weight RETURNING id, ngrams_type, ngrams_id ) SELECT return.ngrams_type, ng.terms, return.id FROM return