Commit 397fa34f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'master' into hal-fixes

parents 8f47d29c 7b740eee
......@@ -37,12 +37,27 @@ opts = info (params <**> helper)
<> progDesc "A program to test HAL"
<> header "crawlerHAL-exe")
main :: IO ()
main = run =<< execParser opts
-- res <- getMetadataWith (generateRequestByStructID "artificial intelligence" imt) (Just 0) (Just 55)
-- case res of
-- (Left err) -> print err
-- (Right val) -> print $ _docs val
run :: Command -> IO ()
run (Count (CountParams { cp_query })) = do
res <- getMetadataWithC (cp_query) (Just 0) Nothing
case res of
Left err -> print err
Right (cnt, _docsC) -> print $ show cnt
yearReq = [text|
(language_t:en)
AND (producedDateY_i:2015
OR producedDateY_i:2016
OR producedDateY_i:2017
OR producedDateY_i:2018
AND (producedDateY_i:2018
OR producedDateY_i:2019
OR producedDateY_i:2020
OR producedDateY_i:2021
OR producedDateY_i:2022)
AND (structId_i:302102
......@@ -82,17 +97,3 @@ imt = [
,"6279"
,"29212"
]
main :: IO ()
main = run =<< execParser opts
-- res <- getMetadataWith (generateRequestByStructID "artificial intelligence" imt) (Just 0) (Just 55)
-- case res of
-- (Left err) -> print err
-- (Right val) -> print $ _docs val
run :: Command -> IO ()
run (Count (CountParams { cp_query })) = do
res <- getMetadataWithC (cp_query) (Just 0) Nothing
case res of
Left err -> print err
Right (cnt, _docsC) -> print $ show cnt
......@@ -16,7 +16,7 @@ import Servant.API (ToHttpApiData(..))
data Corpus = Corpus
{
_corpus_docid :: Int,
_corpus_docid :: Text,
_corpus_title :: [Text],
_corpus_abstract :: [Text],
_corpus_date :: Maybe Text,
......@@ -28,7 +28,7 @@ data Corpus = Corpus
L.makeLenses ''Corpus
instance Default Corpus where
def = Corpus def def def def def def def def
def = Corpus "" def def def def def def def
instance FromJSON Corpus where
parseJSON (Object o) =
......
......@@ -11,19 +11,19 @@ import Servant.API (ToHttpApiData(..))
data EntityTree = EntityTree
{
_docid :: Int,
_docid :: Text,
_label_s :: Maybe Text,
_parentEntityTreeid_i :: [Text]
} deriving (Generic)
instance Default EntityTree where
def = EntityTree def def def
def = EntityTree "" def def
instance FromJSON EntityTree where
parseJSON (Object o) = EntityTree <$>
(o .: "docid")
<*> (o .:? "label_s")
<*> (o .:? "parentEntityTreeid_i" .!= [])
parseJSON (Object o) =
EntityTree <$> (o .: "docid")
<*> (o .:? "label_s")
<*> (o .:? "parentEntityTreeid_i" .!= [])
instance ToHttpApiData EntityTree where
toUrlPiece _ = "docid,label_s,parentEntityTreeid_i"
......
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