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
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
57fefab6
Commit
57fefab6
authored
Dec 12, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Database][Search] semantics ok.
parent
f1306624
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+9
-8
No files found.
src/Gargantext/Database/TextSearch.hs
View file @
57fefab6
...
...
@@ -67,12 +67,14 @@ joinInCorpus = leftJoin queryNodeSearchTable queryNodeNodeTable cond
cond
(
n
,
nn
)
=
nodeNode_node2_id
nn
.==
_ns_id
n
------------------------------------------------------------------------
getGraphCorpusAuthors
::
Connection
->
CorpusId
->
Text
->
IO
[((
Int
,
HyperdataDocument
),(
Int
,
Maybe
Text
))]
getGraphCorpusAuthors
c
cId
q
=
runQuery
c
$
selectGraphCorpusAuthors
cId
q
type
AuthorName
=
Text
selectGraphCorpusAuthors
::
CorpusId
->
Text
->
O
.
Query
((
Column
PGInt4
,
Column
PGJsonb
),
(
Column
(
PGInt4
),
Column
(
Nullable
PGText
)))
selectGraphCorpusAuthors
cId
q
=
proc
()
->
do
(
docs
,
(
corpusDoc
,
(
docNgrams
,
(
ngrams
,
(
ngramsContact
,
contacts
)))))
<-
queryGraphCorpusAuthors
-<
()
searchInCorpusWithContacts
::
Connection
->
CorpusId
->
Text
->
IO
[((
Int
,
HyperdataDocument
),(
ContactId
,
Maybe
AuthorName
))]
searchInCorpusWithContacts
c
cId
q
=
runQuery
c
$
queryInCorpusWithContacts
cId
q
queryInCorpusWithContacts
::
CorpusId
->
Text
->
O
.
Query
((
Column
PGInt4
,
Column
PGJsonb
),
(
Column
(
PGInt4
),
Column
(
Nullable
PGText
)))
queryInCorpusWithContacts
cId
q
=
proc
()
->
do
(
docs
,
(
corpusDoc
,
(
docNgrams
,
(
ngrams
,
(
ngramsContact
,
contacts
)))))
<-
joinInCorpusWithContacts
-<
()
restrict
-<
(
_ns_search
docs
)
@@
(
pgTSQuery
$
unpack
q
)
restrict
-<
(
_ns_typename
docs
)
.==
(
pgInt4
$
nodeTypeId
NodeDocument
)
restrict
-<
(
nodeNode_node1_id
corpusDoc
)
.==
(
toNullable
$
pgInt4
cId
)
...
...
@@ -81,9 +83,8 @@ selectGraphCorpusAuthors cId q = proc () -> do
-- let contact_id = ifThenElse (isNull $ _node_id contacts) (toNullable $ pgInt4 0) (_node_id contacts)
returnA
-<
((
_ns_id
docs
,
_ns_hyperdata
docs
),(
fromNullable
(
pgInt4
0
)
(
_node_id
contacts
),
ngrams_terms
ngrams
))
queryGraphCorpusAuthors
::
O
.
Query
(
NodeSearchRead
,
(
NodeNodeReadNull
,
(
NodeNgramReadNull
,
(
NgramsReadNull
,
(
NodeNgramReadNull
,
NodeReadNull
)))))
queryGraphCorpusAuthors
=
leftJoin6
queryNodeTable
queryNodeNgramTable
queryNgramsTable
queryNodeNgramTable
queryNodeNodeTable
queryNodeSearchTable
cond12
cond23
cond34
cond45
cond56
joinInCorpusWithContacts
::
O
.
Query
(
NodeSearchRead
,
(
NodeNodeReadNull
,
(
NodeNgramReadNull
,
(
NgramsReadNull
,
(
NodeNgramReadNull
,
NodeReadNull
)))))
joinInCorpusWithContacts
=
leftJoin6
queryNodeTable
queryNodeNgramTable
queryNgramsTable
queryNodeNgramTable
queryNodeNodeTable
queryNodeSearchTable
cond12
cond23
cond34
cond45
cond56
where
cond12
::
(
NodeNgramRead
,
NodeRead
)
->
Column
PGBool
cond12
(
ng3
,
n2
)
=
_node_id
n2
.==
nodeNgram_node_id
ng3
...
...
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