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
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
Grégoire Locqueville
purescript-gargantext
Commits
e51a41bb
Commit
e51a41bb
authored
Jul 29, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Search authors/contact ok
parent
0c379866
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
29 deletions
+40
-29
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+13
-12
Search.purs
src/Gargantext/Components/Search.purs
+27
-17
No files found.
src/Gargantext/Components/FacetsTable.purs
View file @
e51a41bb
...
@@ -192,7 +192,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searc
...
@@ -192,7 +192,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searc
p = Search { listId, offset, limit, orderBy: convOrderBy <$> orderBy } (Just nodeId)
p = Search { listId, offset, limit, orderBy: convOrderBy <$> orderBy } (Just nodeId)
SearchResult {result} <- post session p $ SearchQuery {query: concat query, expected:searchType}
--SearchResult {result} <- post session p $ SearchQuery {query: concat query, expected:searchType}
SearchResult {result} <- post session p $ SearchQuery {query: concat query, expected:SearchContact}
pure $ case result of
pure $ case result of
SearchResultDoc {docs} -> docs2view docs
SearchResultDoc {docs} -> docs2view docs
SearchResultContact {contacts} -> contacts2view contacts
SearchResultContact {contacts} -> contacts2view contacts
...
@@ -230,20 +231,20 @@ docs2view docs = map toView docs
...
@@ -230,20 +231,20 @@ docs2view docs = map toView docs
contacts2view contacts = map toView contacts
contacts2view contacts = map toView contacts
where
where
toView :: Contact -> DocumentsView
toView :: Contact -> DocumentsView
toView (Contact { id
toView (Contact {
c_
id
, created: date
, c
_c
reated: date
,
hyperdata: HyperdataContact { who
,
c_hyperdata: HyperdataRowContact { firstname
,
titl
e
,
lastnam
e
,
"where": contactWhere
,
labs
}
}
, score
,
c_
score
}
}
) = DocumentsView { id
) = DocumentsView { id
: c_id
, date
, date
, title : f
romMaybe "Title" titl
e
, title : f
irstname <> lastnam
e
, source:
fromMaybe "Source" title
, source:
labs
, score:
1
, score:
c_score
, authors:
fromMaybe "Authors" title
, authors:
labs
, category: decodeCategory 1
, category: decodeCategory 1
, pairs: []
, pairs: []
, delete: false
, delete: false
...
...
src/Gargantext/Components/Search.purs
View file @
e51a41bb
...
@@ -42,7 +42,7 @@ instance encodeJsonSearchQuery :: Argonaut.EncodeJson SearchQuery where
...
@@ -42,7 +42,7 @@ instance encodeJsonSearchQuery :: Argonaut.EncodeJson SearchQuery where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
data SearchResult = SearchResult { result :: SearchResultTypes }
data SearchResult = SearchResult { result :: SearchResultTypes }
derive instance eqSearchResult :: Eq SearchResult
derive instance eqSearchResult :: Eq SearchResult
...
@@ -55,11 +55,11 @@ instance encodeJsonSearchResult :: Argonaut.EncodeJson SearchResult where
...
@@ -55,11 +55,11 @@ instance encodeJsonSearchResult :: Argonaut.EncodeJson SearchResult where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
data SearchResultTypes =
data SearchResultTypes =
SearchResultContact { contacts :: Array Contact
}
SearchResultDoc { docs :: Array Document
}
| SearchNoResult { message :: String }
| SearchNoResult { message :: String }
| SearchResultDoc { docs :: Array Document
}
| SearchResultContact { contacts :: Array Contact
}
derive instance eqSearchResultTypes :: Eq SearchResultTypes
derive instance eqSearchResultTypes :: Eq SearchResultTypes
derive instance genericSearchResultTypes :: Generic SearchResultTypes _
derive instance genericSearchResultTypes :: Generic SearchResultTypes _
...
@@ -71,9 +71,7 @@ instance encodeJsonSearchResultTypes :: Argonaut.EncodeJson SearchResultTypes wh
...
@@ -71,9 +71,7 @@ instance encodeJsonSearchResultTypes :: Argonaut.EncodeJson SearchResultTypes wh
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
------------------------------------------------------------------------
data Document =
data Document =
Document { id :: Int
Document { id :: Int
, created :: String
, created :: String
...
@@ -92,7 +90,6 @@ instance decodeJsonDocument :: Argonaut.DecodeJson Document where
...
@@ -92,7 +90,6 @@ instance decodeJsonDocument :: Argonaut.DecodeJson Document where
instance encodeJsonDocument :: Argonaut.EncodeJson Document where
instance encodeJsonDocument :: Argonaut.EncodeJson Document where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
-----------
------------------------------------------------------------------------
------------------------------------------------------------------------
newtype HyperdataRowDocument =
newtype HyperdataRowDocument =
HyperdataRowDocument { bdd :: Maybe String
HyperdataRowDocument { bdd :: Maybe String
...
@@ -128,12 +125,11 @@ instance encodeJsonHyperdataRowDocument :: Argonaut.EncodeJson HyperdataRowDocum
...
@@ -128,12 +125,11 @@ instance encodeJsonHyperdataRowDocument :: Argonaut.EncodeJson HyperdataRowDocum
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
data Contact =
data Contact =
Contact { id :: Int
Contact {
c_
id :: Int
, created :: String
, c
_c
reated :: String
,
hyperdata :: Hyperdata
Contact
,
c_hyperdata :: HyperdataRow
Contact
, score :: Int
,
c_
score :: Int
}
}
derive instance eqContact :: Eq Contact
derive instance eqContact :: Eq Contact
...
@@ -146,6 +142,23 @@ instance encodeJsonContact :: Argonaut.EncodeJson Contact where
...
@@ -146,6 +142,23 @@ instance encodeJsonContact :: Argonaut.EncodeJson Contact where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
data HyperdataRowContact =
HyperdataRowContact { firstname :: String
, lastname :: String
, labs :: String
}
derive instance eqHyperdataRowContact :: Eq HyperdataRowContact
derive instance genericHyperdataRowContact :: Generic HyperdataRowContact _
instance showHyperdataRowContact :: Show HyperdataRowContact where
show = genericShow
instance decodeJsonHyperdataRowContact :: Argonaut.DecodeJson HyperdataRowContact where
decodeJson = genericSumDecodeJson
instance encodeJsonHyperdataRowContact :: Argonaut.EncodeJson HyperdataRowContact where
encodeJson = genericSumEncodeJson
data HyperdataContact =
data HyperdataContact =
HyperdataContact { bdd :: Maybe String
HyperdataContact { bdd :: Maybe String
, who :: Maybe ContactWho
, who :: Maybe ContactWho
...
@@ -166,7 +179,6 @@ instance encodeJsonHyperdataContact :: Argonaut.EncodeJson HyperdataContact wher
...
@@ -166,7 +179,6 @@ instance encodeJsonHyperdataContact :: Argonaut.EncodeJson HyperdataContact wher
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
-------
-------
data ContactWho =
data ContactWho =
ContactWho { id :: Maybe String
ContactWho { id :: Maybe String
, firstName :: Maybe String
, firstName :: Maybe String
...
@@ -184,7 +196,6 @@ instance encodeJsonContactWho :: Argonaut.EncodeJson ContactWho where
...
@@ -184,7 +196,6 @@ instance encodeJsonContactWho :: Argonaut.EncodeJson ContactWho where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
data ContactWhere =
data ContactWhere =
ContactWhere { organization :: Array String
ContactWhere { organization :: Array String
, labTeamDepts :: Array String
, labTeamDepts :: Array String
...
@@ -224,4 +235,3 @@ instance decodeJsonContactTouch :: Argonaut.DecodeJson ContactTouch where
...
@@ -224,4 +235,3 @@ instance decodeJsonContactTouch :: Argonaut.DecodeJson ContactTouch where
instance encodeJsonContactTouch :: Argonaut.EncodeJson ContactTouch where
instance encodeJsonContactTouch :: Argonaut.EncodeJson ContactTouch where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
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