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
b71f03ca
Commit
b71f03ca
authored
May 06, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
ssh://delanoe.org/haskell-gargantext
into dev
parents
18968540
1a3ab28f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+17
-18
No files found.
src/Gargantext/API/Ngrams.hs
View file @
b71f03ca
...
...
@@ -772,6 +772,8 @@ addListNgrams listId ngramsType nes = do
m = Map.fromList $ (\n -> (n ^. ne_ngrams, n)) <$> nes
-}
-- If the given list of ngrams elements contains ngrams already in
-- the repo, they will overwrite the old ones.
putListNgrams
::
RepoCmdM
env
err
m
=>
NodeId
->
NgramsType
->
[
NgramsElement
]
->
m
()
...
...
@@ -785,6 +787,8 @@ putListNgrams listId ngramsType nes = do
where
m
=
Map
.
fromList
$
(
\
n
->
(
n
^.
ne_ngrams
,
ngramsElementToRepo
n
))
<$>
nes
tableNgramsPost
tabType
listId
=
putListNgrams
listId
tabType
-- Apply the given patch to the DB and returns the patch to be applied on the
-- client.
tableNgramsPut
::
(
HasInvalidError
err
,
RepoCmdM
env
err
m
)
...
...
@@ -923,13 +927,14 @@ getTableNgrams nId tabType listId limit_ offset
type
QueryParamR
=
QueryParam'
'[
R
equired
,
Strict
]
type
TableNgramsApiGet
=
Summary
" Table Ngrams API Get"
:>
QueryParamR
"docId"
DocId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
QueryParamR
"limit"
Limit
:>
QueryParam
"offset"
Offset
:>
QueryParam
"listType"
ListType
:>
QueryParam
"minTermSize"
Int
:>
QueryParam
"maxTermSize"
Int
:>
QueryParam
"minTermSize"
MinSize
:>
QueryParam
"maxTermSize"
MaxSize
:>
QueryParam
"search"
Text
:>
Get
'[
J
SON
]
(
Versioned
NgramsTable
)
...
...
@@ -939,6 +944,11 @@ type TableNgramsApiPut = Summary " Table Ngrams API Change"
:>
ReqBody
'[
J
SON
]
(
Versioned
NgramsTablePatch
)
:>
Put
'[
J
SON
]
(
Versioned
NgramsTablePatch
)
type
TableNgramsApiPost
=
Summary
" Table Ngrams API Adds new ngrams"
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
ReqBody
'[
J
SON
]
[
NgramsElement
]
:>
Post
'[
J
SON
]
()
getTableNgramsCorpus
::
(
RepoCmdM
env
err
m
,
HasNodeError
err
,
HasConnection
env
)
=>
NodeId
->
TabType
...
...
@@ -973,25 +983,14 @@ getTableNgramsDoc dId tabType listId limit_ offset listType minSize maxSize _mt
--{-
-- TODO Doc Table Ngrams API
type
ApiNgramsTableDoc
=
TableNgramsApiGet
--
:<|> TableNgramsApiPut
--
:<|> TableNgramsApiPost
:<|>
TableNgramsApiPut
:<|>
TableNgramsApiPost
apiNgramsTableDoc
::
(
RepoCmdM
env
err
m
,
HasNodeError
err
,
HasConnection
env
)
=>
DocId
->
TabType
->
ListId
->
Limit
->
Maybe
Offset
->
Maybe
ListType
->
Maybe
MinSize
->
Maybe
MaxSize
->
Maybe
Text
-- full text search
->
m
(
Versioned
NgramsTable
)
{- TODO
--apiDocNgramsTable :: ApiDocNgramsTable
--apiDocNgramsTable :: ApiDocNgramsTable
--apiDocNgramsTable = getTableNgramsDoc
=>
ServerT
ApiNgramsTableDoc
m
apiNgramsTableDoc
=
getTableNgramsDoc
:<|>
tableNgramsPut
:<|> tableNgramsPost
-- > add new ngrams to the repo (TODO NP)
:<|>
tableNgramsPost
-- > add new ngrams in database (TODO AD)
-- > index all the corpus accordingly (TODO AD)
--}
apiNgramsTableDoc
=
getTableNgramsDoc
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