Commit 919007df authored by Alexandre Delanoë's avatar Alexandre Delanoë

[CLEAN] removing old queries

parent b3ad95a1
...@@ -115,30 +115,11 @@ searchInCorpusWithContacts cId aId q o l _order = ...@@ -115,30 +115,11 @@ searchInCorpusWithContacts cId aId q o l _order =
runOpaQuery $ limit' l runOpaQuery $ limit' l
$ offset' o $ offset' o
$ orderBy ( desc _fp_score) $ orderBy ( desc _fp_score)
$ group cId aId $ selectGroup cId aId
$ intercalate " | " $ intercalate " | "
$ map stemIt q $ map stemIt q
-- TODO group by
selectContactViaDoc selectContactViaDoc
:: CorpusId
-> AnnuaireId
-> Text
-> Select FacetPairedReadNull
selectContactViaDoc cId aId q = proc () -> do
(doc, (corpus_doc, (_contact_doc, (annuaire_contact, contact)))) <- queryContactViaDoc -< ()
restrict -< (doc^.ns_search) @@ (pgTSQuery $ unpack q )
restrict -< (doc^.ns_typename) .== (pgInt4 $ nodeTypeId NodeDocument)
restrict -< (corpus_doc^.nn_node1_id) .== (toNullable $ pgNodeId cId)
restrict -< (annuaire_contact^.nn_node1_id) .== (toNullable $ pgNodeId aId)
restrict -< (contact^.node_typename) .== (toNullable $ pgInt4 $ nodeTypeId NodeContact)
returnA -< FacetPaired (contact^.node_id)
(contact^.node_date)
(contact^.node_hyperdata)
(toNullable $ pgInt4 1)
selectContactViaDoc'
:: CorpusId :: CorpusId
-> AnnuaireId -> AnnuaireId
-> Text -> Text
...@@ -148,7 +129,7 @@ selectContactViaDoc' ...@@ -148,7 +129,7 @@ selectContactViaDoc'
, Column (Nullable PGJsonb) , Column (Nullable PGJsonb)
, Column (Nullable PGInt4) , Column (Nullable PGInt4)
) )
selectContactViaDoc' cId aId q = proc () -> do selectContactViaDoc cId aId q = proc () -> do
(doc, (corpus_doc, (_contact_doc, (annuaire_contact, contact)))) <- queryContactViaDoc -< () (doc, (corpus_doc, (_contact_doc, (annuaire_contact, contact)))) <- queryContactViaDoc -< ()
restrict -< (doc^.ns_search) @@ (pgTSQuery $ unpack q ) restrict -< (doc^.ns_search) @@ (pgTSQuery $ unpack q )
restrict -< (doc^.ns_typename) .== (pgInt4 $ nodeTypeId NodeDocument) restrict -< (doc^.ns_typename) .== (pgInt4 $ nodeTypeId NodeDocument)
...@@ -161,13 +142,13 @@ selectContactViaDoc' cId aId q = proc () -> do ...@@ -161,13 +142,13 @@ selectContactViaDoc' cId aId q = proc () -> do
, toNullable $ pgInt4 1 , toNullable $ pgInt4 1
) )
group :: NodeId selectGroup :: NodeId
-> NodeId -> NodeId
-> Text -> Text
-> Select FacetPairedReadNull -> Select FacetPairedReadNull
group cId aId q = proc () -> do selectGroup cId aId q = proc () -> do
(a, b, c, d) <- aggregate (p4 (groupBy, groupBy, groupBy, O.sum)) (a, b, c, d) <- aggregate (p4 (groupBy, groupBy, groupBy, O.sum))
(selectContactViaDoc' cId aId q) -< () (selectContactViaDoc cId aId q) -< ()
returnA -< FacetPaired a b c d returnA -< FacetPaired a b c d
......
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