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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
a7441ccb
Commit
a7441ccb
authored
Sep 28, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] HAL et ISTEX APIs
parent
5817f50c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+1
-1
Searx.hs
src/Gargantext/API/Node/Corpus/Searx.hs
+4
-1
Istex.hs
src/Gargantext/Core/Text/Corpus/API/Istex.hs
+23
-4
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
a7441ccb
...
...
@@ -316,7 +316,7 @@ addToCorpusWithForm user cid (NewWithForm ft ff d l _n) logStatus jobLog = do
--printDebug "Starting extraction : " cid
-- TODO granularity of the logStatus
printDebug
"flowCorpus with
lang"
l
printDebug
"flowCorpus with
(corpus_id, lang)"
(
cid
,
l
)
_cid'
<-
flowCorpus
user
(
Right
[
cid
])
...
...
src/Gargantext/API/Node/Corpus/Searx.hs
View file @
a7441ccb
...
...
@@ -136,7 +136,10 @@ insertSearxResponse user cId listId l (Right (SearxResponse { _srs_results })) =
_
<-
Doc
.
add
cId
ids
(
_masterUserId
,
_masterRootId
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
(
Left
""
)
mCorpus
let
gp
=
GroupWithPosTag
l
CoreNLP
HashMap
.
empty
let
gp
=
case
l
of
FR
->
GroupWithPosTag
l
Spacy
HashMap
.
empty
_
->
GroupWithPosTag
l
CoreNLP
HashMap
.
empty
ngs
<-
buildNgramsLists
user
cId
masterCorpusId
Nothing
gp
_userListId
<-
flowList_DbRepo
listId
ngs
...
...
src/Gargantext/Core/Text/Corpus/API/Istex.hs
View file @
a7441ccb
...
...
@@ -18,6 +18,8 @@ import Data.List (concat)
import
Data.Maybe
import
Data.Text
(
Text
,
pack
)
import
qualified
Data.Text
as
Text
import
qualified
Data.List
as
List
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
(
..
))
import
qualified
Gargantext.Defaults
as
Defaults
...
...
@@ -26,9 +28,11 @@ import qualified Gargantext.Core.Text.Corpus.Parsers.Date as Date
import
qualified
ISTEX
as
ISTEX
import
qualified
ISTEX.Client
as
ISTEX
type
Query
=
Text
type
MaxResults
=
Maybe
Integer
get
::
Lang
->
Text
->
Maybe
Integer
->
IO
[
HyperdataDocument
]
get
la
q
_ml
=
do
get
::
Lang
->
Query
->
MaxResults
->
IO
[
HyperdataDocument
]
get
la
q
uery'
maxResults
=
do
--printDebug "[Istex.get] calling getMetadataScrollProgress for la" la
--printDebug "[Istex.get] calling getMetadataScrollProgress for q" q
--printDebug "[Istex.get] calling getMetadataScrollProgress for ml" ml
...
...
@@ -38,14 +42,29 @@ get la q _ml = do
-- TODO check if abstract is in query already if not add like below
-- eDocs <- ISTEX.getMetadataScroll (q <> " abstract:*") "1m" Nothing 0 --(fromIntegral <$> ml)
-- eDocs <- ISTEX.getMetadataScroll q "1m" Nothing 0 --(fromIntegral <$> ml)
eDocs
<-
ISTEX
.
getMetadataWith
q
(
Just
5000
)
let
query
=
case
(
List
.
length
$
Text
.
splitOn
":"
query'
)
==
1
of
-- True case means users is entering default search of IsTex
-- In that case we need to enrich his query with 2 parameters
-- First expected language: user has to define it in GTXT
-- Second : query in abstract
True
->
(
"language:"
<>
lang
la
)
<>
" AND abstract:"
<>
query'
where
lang
FR
=
"fre"
lang
_
=
"eng"
False
->
query'
-- Complex queries of IsTex needs parameters using ":" so we leave the query as it is
-- in that case we suppose user is knowing what s.he is doing
eDocs
<-
ISTEX
.
getMetadataWith
query
(
fromIntegral
<$>
maxResults
)
printDebug
"[Istex.get] will print length"
(
0
::
Int
)
case
eDocs
of
Left
_
->
pure
()
Right
(
ISTEX
.
Documents
{
_documents_hits
})
->
printDebug
"[Istex.get] length docs"
$
length
_documents_hits
--ISTEX.getMetadataScrollProgress q ((\_ -> pack $ "1m") <$> ml) Nothing progress errorHandler
case
eDocs
of
Left
err
->
panic
.
pack
.
show
$
err
Left
err
->
panic
.
Text
.
pack
.
show
$
err
Right
docs
->
toDoc'
la
docs
--pure $ either (panic . pack . show) (toDoc' la) eDocs
-- where
...
...
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