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
199
Issues
199
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
b2ef5a09
Commit
b2ef5a09
authored
Dec 13, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Search][Graph][FacetPair] with limit and offset, union of pairs.
parent
0dc3d444
Pipeline
#63
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+9
-4
No files found.
src/Gargantext/Database/TextSearch.hs
View file @
b2ef5a09
...
@@ -15,9 +15,9 @@ Portability : POSIX
...
@@ -15,9 +15,9 @@ Portability : POSIX
module
Gargantext.Database.TextSearch
where
module
Gargantext.Database.TextSearch
where
import
Data.Aeson
import
Data.Aeson
import
Data.Map.Strict
hiding
(
map
)
import
Data.Map.Strict
hiding
(
map
,
drop
,
take
)
import
Data.Maybe
import
Data.Maybe
import
Data.List
(
intersperse
)
import
Data.List
(
intersperse
,
take
,
drop
)
import
Data.String
(
IsString
(
..
))
import
Data.String
(
IsString
(
..
))
import
Data.Text
(
Text
,
words
,
unpack
,
intercalate
)
import
Data.Text
(
Text
,
words
,
unpack
,
intercalate
)
import
Data.Time
(
UTCTime
)
import
Data.Time
(
UTCTime
)
...
@@ -76,13 +76,18 @@ joinInCorpus = leftJoin queryNodeSearchTable queryNodeNodeTable cond
...
@@ -76,13 +76,18 @@ joinInCorpus = leftJoin queryNodeSearchTable queryNodeNodeTable cond
------------------------------------------------------------------------
------------------------------------------------------------------------
type
AuthorName
=
Text
type
AuthorName
=
Text
-- | TODO Optim: Offset and Limit in the Query
searchInCorpusWithContacts
::
Connection
->
CorpusId
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
IO
[
FacetPaired
Int
UTCTime
HyperdataDocument
Int
[
Pair
Int
Text
]]
searchInCorpusWithContacts
::
Connection
->
CorpusId
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
IO
[
FacetPaired
Int
UTCTime
HyperdataDocument
Int
[
Pair
Int
Text
]]
searchInCorpusWithContacts
c
cId
q
o
l
order
=
map
(
\
((
i
,
u
,
h
,
s
),
ps
)
->
FacetPaired
i
u
h
s
(
catMaybes
ps
))
<$>
toList
<$>
fromListWith
(
<>
)
<$>
map
(
\
(
FacetPaired
i
u
h
s
p
)
->
((
i
,
u
,
h
,
s
),
[
maybePair
p
]))
<$>
searchInCorpusWithContacts'
c
cId
q
o
l
order
searchInCorpusWithContacts
c
cId
q
o
l
order
=
take
(
maybe
5
identity
l
)
<$>
drop
(
maybe
0
identity
o
)
<$>
map
(
\
((
i
,
u
,
h
,
s
),
ps
)
->
FacetPaired
i
u
h
s
(
catMaybes
ps
))
<$>
toList
<$>
fromListWith
(
<>
)
<$>
map
(
\
(
FacetPaired
i
u
h
s
p
)
->
((
i
,
u
,
h
,
s
),
[
maybePair
p
]))
<$>
searchInCorpusWithContacts'
c
cId
q
o
l
order
where
where
maybePair
(
Pair
Nothing
Nothing
)
=
Nothing
maybePair
(
Pair
Nothing
Nothing
)
=
Nothing
maybePair
(
Pair
_
Nothing
)
=
Nothing
maybePair
(
Pair
_
Nothing
)
=
Nothing
maybePair
(
Pair
Nothing
_
)
=
Nothing
maybePair
(
Pair
Nothing
_
)
=
Nothing
maybePair
(
Pair
(
Just
i
)
(
Just
l
))
=
Just
$
Pair
i
l
maybePair
(
Pair
(
Just
p_id
)
(
Just
p_label
))
=
Just
$
Pair
p_id
p_labe
l
searchInCorpusWithContacts'
::
Connection
->
CorpusId
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
IO
[(
FacetPaired
Int
UTCTime
HyperdataDocument
Int
(
Pair
(
Maybe
Int
)
(
Maybe
Text
)))]
searchInCorpusWithContacts'
::
Connection
->
CorpusId
->
[
Text
]
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
IO
[(
FacetPaired
Int
UTCTime
HyperdataDocument
Int
(
Pair
(
Maybe
Int
)
(
Maybe
Text
)))]
searchInCorpusWithContacts'
c
cId
q
o
l
order
=
runQuery
c
$
queryInCorpusWithContacts
cId
q'
o
l
order
searchInCorpusWithContacts'
c
cId
q
o
l
order
=
runQuery
c
$
queryInCorpusWithContacts
cId
q'
o
l
order
...
...
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