Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-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
Przemyslaw Kaminski
haskell-gargantext
Commits
e16a4fc5
Commit
e16a4fc5
authored
Dec 09, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[searx] fix language sent by user
parent
867e66e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
Searx.hs
src/Gargantext/API/Node/Corpus/Searx.hs
+6
-9
No files found.
src/Gargantext/API/Node/Corpus/Searx.hs
View file @
e16a4fc5
...
...
@@ -120,7 +120,7 @@ insertSearxResponse :: (MonadBase IO m, FlowCmdM env err m)
->
m
()
insertSearxResponse
_
_
_
_
(
Left
_
)
=
pure
()
insertSearxResponse
user
cId
listId
l
(
Right
(
SearxResponse
{
_srs_results
}))
=
do
let
docs
=
hyperdataDocumentFromSearxResult
<$>
_srs_results
let
docs
=
hyperdataDocumentFromSearxResult
l
<$>
_srs_results
--printDebug "[triggerSearxSearch] docs" docs
-- docs :: [Either Text HyperdataDocument]
let
docs'
=
catMaybes
$
rightToMaybe
<$>
docs
...
...
@@ -130,9 +130,9 @@ insertSearxResponse user cId listId l (Right (SearxResponse { _srs_results })) =
" :: [publication_year] "
<>
(
show
_hd_publication_year
)
<>
" :: [publication_date] "
<>
(
show
_hd_publication_date
)
)
docs'
--
_
<-
flowDataText
user
(
DataNew
[
docs'
])
(
Multi
EN
)
cId
Nothing
logStatus
--
_
<-
flowDataText
user
(
DataNew
[
docs'
])
(
Multi
l
)
cId
Nothing
logStatus
let
mCorpus
=
Nothing
::
Maybe
HyperdataCorpus
ids
<-
insertMasterDocs
mCorpus
(
Multi
EN
)
docs'
ids
<-
insertMasterDocs
mCorpus
(
Multi
l
)
docs'
_
<-
Doc
.
add
cId
ids
(
_masterUserId
,
_masterRootId
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
(
Left
""
)
mCorpus
...
...
@@ -169,9 +169,6 @@ triggerSearxSearch user cId q l logStatus = do
mListId
<-
defaultListMaybe
cId
listId
<-
case
mListId
of
Nothing
->
do
--let failedJobLog = jobLogFailTotalWithMessage "[triggerSearxSearch] no list id" jobLog
--logStatus failedJobLog
--pure failedJobLog
listId
<-
getOrMkList
cId
uId
pure
listId
Just
listId
->
pure
listId
...
...
@@ -197,8 +194,8 @@ triggerSearxSearch user cId q l logStatus = do
pure
$
jobLogSuccess
jobLog
hyperdataDocumentFromSearxResult
::
SearxResult
->
Either
T
.
Text
HyperdataDocument
hyperdataDocumentFromSearxResult
(
SearxResult
{
_sr_content
,
_sr_engine
,
_sr_pubdate
,
_sr_title
})
=
do
hyperdataDocumentFromSearxResult
::
Lang
->
SearxResult
->
Either
T
.
Text
HyperdataDocument
hyperdataDocumentFromSearxResult
l
(
SearxResult
{
_sr_content
,
_sr_engine
,
_sr_pubdate
,
_sr_title
})
=
do
let
mDate
=
parseTimeM
False
defaultTimeLocale
"%Y-%m-%d %H:%M:%S+0000"
(
T
.
unpack
_sr_pubdate
)
::
Maybe
Day
let
mGregorian
=
toGregorian
<$>
mDate
Right
HyperdataDocument
{
_hd_bdd
=
Just
"Searx"
...
...
@@ -219,5 +216,5 @@ hyperdataDocumentFromSearxResult (SearxResult { _sr_content, _sr_engine, _sr_pub
,
_hd_publication_hour
=
Nothing
,
_hd_publication_minute
=
Nothing
,
_hd_publication_second
=
Nothing
,
_hd_language_iso2
=
Just
$
T
.
pack
$
show
EN
}
,
_hd_language_iso2
=
Just
$
T
.
pack
$
show
l
}
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