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
143840d4
Commit
143840d4
authored
Jul 29, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TABLE] search in docs, result as Facet.
parent
cc89bb12
Pipeline
#529
failed with stage
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
25 deletions
+37
-25
Node.hs
src/Gargantext/API/Node.hs
+29
-18
Search.hs
src/Gargantext/API/Search.hs
+0
-1
Learn.hs
src/Gargantext/Database/Learn.hs
+8
-6
No files found.
src/Gargantext/API/Node.hs
View file @
143840d4
...
...
@@ -51,7 +51,7 @@ import GHC.Generics (Generic)
import
Gargantext.API.Metrics
import
Gargantext.API.Ngrams
(
TabType
(
..
),
TableNgramsApi
,
apiNgramsTableCorpus
,
QueryParamR
,
TODO
)
import
Gargantext.API.Ngrams.NTree
(
MyTree
)
import
Gargantext.API.Search
(
SearchDocsAPI
,
searchDocs
)
import
Gargantext.API.Search
(
SearchDocsAPI
,
searchDocs
,
SearchQuery
(
..
)
)
import
Gargantext.API.Types
import
Gargantext.Core.Types
(
Offset
,
Limit
)
import
Gargantext.Core.Types.Main
(
Tree
,
NodeTree
,
ListType
)
...
...
@@ -62,6 +62,7 @@ import Gargantext.Database.Schema.Node ( getNodesWithParentId, getNode, getNode'
import
Gargantext.Database.Schema.NodeNode
(
nodeNodesCategory
)
import
Gargantext.Database.Tree
(
treeDB
)
import
Gargantext.Database.Types.Node
import
Gargantext.Database.TextSearch
import
Gargantext.Database.Utils
-- (Cmd, CmdM)
import
Gargantext.Database.Learn
(
FavOrTrash
(
..
),
moreLike
)
import
Gargantext.Prelude
...
...
@@ -171,7 +172,7 @@ nodeAPI p uId id
:<|>
getChildren
id
p
-- TODO gather it
:<|>
getTable
id
:<|>
tableApi
id
:<|>
apiNgramsTableCorpus
id
:<|>
getPairing
id
-- :<|> getTableNgramsDoc id
...
...
@@ -238,15 +239,17 @@ catApi = putCat
------------------------------------------------------------------------
type
TableApi
=
Summary
" Table API"
:>
ReqBody
'[
J
SON
]
SearchQuery
:>
QueryParam
"view"
TabType
:>
QueryParam
"offset"
Int
:>
QueryParam
"limit"
Int
:>
QueryParam
"order"
OrderBy
:>
Ge
t
'[
J
SON
]
[
FacetDoc
]
:>
Pos
t
'[
J
SON
]
[
FacetDoc
]
-- TODO adapt FacetDoc -> ListDoc (and add type of document as column)
type
PairingApi
=
Summary
" Pairing API"
:>
QueryParam
"view"
TabType
-- TODO change TabType -> DocType (CorpusId for pairing)
:>
QueryParam
"view"
TabType
-- TODO change TabType -> DocType (CorpusId for pairing)
:>
QueryParam
"offset"
Int
:>
QueryParam
"limit"
Int
:>
QueryParam
"order"
OrderBy
...
...
@@ -271,8 +274,6 @@ type TreeApi = Summary " Tree API"
:>
QueryParamR
"listType"
ListType
:>
Get
'[
J
SON
]
(
ChartMetrics
[
MyTree
])
-- Depending on the Type of the Node, we could post
-- New documents for a corpus
-- New map list terms
...
...
@@ -323,6 +324,16 @@ treeAPI = treeDB
rename
::
NodeId
->
RenameNode
->
Cmd
err
[
Int
]
rename
nId
(
RenameNode
name'
)
=
U
.
update
(
U
.
Rename
nId
name'
)
tableApi
::
NodeId
->
SearchQuery
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
tableApi
cId
(
SearchQuery
[]
)
ft
o
l
order
=
getTable
cId
ft
o
l
order
tableApi
cId
(
SearchQuery
q
)
ft
o
l
order
=
case
ft
of
Just
Docs
->
searchInCorpus
cId
q
o
l
order
Just
Trash
->
panic
"TODO search in Trash"
-- TODO searchInCorpus cId q o l order
_
->
panic
"not implemented: search in Fav/Trash/*"
getTable
::
NodeId
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
...
...
src/Gargantext/API/Search.hs
View file @
143840d4
...
...
@@ -56,7 +56,6 @@ instance Arbitrary SearchQuery where
arbitrary
=
elements
[
SearchQuery
[
"electrodes"
]]
-----------------------------------------------------------------------
data
SearchDocResults
=
SearchDocResults
{
sdr_results
::
[
FacetDoc
]}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"sdr_"
)
''
S
earchDocResults
)
...
...
src/Gargantext/Database/Learn.hs
View file @
143840d4
{-|
Module : Gargantext.Database.Learn
Description : Learn Small Data Analytics with big data connection (DB)
C
opyright : (c) CNRS, 2017-Present
opyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
...
...
@@ -44,11 +44,13 @@ moreLike cId o l order ft = do
---------------------------------------------------------------------------
getPriors
::
FavOrTrash
->
CorpusId
->
Cmd
err
(
Events
Bool
)
getPriors
ft
cId
=
do
docs_trash
<-
runViewDocuments
cId
True
Nothing
Nothing
Nothing
docs_fav
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
2
)
<$>
runViewDocuments
cId
False
Nothing
Nothing
Nothing
docs_trash
<-
List
.
take
(
List
.
length
docs_fav
)
<$>
runViewDocuments
cId
True
Nothing
Nothing
Nothing
let
priors
=
priorEventsWith
text
(
fav2bool
ft
)
(
List
.
zip
(
repeat
False
)
docs_fav
<>
List
.
zip
(
repeat
True
)
docs_trash
...
...
@@ -60,14 +62,14 @@ 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
==
0
)
<$>
runViewDocuments
cId
False
o
l
order
docs_test
<-
filter
(
\
(
FacetDoc
_
_
_
_
f
_
)
->
f
==
1
)
<$>
runViewDocuments
cId
False
o
Nothing
order
let
results
=
map
fst
$
filter
((
==
)
(
Just
$
not
$
fav2bool
ft
)
.
snd
)
$
map
(
\
f
->
(
f
,
detectDefaultWithPriors
text
priors
f
))
docs_test
pure
results
pure
$
List
.
take
(
maybe
10
identity
l
)
results
---------------------------------------------------------------------------
fav2bool
::
FavOrTrash
->
Bool
...
...
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