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
200
Issues
200
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
16b9aff8
Commit
16b9aff8
authored
Jul 25, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] PairWith with Maybe ListId
parent
919007df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
27 deletions
+30
-27
Node.hs
src/Gargantext/API/Node.hs
+1
-1
Search.hs
src/Gargantext/API/Search.hs
+23
-22
Pairing.hs
src/Gargantext/Database/Action/Flow/Pairing.hs
+6
-4
No files found.
src/Gargantext/API/Node.hs
View file @
16b9aff8
...
...
@@ -276,7 +276,7 @@ pairs cId = do
type
PairWith
=
Summary
"Pair a Corpus with an Annuaire"
:>
"annuaire"
:>
Capture
"annuaire_id"
AnnuaireId
:>
"list"
:>
Capture
"list_id"
ListId
:>
QueryParam
"list_id"
ListId
:>
Post
'[
J
SON
]
Int
pairWith
::
CorpusId
->
GargServer
PairWith
...
...
src/Gargantext/API/Search.hs
View file @
16b9aff8
...
...
@@ -49,27 +49,6 @@ instance Arbitrary SearchQuery where
arbitrary
=
elements
[
SearchQuery
[
"electrodes"
]]
-----------------------------------------------------------------------
data
SearchDocResults
=
SearchDocResults
{
sdr_results
::
[
FacetDoc
]}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"sdr_"
)
''
S
earchDocResults
)
instance
Arbitrary
SearchDocResults
where
arbitrary
=
SearchDocResults
<$>
arbitrary
instance
ToSchema
SearchDocResults
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"sdr_"
)
data
SearchPairedResults
=
SearchPairedResults
{
spr_results
::
[
FacetPaired
Int
UTCTime
HyperdataContact
Int
]
}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"spr_"
)
''
S
earchPairedResults
)
instance
Arbitrary
SearchPairedResults
where
arbitrary
=
SearchPairedResults
<$>
arbitrary
instance
ToSchema
SearchPairedResults
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"spr_"
)
-----------------------------------------------------------------------
-- TODO-ACCESS: CanSearch? or is it part of CanGetNode
-- TODO-EVENTS: No event, this is a read-only query.
...
...
@@ -86,15 +65,37 @@ searchDocs nId (SearchQuery q) o l order =
SearchDocResults
<$>
searchInCorpus
nId
False
q
o
l
order
--SearchResults <$> searchInCorpusWithContacts nId q o l order
data
SearchDocResults
=
SearchDocResults
{
sdr_results
::
[
FacetDoc
]}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"sdr_"
)
''
S
earchDocResults
)
instance
Arbitrary
SearchDocResults
where
arbitrary
=
SearchDocResults
<$>
arbitrary
instance
ToSchema
SearchDocResults
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"sdr_"
)
-----------------------------------------------------------------------
type
SearchPairsAPI
=
Summary
""
:>
"list"
:>
Capture
"annuaire"
AnnuaireId
:>
SearchAPI
SearchPairedResults
searchPairs
::
NodeId
->
GargServer
SearchPairsAPI
searchPairs
pId
aId
(
SearchQuery
q
)
o
l
order
=
SearchPairedResults
<$>
searchInCorpusWithContacts
pId
aId
q
o
l
order
data
SearchPairedResults
=
SearchPairedResults
{
spr_results
::
[
FacetPaired
Int
UTCTime
HyperdataContact
Int
]
}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"spr_"
)
''
S
earchPairedResults
)
instance
Arbitrary
SearchPairedResults
where
arbitrary
=
SearchPairedResults
<$>
arbitrary
instance
ToSchema
SearchPairedResults
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"spr_"
)
-----------------------------------------------------------------------
src/Gargantext/Database/Action/Flow/Pairing.hs
View file @
16b9aff8
...
...
@@ -35,6 +35,7 @@ import Gargantext.Database.Prelude (Cmd, runOpaQuery)
import
Gargantext.Database.Query.Prelude
(
leftJoin2
,
returnA
,
queryNodeNodeTable
)
import
Gargantext.Database.Query.Table.Node.Children
(
getAllContacts
)
import
Gargantext.Database.Query.Table.Node.Select
(
selectNodesWithUsername
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
import
Gargantext.Database.Schema.Ngrams
-- (NgramsType(..))
import
Gargantext.Database.Schema.Node
import
Gargantext.Prelude
hiding
(
sum
)
...
...
@@ -65,11 +66,12 @@ isPairedWith nt nId = runOpaQuery (selectQuery nt nId)
cond
(
node
,
node_node
)
=
node
^.
node_id
.==
node_node
^.
nn_node2_id
-----------------------------------------------------------------------
pairing
::
AnnuaireId
->
CorpusId
->
ListId
->
GargNoServer
Int
pairing
a
c
l
=
do
pairing
::
AnnuaireId
->
CorpusId
->
Maybe
ListId
->
GargNoServer
Int
pairing
a
c
l'
=
do
l
<-
case
l'
of
Nothing
->
defaultList
c
Just
l''
->
pure
l''
dataPaired
<-
dataPairing
a
(
c
,
l
,
Authors
)
takeName
takeName
insertDB
$
prepareInsert
dataPaired
...
...
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