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
b48eef4d
Commit
b48eef4d
authored
Feb 03, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Graph Search with selected node (context migration related)
parent
8d7076d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
36 deletions
+22
-36
Search.hs
src/Gargantext/Database/Action/Search.hs
+20
-17
Facet.hs
src/Gargantext/Database/Query/Facet.hs
+2
-19
No files found.
src/Gargantext/Database/Action/Search.hs
View file @
b48eef4d
...
@@ -25,8 +25,11 @@ import Gargantext.Database.Query.Facet
...
@@ -25,8 +25,11 @@ import Gargantext.Database.Query.Facet
import
Gargantext.Database.Query.Filter
import
Gargantext.Database.Query.Filter
import
Gargantext.Database.Query.Join
(
leftJoin5
)
import
Gargantext.Database.Query.Join
(
leftJoin5
)
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Context
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Table.NodeContext
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Context
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Opaleye
hiding
(
Order
)
import
Opaleye
hiding
(
Order
)
...
@@ -80,27 +83,27 @@ queryInCorpus :: HasDBid NodeType
...
@@ -80,27 +83,27 @@ queryInCorpus :: HasDBid NodeType
->
Text
->
Text
->
O
.
Select
FacetDocRead
->
O
.
Select
FacetDocRead
queryInCorpus
cId
t
q
=
proc
()
->
do
queryInCorpus
cId
t
q
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
(
c
,
nc
)
<-
joinInCorpus
-<
()
restrict
-<
(
n
n
^.
nn_node1
_id
)
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
(
n
c
^.
nc_node
_id
)
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
if
t
restrict
-<
if
t
then
(
n
n
^.
nn
_category
)
.==
(
toNullable
$
sqlInt4
0
)
then
(
n
c
^.
nc
_category
)
.==
(
toNullable
$
sqlInt4
0
)
else
(
n
n
^.
nn
_category
)
.>=
(
toNullable
$
sqlInt4
1
)
else
(
n
c
^.
nc
_category
)
.>=
(
toNullable
$
sqlInt4
1
)
restrict
-<
(
n
^.
n
s_search
)
@@
(
sqlTSQuery
(
unpack
q
))
restrict
-<
(
c
^.
c
s_search
)
@@
(
sqlTSQuery
(
unpack
q
))
restrict
-<
(
n
^.
n
s_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
restrict
-<
(
c
^.
c
s_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
returnA
-<
FacetDoc
{
facetDoc_id
=
n
^.
n
s_id
returnA
-<
FacetDoc
{
facetDoc_id
=
c
^.
c
s_id
,
facetDoc_created
=
n
^.
n
s_date
,
facetDoc_created
=
c
^.
c
s_date
,
facetDoc_title
=
n
^.
n
s_name
,
facetDoc_title
=
c
^.
c
s_name
,
facetDoc_hyperdata
=
n
^.
n
s_hyperdata
,
facetDoc_hyperdata
=
c
^.
c
s_hyperdata
,
facetDoc_category
=
nn
^.
nn
_category
,
facetDoc_category
=
nc
^.
nc
_category
,
facetDoc_ngramCount
=
n
n
^.
nn
_score
,
facetDoc_ngramCount
=
n
c
^.
nc
_score
,
facetDoc_score
=
nn
^.
nn
_score
,
facetDoc_score
=
nc
^.
nc
_score
}
}
joinInCorpus
::
O
.
Select
(
NodeSearchRead
,
NodeNode
ReadNull
)
joinInCorpus
::
O
.
Select
(
ContextSearchRead
,
NodeContext
ReadNull
)
joinInCorpus
=
leftJoin
query
NodeSearchTable
queryNodeNode
Table
cond
joinInCorpus
=
leftJoin
query
ContextSearchTable
queryNodeContext
Table
cond
where
where
cond
::
(
NodeSearchRead
,
NodeNode
Read
)
->
Column
SqlBool
cond
::
(
ContextSearchRead
,
NodeContext
Read
)
->
Column
SqlBool
cond
(
n
,
nn
)
=
nn
^.
nn_node2_id
.==
_ns_id
n
cond
(
c
,
nc
)
=
nc
^.
nc_context_id
.==
_cs_id
c
------------------------------------------------------------------------
------------------------------------------------------------------------
searchInCorpusWithContacts
searchInCorpusWithContacts
...
...
src/Gargantext/Database/Query/Facet.hs
View file @
b48eef4d
...
@@ -20,7 +20,7 @@ Portability : POSIX
...
@@ -20,7 +20,7 @@ Portability : POSIX
module
Gargantext.Database.Query.Facet
module
Gargantext.Database.Query.Facet
(
runViewAuthorsDoc
(
runViewAuthorsDoc
,
runViewDocuments
,
runViewDocuments
,
viewDocuments'
--
, viewDocuments'
,
runCountDocuments
,
runCountDocuments
,
filterWith
,
filterWith
...
@@ -306,8 +306,7 @@ runViewDocuments cId t o l order query = do
...
@@ -306,8 +306,7 @@ runViewDocuments cId t o l order query = do
printDebug
"[runViewDocuments] sqlQuery"
$
showSql
sqlQuery
printDebug
"[runViewDocuments] sqlQuery"
$
showSql
sqlQuery
runOpaQuery
$
filterWith
o
l
order
sqlQuery
runOpaQuery
$
filterWith
o
l
order
sqlQuery
where
where
ntId
=
toDBid
NodeDocument
sqlQuery
=
viewDocuments
cId
t
(
toDBid
NodeDocument
)
query
sqlQuery
=
viewDocuments
cId
t
ntId
query
runCountDocuments
::
HasDBid
NodeType
=>
CorpusId
->
IsTrash
->
Maybe
Text
->
Cmd
err
Int
runCountDocuments
::
HasDBid
NodeType
=>
CorpusId
->
IsTrash
->
Maybe
Text
->
Cmd
err
Int
runCountDocuments
cId
t
mQuery
=
do
runCountDocuments
cId
t
mQuery
=
do
...
@@ -331,22 +330,6 @@ viewDocuments cId t ntId mQuery = viewDocumentsQuery cId t ntId mQuery >>> proc
...
@@ -331,22 +330,6 @@ viewDocuments cId t ntId mQuery = viewDocumentsQuery cId t ntId mQuery >>> proc
,
facetDoc_score
=
toNullable
$
nc
^.
nc_score
,
facetDoc_score
=
toNullable
$
nc
^.
nc_score
}
}
viewDocuments'
::
CorpusId
->
IsTrash
->
NodeTypeId
->
Maybe
Text
->
Select
NodeRead
viewDocuments'
cId
t
ntId
mQuery
=
viewDocumentsQuery
cId
t
ntId
mQuery
>>>
proc
(
c
,
_nc
)
->
do
returnA
-<
Node
{
_node_id
=
_cs_id
c
,
_node_hash_id
=
""
,
_node_typename
=
_cs_typename
c
,
_node_user_id
=
_cs_user_id
c
,
_node_parent_id
=
-
1
,
_node_name
=
_cs_name
c
,
_node_date
=
_cs_date
c
,
_node_hyperdata
=
_cs_hyperdata
c
}
viewDocumentsQuery
::
CorpusId
viewDocumentsQuery
::
CorpusId
->
IsTrash
->
IsTrash
->
NodeTypeId
->
NodeTypeId
...
...
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