Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
gargantext
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
Show 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
import
Gargantext.Database.Query.Filter
import
Gargantext.Database.Query.Join
(
leftJoin5
)
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Context
import
Gargantext.Database.Query.Table.NodeNode
import
Gargantext.Database.Query.Table.NodeContext
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Context
import
Gargantext.Prelude
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Opaleye
hiding
(
Order
)
...
...
@@ -80,27 +83,27 @@ queryInCorpus :: HasDBid NodeType
->
Text
->
O
.
Select
FacetDocRead
queryInCorpus
cId
t
q
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
(
n
n
^.
nn_node1
_id
)
.==
(
toNullable
$
pgNodeId
cId
)
(
c
,
nc
)
<-
joinInCorpus
-<
()
restrict
-<
(
n
c
^.
nc_node
_id
)
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
if
t
then
(
n
n
^.
nn
_category
)
.==
(
toNullable
$
sqlInt4
0
)
else
(
n
n
^.
nn
_category
)
.>=
(
toNullable
$
sqlInt4
1
)
restrict
-<
(
n
^.
n
s_search
)
@@
(
sqlTSQuery
(
unpack
q
))
restrict
-<
(
n
^.
n
s_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
returnA
-<
FacetDoc
{
facetDoc_id
=
n
^.
n
s_id
,
facetDoc_created
=
n
^.
n
s_date
,
facetDoc_title
=
n
^.
n
s_name
,
facetDoc_hyperdata
=
n
^.
n
s_hyperdata
,
facetDoc_category
=
nn
^.
nn
_category
,
facetDoc_ngramCount
=
n
n
^.
nn
_score
,
facetDoc_score
=
nn
^.
nn
_score
then
(
n
c
^.
nc
_category
)
.==
(
toNullable
$
sqlInt4
0
)
else
(
n
c
^.
nc
_category
)
.>=
(
toNullable
$
sqlInt4
1
)
restrict
-<
(
c
^.
c
s_search
)
@@
(
sqlTSQuery
(
unpack
q
))
restrict
-<
(
c
^.
c
s_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
returnA
-<
FacetDoc
{
facetDoc_id
=
c
^.
c
s_id
,
facetDoc_created
=
c
^.
c
s_date
,
facetDoc_title
=
c
^.
c
s_name
,
facetDoc_hyperdata
=
c
^.
c
s_hyperdata
,
facetDoc_category
=
nc
^.
nc
_category
,
facetDoc_ngramCount
=
n
c
^.
nc
_score
,
facetDoc_score
=
nc
^.
nc
_score
}
joinInCorpus
::
O
.
Select
(
NodeSearchRead
,
NodeNode
ReadNull
)
joinInCorpus
=
leftJoin
query
NodeSearchTable
queryNodeNode
Table
cond
joinInCorpus
::
O
.
Select
(
ContextSearchRead
,
NodeContext
ReadNull
)
joinInCorpus
=
leftJoin
query
ContextSearchTable
queryNodeContext
Table
cond
where
cond
::
(
NodeSearchRead
,
NodeNode
Read
)
->
Column
SqlBool
cond
(
n
,
nn
)
=
nn
^.
nn_node2_id
.==
_ns_id
n
cond
::
(
ContextSearchRead
,
NodeContext
Read
)
->
Column
SqlBool
cond
(
c
,
nc
)
=
nc
^.
nc_context_id
.==
_cs_id
c
------------------------------------------------------------------------
searchInCorpusWithContacts
...
...
src/Gargantext/Database/Query/Facet.hs
View file @
b48eef4d
...
...
@@ -20,7 +20,7 @@ Portability : POSIX
module
Gargantext.Database.Query.Facet
(
runViewAuthorsDoc
,
runViewDocuments
,
viewDocuments'
--
, viewDocuments'
,
runCountDocuments
,
filterWith
...
...
@@ -306,8 +306,7 @@ runViewDocuments cId t o l order query = do
printDebug
"[runViewDocuments] sqlQuery"
$
showSql
sqlQuery
runOpaQuery
$
filterWith
o
l
order
sqlQuery
where
ntId
=
toDBid
NodeDocument
sqlQuery
=
viewDocuments
cId
t
ntId
query
sqlQuery
=
viewDocuments
cId
t
(
toDBid
NodeDocument
)
query
runCountDocuments
::
HasDBid
NodeType
=>
CorpusId
->
IsTrash
->
Maybe
Text
->
Cmd
err
Int
runCountDocuments
cId
t
mQuery
=
do
...
...
@@ -331,22 +330,6 @@ viewDocuments cId t ntId mQuery = viewDocumentsQuery cId t ntId mQuery >>> proc
,
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
->
IsTrash
->
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