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
163
Issues
163
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
495436ed
Verified
Commit
495436ed
authored
Jun 09, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] get contexts for ngrams fix
parent
d19839d8
Pipeline
#7657
passed with stages
in 48 minutes and 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
GraphQL.hs
src/Gargantext/API/GraphQL.hs
+0
-1
Context.hs
src/Gargantext/API/GraphQL/Context.hs
+5
-5
NodeContext.hs
src/Gargantext/Database/Query/Table/NodeContext.hs
+2
-2
No files found.
src/Gargantext/API/GraphQL.hs
View file @
495436ed
...
@@ -15,7 +15,6 @@ Portability : POSIX
...
@@ -15,7 +15,6 @@ Portability : POSIX
{-# LANGUAGE KindSignatures #-}
-- for use of Endpoint (name :: Symbol)
{-# LANGUAGE KindSignatures #-}
-- for use of Endpoint (name :: Symbol)
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PartialTypeSignatures #-}
-- to automatically use suggested type hole signatures during compilation
{-# LANGUAGE PartialTypeSignatures #-}
-- to automatically use suggested type hole signatures during compilation
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.GraphQL
where
module
Gargantext.API.GraphQL
where
...
...
src/Gargantext/API/GraphQL/Context.hs
View file @
495436ed
...
@@ -22,8 +22,7 @@ import Data.Morpheus.Types
...
@@ -22,8 +22,7 @@ import Data.Morpheus.Types
,
ResolverM
,
ResolverM
,
QUERY
,
QUERY
)
)
import
Data.Text
(
pack
,
unpack
)
import
Data.Text
(
pack
)
import
Data.Text
qualified
as
Text
import
Data.Time.Format.ISO8601
(
iso8601Show
)
import
Data.Time.Format.ISO8601
(
iso8601Show
)
import
Gargantext.API.Admin.Auth.Types
(
AuthenticatedUser
)
import
Gargantext.API.Admin.Auth.Types
(
AuthenticatedUser
)
import
Gargantext.API.Auth.PolicyCheck
(
nodeWriteChecks
,
AccessPolicyManager
)
import
Gargantext.API.Auth.PolicyCheck
(
nodeWriteChecks
,
AccessPolicyManager
)
...
@@ -97,7 +96,7 @@ data ContextsForNgramsArgs
...
@@ -97,7 +96,7 @@ data ContextsForNgramsArgs
=
ContextsForNgramsArgs
=
ContextsForNgramsArgs
{
corpus_id
::
Int
{
corpus_id
::
Int
,
ngrams_terms
::
[
Text
]
,
ngrams_terms
::
[
Text
]
,
and_logic
::
Text
,
and_logic
::
Bool
}
deriving
(
Generic
,
GQLType
)
}
deriving
(
Generic
,
GQLType
)
data
NodeContextCategoryMArgs
=
NodeContextCategoryMArgs
data
NodeContextCategoryMArgs
=
NodeContextCategoryMArgs
...
@@ -153,9 +152,10 @@ dbNodeContext context_id node_id = do
...
@@ -153,9 +152,10 @@ dbNodeContext context_id node_id = do
-- | Returns list of `ContextGQL` for given ngrams in given corpus id.
-- | Returns list of `ContextGQL` for given ngrams in given corpus id.
dbContextForNgrams
dbContextForNgrams
::
(
IsDBEnvExtra
env
)
::
(
IsDBEnvExtra
env
)
=>
Int
->
[
Text
]
->
Text
->
GqlM
e
env
[
ContextGQL
]
=>
Int
->
[
Text
]
->
Bool
->
GqlM
e
env
[
ContextGQL
]
dbContextForNgrams
node_id
ngrams_terms
and_logic
=
do
dbContextForNgrams
node_id
ngrams_terms
and_logic
=
do
contextsForNgramsTerms
<-
lift
$
runDBQuery
$
getContextsForNgramsTerms
(
UnsafeMkNodeId
node_id
)
ngrams_terms
(
readMaybe
$
unpack
$
Text
.
toTitle
and_logic
)
contextsForNgramsTerms
<-
lift
$
runDBQuery
$
getContextsForNgramsTerms
(
UnsafeMkNodeId
node_id
)
ngrams_terms
and_logic
--lift $ printDebug "[dbContextForNgrams] contextsForNgramsTerms" contextsForNgramsTerms
--lift $ printDebug "[dbContextForNgrams] contextsForNgramsTerms" contextsForNgramsTerms
pure
$
toContextGQL
<$>
contextsForNgramsTerms
pure
$
toContextGQL
<$>
contextsForNgramsTerms
...
...
src/Gargantext/Database/Query/Table/NodeContext.hs
View file @
495436ed
...
@@ -151,9 +151,9 @@ data ContextForNgramsTerms =
...
@@ -151,9 +151,9 @@ data ContextForNgramsTerms =
getContextsForNgramsTerms
::
HasNodeError
err
getContextsForNgramsTerms
::
HasNodeError
err
=>
NodeId
=>
NodeId
->
[
Text
]
->
[
Text
]
->
Maybe
Bool
->
Bool
->
DBQuery
err
x
[
ContextForNgramsTerms
]
->
DBQuery
err
x
[
ContextForNgramsTerms
]
getContextsForNgramsTerms
cId
ngramsTerms
(
Just
True
)
=
do
getContextsForNgramsTerms
cId
ngramsTerms
True
=
do
let
terms_length
=
length
ngramsTerms
let
terms_length
=
length
ngramsTerms
res
<-
mkPGQuery
query
(
cId
,
PGS
.
In
ngramsTerms
,
terms_length
)
res
<-
mkPGQuery
query
(
cId
,
PGS
.
In
ngramsTerms
,
terms_length
)
pure
$
(
\
(
_cfnt_nodeId
pure
$
(
\
(
_cfnt_nodeId
...
...
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