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
c19b0899
Commit
c19b0899
authored
Jan 10, 2015
by
Thomas Pointhuber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] little autocompleter fix
parent
eb6f3348
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
autocomplete.py
searx/autocomplete.py
+2
-2
webapp.py
searx/webapp.py
+4
-2
No files found.
searx/autocomplete.py
View file @
c19b0899
...
@@ -52,7 +52,7 @@ def searx_bang(full_query):
...
@@ -52,7 +52,7 @@ def searx_bang(full_query):
# check if query starts with engine name
# check if query starts with engine name
for
engine
in
engines
:
for
engine
in
engines
:
if
engine
.
startswith
(
engine_query
):
if
engine
.
startswith
(
engine_query
.
replace
(
'_'
,
' '
)
):
results
.
append
(
'!{engine}'
.
format
(
engine
=
engine
.
replace
(
' '
,
'_'
)))
results
.
append
(
'!{engine}'
.
format
(
engine
=
engine
.
replace
(
' '
,
'_'
)))
# check if query starts with engine shortcut
# check if query starts with engine shortcut
...
@@ -86,7 +86,7 @@ def searx_bang(full_query):
...
@@ -86,7 +86,7 @@ def searx_bang(full_query):
results
.
append
(
':{lang_name}'
.
format
(
lang_name
=
lang_name
))
results
.
append
(
':{lang_name}'
.
format
(
lang_name
=
lang_name
))
# check if query starts with country
# check if query starts with country
if
country
.
startswith
(
engine_query
):
if
country
.
startswith
(
engine_query
.
replace
(
'_'
,
' '
)
):
results
.
append
(
':{country}'
.
format
(
country
=
country
.
replace
(
' '
,
'_'
)))
results
.
append
(
':{country}'
.
format
(
country
=
country
.
replace
(
' '
,
'_'
)))
# remove duplicates
# remove duplicates
...
...
searx/webapp.py
View file @
c19b0899
...
@@ -355,8 +355,10 @@ def autocompleter():
...
@@ -355,8 +355,10 @@ def autocompleter():
# parse searx specific autocompleter results like !bang
# parse searx specific autocompleter results like !bang
raw_results
=
searx_bang
(
query
)
raw_results
=
searx_bang
(
query
)
# run autocompletion
# normal autocompletion results only appear if max 3. searx results returned
raw_results
.
extend
(
completer
(
query
.
getSearchQuery
()))
if
len
(
raw_results
)
<=
3
:
# run autocompletion
raw_results
.
extend
(
completer
(
query
.
getSearchQuery
()))
# parse results (write :language and !engine back to result string)
# parse results (write :language and !engine back to result string)
results
=
[]
results
=
[]
...
...
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