Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
purescript-gargantext
Commits
3e4ae118
Commit
3e4ae118
authored
Nov 04, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP][SECU] Doc ngrams: needs GetNgrams and PutNGrams.
parent
6104d122
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
24 deletions
+31
-24
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+9
-3
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+7
-7
Ends.purs
src/Gargantext/Ends.purs
+12
-11
Routes.purs
src/Gargantext/Routes.purs
+2
-2
Types.purs
src/Gargantext/Types.purs
+1
-1
No files found.
src/Gargantext/Components/NgramsTable/Core.purs
View file @
3e4ae118
...
@@ -89,8 +89,12 @@ import Gargantext.Sessions (Session, get, put, post)
...
@@ -89,8 +89,12 @@ import Gargantext.Sessions (Session, get, put, post)
import Gargantext.Types (OrderBy(..), CTabNgramType(..), TabType, TermList(..), TermSize)
import Gargantext.Types (OrderBy(..), CTabNgramType(..), TabType, TermList(..), TermSize)
import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.KarpRabin (indicesOfAny)
data NodeId = NodeId { corpusId :: Int
, documentId :: Maybe Int
}
type CoreParams s =
type CoreParams s =
{ nodeId ::
Int
{ nodeId ::
NodeId
-- ^ This node can be a corpus or contact.
-- ^ This node can be a corpus or contact.
, listIds :: Array Int
, listIds :: Array Int
, tabType :: TabType
, tabType :: TabType
...
@@ -597,10 +601,12 @@ loadNgramsTable
...
@@ -597,10 +601,12 @@ loadNgramsTable
{ nodeId, listIds, termListFilter, termSizeFilter, session
{ nodeId, listIds, termListFilter, termSizeFilter, session
, searchQuery, tabType, params: {offset, limit, orderBy}}
, searchQuery, tabType, params: {offset, limit, orderBy}}
= get session query
= get session query
where query = GetNgrams { tabType, offset, limit, listIds
where
NodeId {corpusId, documentId} = nodeId
query = GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, orderBy: convOrderBy <$> orderBy
, termListFilter, termSizeFilter
, termListFilter, termSizeFilter
, searchQuery } (Just
nodeId)
, searchQuery } (Just
corpusId) documentId
convOrderBy :: T.OrderByDirection T.ColumnName -> OrderBy
convOrderBy :: T.OrderByDirection T.ColumnName -> OrderBy
convOrderBy (T.ASC (T.ColumnName "Score (Occurrences)")) = ScoreAsc
convOrderBy (T.ASC (T.ColumnName "Score (Occurrences)")) = ScoreAsc
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
3e4ae118
...
@@ -364,19 +364,19 @@ documentLayoutCpt = R.hooksComponent "G.P.Corpus.Document.documentLayout" cpt
...
@@ -364,19 +364,19 @@ documentLayoutCpt = R.hooksComponent "G.P.Corpus.Document.documentLayout" cpt
R2.createElement' docViewClass {path, loaded} []
R2.createElement' docViewClass {path, loaded} []
where
where
tabType = TabDocument (TabNgramType CTabTerms)
tabType = TabDocument (TabNgramType CTabTerms)
path = {session, nodeId, listIds: [listId], corpusId, tabType}
path
= {session, nodeId, listIds: [listId], corpusId, tabType}
------------------------------------------------------------------------
------------------------------------------------------------------------
loadDocument :: Session -> Maybe Int -> Int -> Aff NodeDocument
loadDocument
:: Session -> Int -> Aff NodeDocument
loadDocument
session corpusId nodeId =
loadDocument session nodeId = get session $ NodeAPI Node (Just nodeId) ""
get session $ SessionCorpusDocument corpusId (Just nodeId)
loadData :: DocPath -> Aff LoadedData
loadData :: DocPath -> Aff LoadedData
loadData {session, nodeId, listIds, tabType} = do
loadData {session, nodeId,
corpusId,
listIds, tabType} = do
document
<- loadDocument session
nodeId
document
<- loadDocument session corpusId
nodeId
ngramsTable <- loadNgramsTable
ngramsTable <- loadNgramsTable
{ session
{ session
,
nodeId
,
NodeId corpusId (Just nodeId)
, listIds
, listIds
, params: { offset : 0, limit : 100, orderBy: Nothing}
, params: { offset : 0, limit : 100, orderBy: Nothing}
, tabType
, tabType
...
...
src/Gargantext/Ends.purs
View file @
3e4ae118
...
@@ -117,26 +117,27 @@ sessionPath :: R.SessionRoute -> String
...
@@ -117,26 +117,27 @@ sessionPath :: R.SessionRoute -> String
sessionPath (R.Tab t i) = sessionPath (R.NodeAPI Node i (showTabType' t))
sessionPath (R.Tab t i) = sessionPath (R.NodeAPI Node i (showTabType' t))
sessionPath (R.Children n o l s i) = sessionPath (R.NodeAPI Node i ("children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s))
sessionPath (R.Children n o l s i) = sessionPath (R.NodeAPI Node i ("children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s))
sessionPath (R.NodeAPI Phylo pId p) = "phyloscape?nodeId=" <> (show $ maybe 0 identity pId) <> p
sessionPath (R.NodeAPI Phylo pId p) = "phyloscape?nodeId=" <> (show $ maybe 0 identity pId) <> p
sessionPath (R.GetNgrams opts i) =
sessionPath (R.GetNgrams opts
c
i) =
base opts.tabType
base opts.tabType
$ "ngrams?ngramsType="
$ "ngrams?ngramsType="
<> showTabType' opts.tabType
<> showTabType' opts.tabType
<> offsetUrl opts.offset
<> offsetUrl
opts.offset
<> limitUrl opts.limit
<> limitUrl
opts.limit
<> orderByUrl opts.orderBy
<> orderByUrl
opts.orderBy
<> foldMap (\x -> "&list=" <> show x) opts.listIds
<> foldMap (\x -> "&list="
<> show x) opts.listIds
<> foldMap (\x -> "&listType=" <> show x) opts.termListFilter
<> foldMap (\x -> "&listType=" <> show x) opts.termListFilter
<> foldMap termSizeFilter opts.termSizeFilter
<> foldMap termSizeFilter opts.termSizeFilter
<> search opts.searchQuery
<> search opts.searchQuery
where
where
base (TabCorpus _) = sessionPath <<< R.NodeAPI Node i
base :: TabType -> String
base _ = sessionPath <<< R.NodeAPI Url_Document i
base (TabCorpus _) = sessionPath <<< R.NodeAPI Node c
termSizeFilter MonoTerm = "&minTermSize=0&maxTermSize=1"
base _ = sessionPath <<< (R.SessionCorpusDocument c i)
termSizeFilter MonoTerm = "&minTermSize=0&maxTermSize=1"
termSizeFilter MultiTerm = "&minTermSize=2"
termSizeFilter MultiTerm = "&minTermSize=2"
search "" = ""
search "" = ""
search s = "&search=" <> s
search s
= "&search=" <> s
sessionPath (R.
ListDocument l
Id dId) =
sessionPath (R.
SessionCorpusDocument c
Id dId) =
sessionPath $ R.NodeAPI
NodeList l
Id ("document/" <> (show $ maybe 0 identity dId))
sessionPath $ R.NodeAPI
Corpus c
Id ("document/" <> (show $ maybe 0 identity dId))
sessionPath (R.PutNgrams t listId termList i) =
sessionPath (R.PutNgrams t listId termList i) =
sessionPath $ R.NodeAPI Node i
sessionPath $ R.NodeAPI Node i
$ "ngrams?ngramsType="
$ "ngrams?ngramsType="
...
...
src/Gargantext/Routes.purs
View file @
3e4ae118
...
@@ -22,11 +22,11 @@ data AppRoute
...
@@ -22,11 +22,11 @@ data AppRoute
data SessionRoute
data SessionRoute
= Tab TabType (Maybe Id)
= Tab TabType (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
| GetNgrams
NgramsGetOpts
(Maybe Id)
| GetNgrams
NgramsGetOpts (Maybe Id)
(Maybe Id)
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
| NodeAPI NodeType (Maybe Id) String
| NodeAPI NodeType (Maybe Id) String
|
ListDocument (Maybe List
Id) (Maybe Id)
|
SessionCorpusDocument (Maybe
Id) (Maybe Id)
| Search SearchOpts (Maybe Id)
| Search SearchOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id)
| Chart ChartOpts (Maybe Id)
| Chart ChartOpts (Maybe Id)
...
...
src/Gargantext/Types.purs
View file @
3e4ae118
...
@@ -103,7 +103,7 @@ instance optionalInstance :: Union r t s => Optional r s
...
@@ -103,7 +103,7 @@ instance optionalInstance :: Union r t s => Optional r s
showTabType' :: TabType -> String
showTabType' :: TabType -> String
showTabType' (TabCorpus t) = show t
showTabType' (TabCorpus t) = show t
showTabType' (TabDocument t) = show t
showTabType' (TabDocument t) = show t
showTabType' (TabPairing t) = show t
showTabType' (TabPairing
t) = show t
data TabPostQuery = TabPostQuery {
data TabPostQuery = TabPostQuery {
offset :: Int
offset :: Int
...
...
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