Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
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
1
Merge Requests
1
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
searx-engine
Commits
018b6818
Commit
018b6818
authored
Mar 12, 2020
by
Adam Tauber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] add answers, suggestions, corrections to csv output
fixes #1888
parent
9bc24080
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
webapp.py
searx/webapp.py
+11
-1
No files found.
searx/webapp.py
View file @
018b6818
...
...
@@ -626,10 +626,20 @@ def index():
mimetype
=
'application/json'
)
elif
output_format
==
'csv'
:
csv
=
UnicodeWriter
(
StringIO
())
keys
=
(
'title'
,
'url'
,
'content'
,
'host'
,
'engine'
,
'score'
)
keys
=
(
'title'
,
'url'
,
'content'
,
'host'
,
'engine'
,
'score'
,
'type'
)
csv
.
writerow
(
keys
)
for
row
in
results
:
row
[
'host'
]
=
row
[
'parsed_url'
]
.
netloc
row
[
'type'
]
=
'result'
csv
.
writerow
([
row
.
get
(
key
,
''
)
for
key
in
keys
])
for
a
in
result_container
.
answers
:
row
=
{
'title'
:
a
,
'type'
:
'answer'
}
csv
.
writerow
([
row
.
get
(
key
,
''
)
for
key
in
keys
])
for
a
in
result_container
.
suggestions
:
row
=
{
'title'
:
a
,
'type'
:
'suggestion'
}
csv
.
writerow
([
row
.
get
(
key
,
''
)
for
key
in
keys
])
for
a
in
result_container
.
corrections
:
row
=
{
'title'
:
a
,
'type'
:
'correction'
}
csv
.
writerow
([
row
.
get
(
key
,
''
)
for
key
in
keys
])
csv
.
stream
.
seek
(
0
)
response
=
Response
(
csv
.
stream
.
read
(),
mimetype
=
'application/csv'
)
...
...
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