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
55615160
Commit
55615160
authored
Aug 05, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[searx] add support for language from GET query
parent
0b17bfec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
Searx.hs
src/Gargantext/API/Node/Corpus/Searx.hs
+8
-4
No files found.
src/Gargantext/API/Node/Corpus/Searx.hs
View file @
55615160
...
...
@@ -53,14 +53,16 @@ data SearxResponse = SearxResponse
$
(
deriveJSON
(
unPrefix
"_srs_"
)
''
S
earxResponse
)
data
FetchSearxParams
=
FetchSearxParams
{
_fsp_manager
::
Manager
{
_fsp_language
::
Lang
,
_fsp_manager
::
Manager
,
_fsp_pageno
::
Int
,
_fsp_query
::
Text
,
_fsp_url
::
Text
}
fetchSearxPage
::
FetchSearxParams
->
IO
(
Either
Prelude
.
String
SearxResponse
)
fetchSearxPage
(
FetchSearxParams
{
_fsp_manager
fetchSearxPage
(
FetchSearxParams
{
_fsp_language
,
_fsp_manager
,
_fsp_pageno
,
_fsp_query
,
_fsp_url
})
=
do
...
...
@@ -70,9 +72,10 @@ fetchSearxPage (FetchSearxParams { _fsp_manager
let
request
=
urlEncodedBody
[
--("category_general", "1")
(
"q"
,
encodeUtf8
_fsp_query
)
,
(
"categories"
,
"news"
)
-- https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/70#note_3976
,
(
"pageno"
,
encodeUtf8
$
T
.
pack
$
show
_fsp_pageno
)
--, ("time_range", "None")
--, ("language", "en-US") -- TODO
,
(
"language"
,
encodeUtf8
$
T
.
pack
$
show
_fsp_language
)
,
(
"format"
,
"json"
)
]
req
res
<-
httpLbs
request
_fsp_manager
...
...
@@ -94,7 +97,8 @@ triggerSearxSearch cid q l = do
printDebug
"[triggerSearxSearch] surl"
surl
manager
<-
liftBase
$
newManager
tlsManagerSettings
res
<-
liftBase
$
fetchSearxPage
$
FetchSearxParams
{
_fsp_manager
=
manager
res
<-
liftBase
$
fetchSearxPage
$
FetchSearxParams
{
_fsp_language
=
l
,
_fsp_manager
=
manager
,
_fsp_pageno
=
1
,
_fsp_query
=
q
,
_fsp_url
=
surl
}
...
...
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