Commit c297207e authored by Alexandre Delanoë's avatar Alexandre Delanoë

[SEARCH FORM][WIP] Advanced option tree.

parent c45116fb
...@@ -22,6 +22,10 @@ import Gargantext.Utils (id) ...@@ -22,6 +22,10 @@ import Gargantext.Utils (id)
import URI.Extra.QueryPairs as QP import URI.Extra.QueryPairs as QP
import URI.Query as Q import URI.Query as Q
------------------------------------------------------------------------
class Doc a where
doc :: a -> String
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Lang search specifications -- | Lang search specifications
allLangs :: Array Lang allLangs :: Array Lang
...@@ -51,11 +55,40 @@ readLang _ = Nothing ...@@ -51,11 +55,40 @@ readLang _ = Nothing
instance encodeJsonLang :: EncodeJson Lang where instance encodeJsonLang :: EncodeJson Lang where
encodeJson a = encodeJson (show a) encodeJson a = encodeJson (show a)
------------------------------------------------------------------------
-- | DataField search specifications
dataFields :: Array DataField
dataFields = [ Gargantext
, External Nothing
, Web
]
data DataField = Gargantext
| External (Maybe Database)
| Web
instance showDataField :: Show DataField where
show Gargantext = "In Gargantext"
show (External _) = "Ext.Database"
show Web = "Web"
instance docDataField :: Doc DataField where
doc Gargantext = "All Gargantext Database"
doc (External _) = "External (scientific) databases"
doc Web = "All the web crawled with meta-search-engine SearX"
instance eqDataField :: Eq DataField where
eq Gargantext Gargantext = true
eq (External _) (External _) = true
eq Web Web = true
eq _ _ = false
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Database search specifications -- | Database search specifications
allDatabases :: Array Database allDatabases :: Array Database
allDatabases = [ Gargantext allDatabases = [ PubMed
, PubMed
, HAL , HAL
, IsTex , IsTex
, Isidore , Isidore
...@@ -65,50 +98,40 @@ allDatabases = [ Gargantext ...@@ -65,50 +98,40 @@ allDatabases = [ Gargantext
] ]
data Database = All_Databases data Database = All_Databases
| Gargantext
| PubMed | PubMed
| HAL | HAL
| IsTex | IsTex
| Isidore | Isidore
| Web -- | News
| News -- | SocialNetworks
| SocialNetworks
instance showDatabase :: Show Database where instance showDatabase :: Show Database where
show All_Databases= "All Databases" show All_Databases= "All Databases"
show Gargantext = "In Gargantext"
show PubMed = "PubMed" show PubMed = "PubMed"
show HAL = "HAL" show HAL = "HAL"
show IsTex = "IsTex" show IsTex = "IsTex"
show Isidore= "Isidore" show Isidore= "Isidore"
show Web = "Web" -- show News = "News"
show News = "News" -- show SocialNetworks = "Social Networks"
show SocialNetworks = "Social Networks"
class Doc a where
doc :: a -> String
instance docDatabase :: Doc Database where instance docDatabase :: Doc Database where
doc All_Databases = "All databases" doc All_Databases = "All databases"
doc Gargantext = "All Gargantext Database"
doc PubMed = "All Medical publications" doc PubMed = "All Medical publications"
doc HAL = "All open science (archives ouvertes)" doc HAL = "All open science (archives ouvertes)"
doc IsTex = "All Elsevier enriched by CNRS/INIST" doc IsTex = "All Elsevier enriched by CNRS/INIST"
doc Isidore = "All (French) Social Sciences" doc Isidore = "All (French) Social Sciences"
doc Web = "All the web crawled with meta-search-engine SearX" -- doc News = "Web filtered by News"
doc News = "Web filtered by News" -- doc SocialNetworks = "Web filtered by MicroBlogs"
doc SocialNetworks = "Web filtered by MicroBlogs"
readDatabase :: String -> Maybe Database readDatabase :: String -> Maybe Database
readDatabase "All Databases" = Just All_Databases readDatabase "All Databases" = Just All_Databases
readDatabase "Gargantext" = Just Gargantext
readDatabase "PubMed" = Just PubMed readDatabase "PubMed" = Just PubMed
readDatabase "HAL" = Just HAL readDatabase "HAL" = Just HAL
readDatabase "IsTex" = Just IsTex readDatabase "IsTex" = Just IsTex
readDatabase "Isidore"= Just Isidore readDatabase "Isidore"= Just Isidore
readDatabase "Web" = Just Web -- readDatabase "Web" = Just Web
readDatabase "News" = Just News -- readDatabase "News" = Just News
readDatabase "Social Networks" = Just SocialNetworks -- readDatabase "Social Networks" = Just SocialNetworks
readDatabase _ = Nothing readDatabase _ = Nothing
derive instance eqDatabase :: Eq Database derive instance eqDatabase :: Eq Database
......
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