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
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
f3e6e57d
Verified
Commit
f3e6e57d
authored
Sep 03, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[search] RecordWildCards to make pattern matching simpler
parent
5e9fcc66
Pipeline
#1758
passed with stage
in 31 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
42 deletions
+30
-42
Search.hs
src/Gargantext/API/Search.hs
+30
-42
No files found.
src/Gargantext/API/Search.hs
View file @
f3e6e57d
...
...
@@ -10,6 +10,7 @@ Portability : POSIX
Count API part of Gargantext.
-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveAnyClass #-}
...
...
@@ -185,8 +186,13 @@ class ToRow a where
toRow
::
NodeId
->
a
->
Row
instance
ToRow
FacetDoc
where
toRow
_
(
FacetDoc
nId
utc
t
h
mc
_md
sc
)
=
Document
nId
utc
t
(
toHyperdataRow
h
)
(
fromMaybe
0
mc
)
(
round
$
fromMaybe
0
sc
)
toRow
_
(
FacetDoc
{
..
})
=
Document
{
id
=
facetDoc_id
,
created
=
facetDoc_created
,
title
=
facetDoc_title
,
hyperdata
=
toHyperdataRow
facetDoc_hyperdata
,
category
=
fromMaybe
0
facetDoc_category
,
score
=
round
$
fromMaybe
0
facetDoc_score
}
-- | TODO rename FacetPaired
type
FacetContact
=
FacetPaired
Int
UTCTime
HyperdataContact
Int
...
...
@@ -251,50 +257,32 @@ class ToHyperdataRow a where
toHyperdataRow
::
a
->
HyperdataRow
instance
ToHyperdataRow
HyperdataDocument
where
toHyperdataRow
(
HyperdataDocument
{
_hd_bdd
=
bdd
,
_hd_doi
=
doi
,
_hd_url
=
url'
,
_hd_uniqId
=
uniqId
,
_hd_uniqIdBdd
=
uniqIdBdd
,
_hd_page
=
page
,
_hd_title
=
t
,
_hd_authors
=
authors
,
_hd_institutes
=
institutes
,
_hd_source
=
source
,
_hd_abstract
=
abstract
,
_hd_publication_date
=
pdate
,
_hd_publication_year
=
pyear
,
_hd_publication_month
=
pmonth
,
_hd_publication_day
=
pday
,
_hd_publication_hour
=
phour
,
_hd_publication_minute
=
pminute
,
_hd_publication_second
=
psecond
,
_hd_language_iso2
=
language
})
=
toHyperdataRow
(
HyperdataDocument
{
..
})
=
HyperdataRowDocument
{
_hr_abstract
=
fromMaybe
""
abstract
,
_hr_authors
=
fromMaybe
""
authors
,
_hr_bdd
=
fromMaybe
""
bdd
,
_hr_doi
=
fromMaybe
""
doi
,
_hr_institutes
=
fromMaybe
""
institutes
,
_hr_language_iso2
=
fromMaybe
"EN"
language
,
_hr_page
=
fromMaybe
0
page
,
_hr_publication_date
=
fromMaybe
""
p
date
,
_hr_publication_day
=
fromMaybe
1
p
day
,
_hr_publication_hour
=
fromMaybe
1
p
hour
,
_hr_publication_minute
=
fromMaybe
1
p
minute
,
_hr_publication_month
=
fromMaybe
1
p
month
,
_hr_publication_second
=
fromMaybe
1
p
second
,
_hr_publication_year
=
fromMaybe
2020
p
year
,
_hr_source
=
fromMaybe
""
source
,
_hr_title
=
fromMaybe
"Title"
t
,
_hr_url
=
fromMaybe
""
url'
,
_hr_uniqId
=
fromMaybe
""
uniqId
,
_hr_uniqIdBdd
=
fromMaybe
""
uniqIdBdd
}
{
_hr_abstract
=
fromMaybe
""
_hd_
abstract
,
_hr_authors
=
fromMaybe
""
_hd_
authors
,
_hr_bdd
=
fromMaybe
""
_hd_
bdd
,
_hr_doi
=
fromMaybe
""
_hd_
doi
,
_hr_institutes
=
fromMaybe
""
_hd_
institutes
,
_hr_language_iso2
=
fromMaybe
"EN"
_hd_language_iso2
,
_hr_page
=
fromMaybe
0
_hd_
page
,
_hr_publication_date
=
fromMaybe
""
_hd_publication_
date
,
_hr_publication_day
=
fromMaybe
1
_hd_publication_
day
,
_hr_publication_hour
=
fromMaybe
1
_hd_publication_
hour
,
_hr_publication_minute
=
fromMaybe
1
_hd_publication_
minute
,
_hr_publication_month
=
fromMaybe
1
_hd_publication_
month
,
_hr_publication_second
=
fromMaybe
1
_hd_publication_
second
,
_hr_publication_year
=
fromMaybe
2020
_hd_publication_
year
,
_hr_source
=
fromMaybe
""
_hd_
source
,
_hr_title
=
fromMaybe
"Title"
_hd_title
,
_hr_url
=
fromMaybe
""
_hd_url
,
_hr_uniqId
=
fromMaybe
""
_hd_
uniqId
,
_hr_uniqIdBdd
=
fromMaybe
""
_hd_
uniqIdBdd
}
instance
ToHyperdataRow
HyperdataContact
where
toHyperdataRow
(
HyperdataContact
_
(
Just
(
ContactWho
_
fn
ln
_
_
))
ou
_
_
_
_
_
)
=
toHyperdataRow
(
HyperdataContact
{
_hc_who
=
Just
(
ContactWho
_
fn
ln
_
_
),
_hc_where
=
ou
}
)
=
HyperdataRowContact
(
fromMaybe
"FirstName"
fn
)
(
fromMaybe
"LastName"
ln
)
ou'
where
ou'
=
maybe
"CNRS"
(
Text
.
intercalate
" "
.
_cw_organization
)
(
head
ou
)
toHyperdataRow
(
HyperdataContact
_
_
_
_
_
_
_
_
)
=
toHyperdataRow
(
HyperdataContact
{}
)
=
HyperdataRowContact
"FirstName"
"LastName"
"Labs"
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