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
a842c4aa
Commit
a842c4aa
authored
Aug 01, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT FIX] Search in corpus + score nullable and category nullable too.
parent
0404bc88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
Facet.hs
src/Gargantext/Database/Facet.hs
+6
-6
Learn.hs
src/Gargantext/Database/Learn.hs
+2
-2
NodeNode.hs
src/Gargantext/Database/Schema/NodeNode.hs
+6
-0
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+1
-1
No files found.
src/Gargantext/Database/Facet.hs
View file @
a842c4aa
...
...
@@ -69,7 +69,7 @@ type Favorite = Int
type
Title
=
Text
-- TODO remove Title
type
FacetDoc
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
Favorite
Int
type
FacetDoc
=
Facet
NodeId
UTCTime
Title
HyperdataDocument
(
Maybe
Favorite
)
(
Maybe
Double
)
type
FacetSources
=
FacetDoc
type
FacetAuthors
=
FacetDoc
type
FacetTerms
=
FacetDoc
...
...
@@ -146,7 +146,7 @@ instance ToSchema FacetDoc
-- | Mock and Quickcheck instances
instance
Arbitrary
FacetDoc
where
arbitrary
=
elements
[
FacetDoc
id'
(
jour
year
01
01
)
t
hp
cat
ngramCount
arbitrary
=
elements
[
FacetDoc
id'
(
jour
year
01
01
)
t
hp
(
Just
cat
)
(
Just
ngramCount
)
|
id'
<-
[
1
..
10
]
,
year
<-
[
1990
..
2000
]
,
t
<-
[
"title"
,
"another title"
]
...
...
@@ -164,8 +164,8 @@ type FacetDocRead = Facet (Column PGInt4 )
(
Column
PGTimestamptz
)
(
Column
PGText
)
(
Column
PGJsonb
)
(
Column
PGInt4
)
-- Category
(
Column
PGInt4
)
-- Score
(
Column
(
Nullable
PGInt4
)
)
-- Category
(
Column
(
Nullable
PGFloat8
)
)
-- Score
-----------------------------------------------------------------------
-----------------------------------------------------------------------
...
...
@@ -214,7 +214,7 @@ viewAuthorsDoc cId _ nt = proc () -> do
restrict
-<
_node_id
contact
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
_node_typename
doc
.==
(
pgInt4
$
nodeTypeId
nt
)
returnA
-<
FacetDoc
(
_node_id
doc
)
(
_node_date
doc
)
(
_node_name
doc
)
(
_node_hyperdata
doc
)
(
pgInt4
1
)
(
pgInt4
1
)
returnA
-<
FacetDoc
(
_node_id
doc
)
(
_node_date
doc
)
(
_node_name
doc
)
(
_node_hyperdata
doc
)
(
toNullable
$
pgInt4
1
)
(
toNullable
$
pgDouble
1
)
queryAuthorsDoc
::
Query
(
NodeRead
,
(
NodeNgramReadNull
,
(
NgramsReadNull
,
(
NodeNgramReadNull
,
NodeReadNull
))))
queryAuthorsDoc
=
leftJoin5
queryNodeTable
queryNodeNgramTable
queryNgramsTable
queryNodeNgramTable
queryNodeTable
cond12
cond23
cond34
cond45
...
...
@@ -251,7 +251,7 @@ viewDocuments cId t ntId = proc () -> do
restrict
-<
_node_typename
n
.==
(
pgInt4
ntId
)
restrict
-<
if
t
then
nn_category
nn
.==
(
pgInt4
0
)
else
nn_category
nn
.>=
(
pgInt4
1
)
returnA
-<
FacetDoc
(
_node_id
n
)
(
_node_date
n
)
(
_node_name
n
)
(
_node_hyperdata
n
)
(
nn_category
nn
)
(
pgInt4
1
)
returnA
-<
FacetDoc
(
_node_id
n
)
(
_node_date
n
)
(
_node_name
n
)
(
_node_hyperdata
n
)
(
toNullable
$
nn_category
nn
)
(
toNullable
$
nn_score
nn
)
------------------------------------------------------------------------
...
...
src/Gargantext/Database/Learn.hs
View file @
a842c4aa
...
...
@@ -45,7 +45,7 @@ moreLike cId o l order ft = do
getPriors
::
FavOrTrash
->
CorpusId
->
Cmd
err
(
Events
Bool
)
getPriors
ft
cId
=
do
docs_fav
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
2
)
docs_fav
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
Just
2
)
<$>
runViewDocuments
cId
False
Nothing
Nothing
Nothing
docs_trash
<-
List
.
take
(
List
.
length
docs_fav
)
...
...
@@ -62,7 +62,7 @@ moreLikeWith :: CorpusId -> Maybe Offset -> Maybe Limit -> Maybe OrderBy
->
FavOrTrash
->
Events
Bool
->
Cmd
err
[
FacetDoc
]
moreLikeWith
cId
o
l
order
ft
priors
=
do
docs_test
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
1
)
docs_test
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
Just
1
)
<$>
runViewDocuments
cId
False
o
Nothing
order
let
results
=
map
fst
...
...
src/Gargantext/Database/Schema/NodeNode.hs
View file @
a842c4aa
...
...
@@ -90,6 +90,12 @@ nodesNodes = runOpaQuery queryNodeNodeTable
instance
QueryRunnerColumnDefault
(
Nullable
PGInt4
)
Int
where
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
instance
QueryRunnerColumnDefault
(
Nullable
PGFloat8
)
Int
where
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
instance
QueryRunnerColumnDefault
(
Nullable
PGFloat8
)
Double
where
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
instance
QueryRunnerColumnDefault
PGFloat8
(
Maybe
Double
)
where
queryRunnerColumnDefault
=
fieldQueryRunnerColumn
...
...
src/Gargantext/Database/TextSearch.hs
View file @
a842c4aa
...
...
@@ -70,7 +70,7 @@ queryInCorpus cId t q = proc () -> do
else
(
nn_category
nn
)
.>=
(
toNullable
$
pgInt4
1
)
restrict
-<
(
_ns_search
n
)
@@
(
pgTSQuery
(
unpack
q
))
restrict
-<
(
_ns_typename
n
)
.==
(
pgInt4
$
nodeTypeId
NodeDocument
)
returnA
-<
FacetDoc
(
_ns_id
n
)
(
_ns_date
n
)
(
_ns_name
n
)
(
_ns_hyperdata
n
)
(
pgInt4
1
)
(
pgInt4
1
)
returnA
-<
FacetDoc
(
_ns_id
n
)
(
_ns_date
n
)
(
_ns_name
n
)
(
_ns_hyperdata
n
)
(
nn_category
nn
)
(
nn_score
nn
)
joinInCorpus
::
O
.
Query
(
NodeSearchRead
,
NodeNodeReadNull
)
joinInCorpus
=
leftJoin
queryNodeSearchTable
queryNodeNodeTable
cond
...
...
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