Commit fd4a7810 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[BOARD] enabling it in the Tree + cosmetics.

parent ce9814b9
...@@ -1044,14 +1044,14 @@ getTableNgrams _nType nId tabType listId limit_ offset ...@@ -1044,14 +1044,14 @@ getTableNgrams _nType nId tabType listId limit_ offset
-- trace (show lists) $ -- trace (show lists) $
-- getNgramsTableMap ({-lists <>-} listIds) ngramsType -- getNgramsTableMap ({-lists <>-} listIds) ngramsType
let nSco = needsScores orderBy let scoresNeeded = needsScores orderBy
tableMap1 <- getNgramsTableMap listId ngramsType tableMap1 <- getNgramsTableMap listId ngramsType
t1 <- getTime' t1 <- getTime'
tableMap2 <- tableMap1 & v_data %%~ setScores nSco tableMap2 <- tableMap1 & v_data %%~ setScores scoresNeeded
. Map.mapWithKey ngramsElementFromRepo . Map.mapWithKey ngramsElementFromRepo
t2 <- getTime' t2 <- getTime'
tableMap3 <- tableMap2 & v_data %%~ fmap NgramsTable tableMap3 <- tableMap2 & v_data %%~ fmap NgramsTable
. setScores (not nSco) . setScores (not scoresNeeded)
. selectAndPaginate . selectAndPaginate
t3 <- getTime' t3 <- getTime'
liftIO $ hprint stderr liftIO $ hprint stderr
...@@ -1059,7 +1059,7 @@ getTableNgrams _nType nId tabType listId limit_ offset ...@@ -1059,7 +1059,7 @@ getTableNgrams _nType nId tabType listId limit_ offset
% " map1=" % timeSpecs % " map1=" % timeSpecs
% " map2=" % timeSpecs % " map2=" % timeSpecs
% " map3=" % timeSpecs % " map3=" % timeSpecs
% " sql=" % (if nSco then "map2" else "map3") % " sql=" % (if scoresNeeded then "map2" else "map3")
% "\n" % "\n"
) t0 t3 t0 t1 t1 t2 t2 t3 ) t0 t3 t0 t1 t1 t2 t2 t3
pure tableMap3 pure tableMap3
......
...@@ -174,17 +174,17 @@ getOccByNgramsOnlyFast' cId lId nt tms = trace (show (cId, lId)) $ ...@@ -174,17 +174,17 @@ getOccByNgramsOnlyFast' cId lId nt tms = trace (show (cId, lId)) $
where where
fields = [QualifiedIdentifier Nothing "text"] fields = [QualifiedIdentifier Nothing "text"]
run :: CorpusId run :: CorpusId
-> ListId -> ListId
-> NgramsType -> NgramsType
-> [Text] -> [Text]
-> Cmd err [(Text, Double)] -> Cmd err [(Text, Double)]
run cId' lId' _nt' tms' = runPGSQuery query run cId' lId' nt' tms' = runPGSQuery query
( Values fields (DPS.Only <$> tms') ( Values fields (DPS.Only <$> tms')
, cId' , cId'
, lId' , lId'
-- , ngramsTypeId nt' , ngramsTypeId nt'
) )
query :: DPS.Query query :: DPS.Query
...@@ -193,10 +193,10 @@ getOccByNgramsOnlyFast' cId lId nt tms = trace (show (cId, lId)) $ ...@@ -193,10 +193,10 @@ getOccByNgramsOnlyFast' cId lId nt tms = trace (show (cId, lId)) $
SELECT ng.terms, nng.weight FROM node_node_ngrams nng SELECT ng.terms, nng.weight FROM node_node_ngrams nng
JOIN ngrams ng ON nng.ngrams_id = ng.id JOIN ngrams ng ON nng.ngrams_id = ng.id
JOIN input_rows ir ON ir.terms = ng.terms JOIN input_rows ir ON ir.terms = ng.terms
WHERE nng.node1_id = ? -- CorpusId WHERE nng.node1_id = ? -- CorpusId
AND nng.node2_id = ? AND nng.node2_id = ? -- ListId
-- AND nng.ngrams_type = ? -- NgramsTypeId AND nng.ngrams_type = ? -- NgramsTypeId
-- AND nn.category > 0 -- AND nn.category > 0 -- TODO
GROUP BY ng.terms, nng.weight GROUP BY ng.terms, nng.weight
|] |]
......
...@@ -108,7 +108,7 @@ dbTree rootId = map (\(nId, tId, pId, n) -> DbTreeNode nId tId pId n) ...@@ -108,7 +108,7 @@ dbTree rootId = map (\(nId, tId, pId, n) -> DbTreeNode nId tId pId n)
FROM nodes AS c FROM nodes AS c
INNER JOIN tree AS s ON c.parent_id = s.id INNER JOIN tree AS s ON c.parent_id = s.id
WHERE c.typename IN (2,20,21,22,3,5,30,31,40,7,9,90) WHERE c.typename IN (2,20,21,22,3,5,30,31,40,7,9,90,71)
) )
SELECT * from tree; SELECT * from tree;
|] (Only rootId) |] (Only rootId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment