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
149
Issues
149
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
23 deletions
+30
-23
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
No files found.
src/Gargantext/Components/NgramsTable/Core.purs
View file @
3e4ae118
...
...
@@ -89,8 +89,12 @@ import Gargantext.Sessions (Session, get, put, post)
import Gargantext.Types (OrderBy(..), CTabNgramType(..), TabType, TermList(..), TermSize)
import Gargantext.Utils.KarpRabin (indicesOfAny)
data NodeId = NodeId { corpusId :: Int
, documentId :: Maybe Int
}
type CoreParams s =
{ nodeId ::
Int
{ nodeId ::
NodeId
-- ^ This node can be a corpus or contact.
, listIds :: Array Int
, tabType :: TabType
...
...
@@ -597,10 +601,12 @@ loadNgramsTable
{ nodeId, listIds, termListFilter, termSizeFilter, session
, searchQuery, tabType, params: {offset, limit, orderBy}}
= get session query
where query = GetNgrams { tabType, offset, limit, listIds
where
NodeId {corpusId, documentId} = nodeId
query = GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, termListFilter, termSizeFilter
, searchQuery } (Just
nodeId)
, searchQuery } (Just
corpusId) documentId
convOrderBy :: T.OrderByDirection T.ColumnName -> OrderBy
convOrderBy (T.ASC (T.ColumnName "Score (Occurrences)")) = ScoreAsc
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
3e4ae118
...
...
@@ -367,16 +367,16 @@ documentLayoutCpt = R.hooksComponent "G.P.Corpus.Document.documentLayout" cpt
path = {session, nodeId, listIds: [listId], corpusId, tabType}
------------------------------------------------------------------------
loadDocument
:: Session -> Int -> Aff NodeDocument
loadDocument session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadDocument :: Session -> Maybe Int -> Int -> Aff NodeDocument
loadDocument
session corpusId nodeId =
get session $ SessionCorpusDocument corpusId (Just nodeId)
loadData :: DocPath -> Aff LoadedData
loadData {session, nodeId, listIds, tabType} = do
document
<- loadDocument session
nodeId
loadData {session, nodeId,
corpusId,
listIds, tabType} = do
document
<- loadDocument session corpusId
nodeId
ngramsTable <- loadNgramsTable
{ session
,
nodeId
,
NodeId corpusId (Just nodeId)
, listIds
, params: { offset : 0, limit : 100, orderBy: Nothing}
, tabType
...
...
src/Gargantext/Ends.purs
View file @
3e4ae118
...
...
@@ -117,7 +117,7 @@ sessionPath :: R.SessionRoute -> String
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.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
$ "ngrams?ngramsType="
<> showTabType' opts.tabType
...
...
@@ -129,14 +129,15 @@ sessionPath (R.GetNgrams opts i) =
<> foldMap termSizeFilter opts.termSizeFilter
<> search opts.searchQuery
where
base (TabCorpus _) = sessionPath <<< R.NodeAPI Node i
base _ = sessionPath <<< R.NodeAPI Url_Document i
base :: TabType -> String
base (TabCorpus _) = sessionPath <<< R.NodeAPI Node c
base _ = sessionPath <<< (R.SessionCorpusDocument c i)
termSizeFilter MonoTerm = "&minTermSize=0&maxTermSize=1"
termSizeFilter MultiTerm = "&minTermSize=2"
search "" = ""
search s = "&search=" <> s
sessionPath (R.
ListDocument l
Id dId) =
sessionPath $ R.NodeAPI
NodeList l
Id ("document/" <> (show $ maybe 0 identity dId))
sessionPath (R.
SessionCorpusDocument c
Id dId) =
sessionPath $ R.NodeAPI
Corpus c
Id ("document/" <> (show $ maybe 0 identity dId))
sessionPath (R.PutNgrams t listId termList i) =
sessionPath $ R.NodeAPI Node i
$ "ngrams?ngramsType="
...
...
src/Gargantext/Routes.purs
View file @
3e4ae118
...
...
@@ -22,11 +22,11 @@ data AppRoute
data SessionRoute
= Tab TabType (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)
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
| NodeAPI NodeType (Maybe Id) String
|
ListDocument (Maybe List
Id) (Maybe Id)
|
SessionCorpusDocument (Maybe
Id) (Maybe Id)
| Search SearchOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id)
| Chart ChartOpts (Maybe Id)
...
...
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