Commit 5a3ebd2c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API][Pairs] search enabled again.

parent 9f3feb43
...@@ -51,7 +51,7 @@ import Gargantext.API.Auth (withAccess, PathId(..)) ...@@ -51,7 +51,7 @@ import Gargantext.API.Auth (withAccess, PathId(..))
import Gargantext.API.Metrics import Gargantext.API.Metrics
import Gargantext.API.Ngrams (TabType(..), TableNgramsApi, apiNgramsTableCorpus, QueryParamR) import Gargantext.API.Ngrams (TabType(..), TableNgramsApi, apiNgramsTableCorpus, QueryParamR)
import Gargantext.API.Ngrams.NTree (MyTree) import Gargantext.API.Ngrams.NTree (MyTree)
import Gargantext.API.Search (SearchDocsAPI, searchDocs) import Gargantext.API.Search (SearchDocsAPI, searchDocs, SearchPairsAPI, searchPairs)
import Gargantext.API.Table import Gargantext.API.Table
import Gargantext.API.Types import Gargantext.API.Types
import Gargantext.Core.Types (NodeTableResult) import Gargantext.Core.Types (NodeTableResult)
...@@ -131,7 +131,8 @@ type NodeAPI a = Get '[JSON] (Node a) ...@@ -131,7 +131,8 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|> "pairing" :> PairingApi :<|> "pairing" :> PairingApi
:<|> "category" :> CatApi :<|> "category" :> CatApi
:<|> "search" :> SearchDocsAPI :<|> "search" :> SearchDocsAPI
:<|> "searchPair" :> SearchPairsAPI
-- VIZ -- VIZ
:<|> "metrics" :> ScatterAPI :<|> "metrics" :> ScatterAPI
...@@ -193,7 +194,8 @@ nodeAPI p uId id = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode i ...@@ -193,7 +194,8 @@ nodeAPI p uId id = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode i
:<|> catApi id :<|> catApi id
:<|> searchDocs id :<|> searchDocs id
:<|> searchPairs id
:<|> getScatter id :<|> getScatter id
:<|> getChart id :<|> getChart id
......
...@@ -79,27 +79,28 @@ instance ToSchema SearchPairedResults where ...@@ -79,27 +79,28 @@ instance ToSchema SearchPairedResults where
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- TODO-ACCESS: CanSearch? or is it part of CanGetNode -- TODO-ACCESS: CanSearch? or is it part of CanGetNode
-- TODO-EVENTS: No event, this is a read-only query. -- TODO-EVENTS: No event, this is a read-only query.
type SearchAPI results type SearchAPI results = Summary "Search endpoint"
= Summary "Search endpoint" :> ReqBody '[JSON] SearchQuery
:> ReqBody '[JSON] SearchQuery :> QueryParam "offset" Int
:> QueryParam "offset" Int :> QueryParam "limit" Int
:> QueryParam "limit" Int :> QueryParam "order" OrderBy
:> QueryParam "order" OrderBy :> Post '[JSON] results
:> Post '[JSON] results
type SearchDocsAPI = SearchAPI SearchDocResults type SearchDocsAPI = SearchAPI SearchDocResults
type SearchPairsAPI =
Summary "" :> "list" :> Capture "list" ListId
:> SearchAPI SearchPairedResults
-----------------------------------------------------------------------
searchPairs :: NodeId -> GargServer SearchPairsAPI
searchPairs pId lId (SearchQuery q) o l order =
SearchPairedResults <$> searchInCorpusWithContacts pId lId q o l order
searchDocs :: NodeId -> GargServer SearchDocsAPI searchDocs :: NodeId -> GargServer SearchDocsAPI
searchDocs nId (SearchQuery q) o l order = searchDocs nId (SearchQuery q) o l order =
SearchDocResults <$> searchInCorpus nId False q o l order SearchDocResults <$> searchInCorpus nId False q o l order
--SearchResults <$> searchInCorpusWithContacts nId q o l order --SearchResults <$> searchInCorpusWithContacts nId q o l order
-----------------------------------------------------------------------
type SearchPairsAPI = Summary ""
:> "list"
:> Capture "list" ListId
:> SearchAPI SearchPairedResults
searchPairs :: NodeId -> GargServer SearchPairsAPI
searchPairs pId lId (SearchQuery q) o l order =
SearchPairedResults <$> searchInCorpusWithContacts pId lId q o l order
-----------------------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment