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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
0404bc88
Commit
0404bc88
authored
Aug 01, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] search in Trash
parent
3fbdae6f
Pipeline
#538
failed with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
15 deletions
+41
-15
Search.hs
src/Gargantext/API/Search.hs
+1
-1
Table.hs
src/Gargantext/API/Table.hs
+2
-2
Main.hs
src/Gargantext/Core/Types/Main.hs
+1
-1
Facet.hs
src/Gargantext/Database/Facet.hs
+4
-5
Node.hs
src/Gargantext/Database/Schema/Node.hs
+25
-0
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+7
-5
Node.hs
src/Gargantext/Database/Types/Node.hs
+1
-1
No files found.
src/Gargantext/API/Search.hs
View file @
0404bc88
...
...
@@ -101,7 +101,7 @@ searchPairs pId (SearchQuery q) o l order =
searchDocs
::
NodeId
->
GargServer
SearchDocsAPI
searchDocs
nId
(
SearchQuery
q
)
o
l
order
=
SearchDocResults
<$>
searchInCorpus
nId
q
o
l
order
SearchDocResults
<$>
searchInCorpus
nId
False
q
o
l
order
--SearchResults <$> searchInCorpusWithContacts nId q o l order
src/Gargantext/API/Table.hs
View file @
0404bc88
...
...
@@ -84,8 +84,8 @@ instance Arbitrary TableQuery where
tableApi
::
NodeId
->
TableQuery
->
Cmd
err
[
FacetDoc
]
tableApi
cId
(
TableQuery
o
l
order
ft
""
)
=
getTable
cId
(
Just
ft
)
(
Just
o
)
(
Just
l
)
(
Just
order
)
tableApi
cId
(
TableQuery
o
l
order
ft
q
)
=
case
ft
of
Docs
->
searchInCorpus
cId
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
Trash
->
panic
"TODO search in Trash"
-- TODO searchInCorpus cId q o l order
Docs
->
searchInCorpus
cId
False
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
Trash
->
searchInCorpus
cId
True
[
q
]
(
Just
o
)
(
Just
l
)
(
Just
order
)
x
->
panic
$
"not implemented in tableApi "
<>
(
cs
$
show
x
)
getTable
::
NodeId
->
Maybe
TabType
...
...
src/Gargantext/Core/Types/Main.hs
View file @
0404bc88
...
...
@@ -123,7 +123,7 @@ fromListTypeId i = lookup i $ fromList [ (listTypeId l, l) | l <- [minBound..max
-- Queries
type
Limit
=
Int
type
Offset
=
Int
type
IsTrash
=
Bool
------------------------------------------------------------------------
-- All the Database is structred like a hierarchical Tree
...
...
src/Gargantext/Database/Facet.hs
View file @
0404bc88
...
...
@@ -169,7 +169,6 @@ type FacetDocRead = Facet (Column PGInt4 )
-----------------------------------------------------------------------
-----------------------------------------------------------------------
type
Trash
=
Bool
data
OrderBy
=
DateAsc
|
DateDesc
|
TitleAsc
|
TitleDesc
|
ScoreDesc
|
ScoreAsc
...
...
@@ -197,13 +196,13 @@ instance Arbitrary OrderBy
arbitrary
=
elements
[
minBound
..
maxBound
]
runViewAuthorsDoc
::
ContactId
->
Trash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewAuthorsDoc
::
ContactId
->
Is
Trash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewAuthorsDoc
cId
t
o
l
order
=
runOpaQuery
$
filterWith
o
l
order
$
viewAuthorsDoc
cId
t
ntId
where
ntId
=
NodeDocument
-- TODO add delete ?
viewAuthorsDoc
::
ContactId
->
Trash
->
NodeType
->
Query
FacetDocRead
viewAuthorsDoc
::
ContactId
->
Is
Trash
->
NodeType
->
Query
FacetDocRead
viewAuthorsDoc
cId
_
nt
=
proc
()
->
do
(
doc
,(
_
,(
_
,(
_
,
contact
))))
<-
queryAuthorsDoc
-<
()
...
...
@@ -237,13 +236,13 @@ queryAuthorsDoc = leftJoin5 queryNodeTable queryNodeNgramTable queryNgramsTable
------------------------------------------------------------------------
runViewDocuments
::
CorpusId
->
Trash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewDocuments
::
CorpusId
->
Is
Trash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewDocuments
cId
t
o
l
order
=
runOpaQuery
$
filterWith
o
l
order
$
viewDocuments
cId
t
ntId
where
ntId
=
nodeTypeId
NodeDocument
viewDocuments
::
CorpusId
->
Trash
->
NodeTypeId
->
Query
FacetDocRead
viewDocuments
::
CorpusId
->
Is
Trash
->
NodeTypeId
->
Query
FacetDocRead
viewDocuments
cId
t
ntId
=
proc
()
->
do
n
<-
queryNodeTable
-<
()
nn
<-
queryNodeNodeTable
-<
()
...
...
src/Gargantext/Database/Schema/Node.hs
View file @
0404bc88
...
...
@@ -22,6 +22,7 @@ Portability : POSIX
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module
Gargantext.Database.Schema.Node
where
...
...
@@ -435,6 +436,28 @@ nodeAnnuaireW maybeName maybeAnnuaire pId = node NodeAnnuaire name annuaire (Jus
------------------------------------------------------------------------
{-
class IsNodeDb a where
data Node'' a :: *
data Hyper a :: *
instance IsNodeDb NodeType where
data
instance HasHyperdata NodeType where
data Hyper NodeType = HyperList HyperdataList
| HyperCorpus HyperdataCorpus
hasHyperdata nt = case nt of
NodeList -> HyperList $ HyperdataList (Just "list")
unHyper h = case h of
HyperList h' -> h'
--}
class
HasDefault
a
where
hasDefaultData
::
a
->
HyperData
hasDefaultName
::
a
->
Text
...
...
@@ -452,6 +475,7 @@ instance HasDefault NodeType where
_
->
undefined
------------------------------------------------------------------------
nodeDefault
::
NodeType
->
ParentId
->
UserId
->
NodeWrite
nodeDefault
nt
parent
=
node
nt
name
hyper
(
Just
parent
)
where
...
...
@@ -499,6 +523,7 @@ arbitraryDashboard :: HyperdataDashboard
arbitraryDashboard
=
HyperdataDashboard
(
Just
"Preferences"
)
------------------------------------------------------------------------
node
::
(
ToJSON
a
,
Hyperdata
a
)
=>
NodeType
->
Name
->
a
->
Maybe
ParentId
->
UserId
->
NodeWrite
node
nodeType
name
hyperData
parentId
userId
=
Node
Nothing
(
pgInt4
typeId
)
(
pgInt4
userId
)
(
pgNodeId
<$>
parentId
)
(
pgStrictText
name
)
Nothing
(
pgJSONB
$
cs
$
encode
hyperData
)
where
...
...
src/Gargantext/Database/TextSearch.hs
View file @
0404bc88
...
...
@@ -56,16 +56,18 @@ queryInDatabase _ q = proc () -> do
------------------------------------------------------------------------
-- | todo add limit and offset and order
searchInCorpus
::
CorpusId
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
searchInCorpus
cId
q
o
l
order
=
runOpaQuery
(
filterWith
o
l
order
$
queryInCorpus
cId
q'
)
searchInCorpus
::
CorpusId
->
IsTrash
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
searchInCorpus
cId
t
q
o
l
order
=
runOpaQuery
(
filterWith
o
l
order
$
queryInCorpus
cId
t
q'
)
where
q'
=
intercalate
" | "
$
map
stemIt
q
queryInCorpus
::
CorpusId
->
Text
->
O
.
Query
FacetDocRead
queryInCorpus
cId
q
=
proc
()
->
do
queryInCorpus
::
CorpusId
->
IsTrash
->
Text
->
O
.
Query
FacetDocRead
queryInCorpus
cId
t
q
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
(
nn_node1_id
nn
)
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
(
nn_category
nn
)
.>=
(
toNullable
$
pgInt4
1
)
restrict
-<
if
t
then
(
nn_category
nn
)
.==
(
toNullable
$
pgInt4
0
)
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
)
...
...
src/Gargantext/Database/Types/Node.hs
View file @
0404bc88
...
...
@@ -434,7 +434,7 @@ $(deriveJSON (unPrefix "hyperdataNotebook_") ''HyperdataNotebook)
instance
Hyperdata
HyperdataNotebook
-- | TODO CLEAN
data
HyperData
=
HyperdataTexts
{
hd_texts
::
Maybe
Text
}
|
HyperdataList'
{
hd_lists
::
Maybe
Text
}
deriving
(
Show
,
Generic
)
...
...
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