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
e54de3ad
Commit
e54de3ad
authored
Jun 26, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SEARCH] Adding the authors for the demo site.
parent
ec633d46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Search.hs
src/Gargantext/API/Search.hs
+6
-5
TextSearch.hs
src/Gargantext/Database/TextSearch.hs
+2
-1
No files found.
src/Gargantext/API/Search.hs
View file @
e54de3ad
...
...
@@ -63,16 +63,17 @@ instance ToSchema SearchQuery where
instance
Arbitrary
SearchQuery
where
arbitrary
=
elements
[
SearchQuery
[
"
query"
]
1
]
arbitrary
=
elements
[
SearchQuery
[
"
electrodes"
]
472764
]
-----------------------------------------------------------------------
data
SearchResult
=
SearchResult
{
sr_id
::
Int
,
sr_name
::
Text
data
SearchResult
=
SearchResult
{
sr_id
::
Int
,
sr_title
::
Text
,
sr_authors
::
Text
}
deriving
(
Generic
)
$
(
deriveJSON
(
unPrefix
"sr_"
)
''
S
earchResult
)
instance
Arbitrary
SearchResult
where
arbitrary
=
elements
[
SearchResult
1
"
name
"
]
arbitrary
=
elements
[
SearchResult
1
"
Title"
"Authors
"
]
instance
ToSchema
SearchResult
where
declareNamedSchema
=
...
...
@@ -101,7 +102,7 @@ type SearchAPI = Post '[JSON] SearchResults
search
::
Connection
->
SearchQuery
->
Handler
SearchResults
search
c
(
SearchQuery
q
pId
)
=
liftIO
$
SearchResults
<$>
map
(
\
(
i
,
y
,
t
,
s
,
_
)
->
SearchResult
i
(
cs
$
encode
t
))
liftIO
$
SearchResults
<$>
map
(
\
(
i
,
y
,
t
,
s
,
a
,
_
)
->
SearchResult
i
(
cs
$
encode
t
)
(
cs
$
encode
a
))
<$>
textSearch
c
(
toTSQuery
q
)
pId
5
0
Desc
src/Gargantext/Database/TextSearch.hs
View file @
e54de3ad
...
...
@@ -69,6 +69,7 @@ textSearchQuery :: Query
textSearchQuery
=
"SELECT n.id, n.hyperdata->'publication_year'
\
\
, n.hyperdata->'title'
\
\
, n.hyperdata->'source'
\
\
, n.hyperdata->'authors'
\
\
, COALESCE(nn.score,null)
\
\
FROM nodes n
\
\
LEFT JOIN nodes_nodes nn ON nn.node2_id = n.id
\
...
...
@@ -82,7 +83,7 @@ textSearchQuery = "SELECT n.id, n.hyperdata->'publication_year' \
textSearch
::
Connection
->
TSQuery
->
ParentId
->
Limit
->
Offset
->
Order
->
IO
[(
Int
,
Value
,
Value
,
Value
,
Maybe
Int
)]
->
IO
[(
Int
,
Value
,
Value
,
Value
,
Value
,
Maybe
Int
)]
textSearch
conn
q
p
l
o
ord
=
query
conn
textSearchQuery
(
q
,
p
,
ord
,
o
,
l
)
textSearchTest
::
ParentId
->
TSQuery
->
IO
()
...
...
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