on master help sign in
[fix] preserve bangs in suggestions and corrections
commit6626f013656d39bc90d179e6706825552a8e588d authorMarc Abonce Seguin <marc-abonce@mailbox.org> dateMon 1 Jul 2019, 19:52 (7 years ago) parent40272b0
2 files changed+3−2
searx/templates/oscar/results.html+2−2 searx/webapp.py+1
searx/templates/oscar/results.html+2−2
@@ -21,7 +21,7 @@
2121 <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
2222 {% for correction in corrections %}
2323 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
24− <input type="hidden" name="q" value="{{ correction }}">
24+ <input type="hidden" name="q" value="{{ query_prefix + correction }}">
2525 <button type="submit" class="btn btn-default btn-xs">{{ correction }}</button>
2626 </form>
2727 {% endfor %}
@@ -118,7 +118,7 @@
118118 <div class="panel-body">
119119 {% for suggestion in suggestions %}
120120 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
121− <input type="hidden" name="q" value="{{ suggestion }}">
121+ <input type="hidden" name="q" value="{{ query_prefix + suggestion }}">
122122 <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
123123 </form>
124124 {% endfor %}
searx/webapp.py+1
@@ -584,6 +584,7 @@ def index():
584584 'results.html',
585585 results=results,
586586 q=request.form['q'],
587+ query_prefix=u''.join((request.form['q']).rsplit(search_query.query.decode('utf-8'), 1)),
587588 selected_categories=search_query.categories,
588589 pageno=search_query.pageno,
589590 time_range=search_query.time_range,