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
c74fd659
Commit
c74fd659
authored
Jun 26, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] quick fix for the text search (need to debug still).
parent
11e9154c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
Search.hs
src/Gargantext/API/Search.hs
+4
-2
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+14
-14
No files found.
src/Gargantext/API/Search.hs
View file @
c74fd659
...
...
@@ -72,7 +72,8 @@ instance Arbitrary SearchInQuery where
-----------------------------------------------------------------------
data
SearchResults
=
SearchResults
{
srs_results
::
[
FacetPaired
Int
UTCTime
HyperdataDocument
Int
[
Pair
Int
Text
]]}
data
SearchResults
=
SearchResults'
{
srs_resultsP
::
[
FacetDoc
]}
|
SearchResults
{
srs_results
::
[
FacetPaired
Int
UTCTime
HyperdataDocument
Int
[
Pair
Int
Text
]]}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"srs_"
)
''
S
earchResults
)
...
...
@@ -96,6 +97,7 @@ search (SearchQuery q pId) o l order =
searchIn
::
NodeId
->
SearchInQuery
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
SearchResults
searchIn
nId
(
SearchInQuery
q
)
o
l
order
=
SearchResults
<$>
searchInCorpusWithContacts
nId
q
o
l
order
SearchResults'
<$>
searchInCorpus
nId
q
o
l
order
--SearchResults <$> searchInCorpusWithContacts nId q o l order
src/Gargantext/Database/TextSearch.hs
View file @
c74fd659
...
...
@@ -32,7 +32,7 @@ import Gargantext.Database.Facet
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Ngrams
import
Gargantext.Database.Schema.NodeNode
hiding
(
joinInCorpus
)
import
Gargantext.Database.Schema.NodeN
gram
import
Gargantext.Database.Schema.NodeN
odeNgrams
import
Gargantext.Database.Queries.Join
(
leftJoin6
)
import
Gargantext.Database.Utils
(
Cmd
,
runPGSQuery
,
runOpaQuery
)
import
Gargantext.Text.Terms.Mono.Stem.En
(
stemIt
)
...
...
@@ -101,31 +101,31 @@ searchInCorpusWithContacts' cId q o l order = runOpaQuery $ queryInCorpusWithCon
queryInCorpusWithContacts
::
CorpusId
->
Text
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
O
.
Query
FacetPairedRead
queryInCorpusWithContacts
cId
q
_
_
_
=
proc
()
->
do
(
docs
,
(
corpusDoc
,
(
docNgrams
,
(
ngrams'
,
(
_
,
contacts
)))))
<-
joinInCorpusWithContacts
-<
()
(
docs
,
(
corpusDoc
,
(
_
docNgrams
,
(
ngrams'
,
(
_
,
contacts
)))))
<-
joinInCorpusWithContacts
-<
()
restrict
-<
(
_ns_search
docs
)
@@
(
pgTSQuery
$
unpack
q
)
restrict
-<
(
_ns_typename
docs
)
.==
(
pgInt4
$
nodeTypeId
NodeDocument
)
restrict
-<
(
nn_node1_id
corpusDoc
)
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
(
nng_listType
docNgrams
)
.==
(
toNullable
$
pgNgramsType
Authors
)
--
restrict -< (nng_listType docNgrams) .== (toNullable $ pgNgramsType Authors)
restrict
-<
(
_node_typename
contacts
)
.==
(
toNullable
$
pgInt4
$
nodeTypeId
NodeContact
)
-- let contact_id = ifThenElse (isNull $ _node_id contacts) (toNullable $ pgInt4 0) (_node_id contacts)
returnA
-<
FacetPaired
(
_ns_id
docs
)
(
_ns_date
docs
)
(
_ns_hyperdata
docs
)
(
pgInt4
0
)
(
Pair
(
_node_id
contacts
)
(
ngrams_terms
ngrams'
))
joinInCorpusWithContacts
::
O
.
Query
(
NodeSearchRead
,
(
NodeNodeReadNull
,
(
NodeN
gramReadNull
,
(
NgramsReadNull
,
(
NodeNgram
ReadNull
,
NodeReadNull
)))))
joinInCorpusWithContacts
=
leftJoin6
queryNodeTable
queryNodeN
gramTable
queryNgramsTable
queryNodeNgram
Table
queryNodeNodeTable
queryNodeSearchTable
cond12
cond23
cond34
cond45
cond56
joinInCorpusWithContacts
::
O
.
Query
(
NodeSearchRead
,
(
NodeNodeReadNull
,
(
NodeN
odeNgramsReadNull
,
(
NgramsReadNull
,
(
NodeNodeNgrams
ReadNull
,
NodeReadNull
)))))
joinInCorpusWithContacts
=
leftJoin6
queryNodeTable
queryNodeN
odeNgramsTable
queryNgramsTable
queryNodeNodeNgrams
Table
queryNodeNodeTable
queryNodeSearchTable
cond12
cond23
cond34
cond45
cond56
where
cond12
::
(
NodeN
gram
Read
,
NodeRead
)
->
Column
PGBool
cond12
(
ng3
,
n2
)
=
_node_id
n2
.==
nn
g_node
_id
ng3
cond12
::
(
NodeN
odeNgrams
Read
,
NodeRead
)
->
Column
PGBool
cond12
(
ng3
,
n2
)
=
_node_id
n2
.==
nn
ng_node1
_id
ng3
---------
cond23
::
(
NgramsRead
,
(
NodeN
gram
Read
,
NodeReadNull
))
->
Column
PGBool
cond23
(
ng2
,
(
nn
g2
,
_
))
=
nng_ngrams_id
nng2
.==
ngrams_id
ng2
cond23
::
(
NgramsRead
,
(
NodeN
odeNgrams
Read
,
NodeReadNull
))
->
Column
PGBool
cond23
(
ng2
,
(
nn
ng2
,
_
))
=
nnng_ngrams_id
n
nng2
.==
ngrams_id
ng2
cond34
::
(
NodeN
gramRead
,
(
NgramsRead
,
(
NodeNgram
ReadNull
,
NodeReadNull
)))
->
Column
PGBool
cond34
(
nng
,
(
ng
,
(
_
,
_
)))
=
ngrams_id
ng
.==
nng_ngrams_id
nng
cond34
::
(
NodeN
odeNgramsRead
,
(
NgramsRead
,
(
NodeNodeNgrams
ReadNull
,
NodeReadNull
)))
->
Column
PGBool
cond34
(
nng
,
(
ng
,
(
_
,
_
)))
=
ngrams_id
ng
.==
nn
n
g_ngrams_id
nng
cond45
::
(
NodeNodeRead
,
(
NodeN
gramRead
,
(
NgramsReadNull
,
(
NodeNgram
ReadNull
,
NodeReadNull
))))
->
Column
PGBool
cond45
(
nn
,
(
nng
,
(
_
,(
_
,
_
))))
=
nn
g_node
_id
nng
.==
nn_node2_id
nn
cond45
::
(
NodeNodeRead
,
(
NodeN
odeNgramsRead
,
(
NgramsReadNull
,
(
NodeNodeNgrams
ReadNull
,
NodeReadNull
))))
->
Column
PGBool
cond45
(
nn
,
(
nng
,
(
_
,(
_
,
_
))))
=
nn
ng_node1
_id
nng
.==
nn_node2_id
nn
cond56
::
(
NodeSearchRead
,
(
NodeNodeRead
,
(
NodeN
gramReadNull
,
(
NgramsReadNull
,
(
NodeNgram
ReadNull
,
NodeReadNull
)))))
->
Column
PGBool
cond56
::
(
NodeSearchRead
,
(
NodeNodeRead
,
(
NodeN
odeNgramsReadNull
,
(
NgramsReadNull
,
(
NodeNodeNgrams
ReadNull
,
NodeReadNull
)))))
->
Column
PGBool
cond56
(
n
,
(
nn
,
(
_
,(
_
,(
_
,
_
)))))
=
_ns_id
n
.==
nn_node2_id
nn
...
...
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