on master help sign in
[fix] preserve bangs in suggestions and corrections
6626f01Marc Abonce Seguin
searx/templates/oscar/results.html+2−2
@@ -21,7 +21,7 @@
21 <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
21 <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
22 {% for correction in corrections %}
22 {% for correction in corrections %}
23 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
23 <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 }}">
25 <button type="submit" class="btn btn-default btn-xs">{{ correction }}</button>
25 <button type="submit" class="btn btn-default btn-xs">{{ correction }}</button>
26 </form>
26 </form>
27 {% endfor %}
27 {% endfor %}
@@ -118,7 +118,7 @@
118 <div class="panel-body">
118 <div class="panel-body">
119 {% for suggestion in suggestions %}
119 {% for suggestion in suggestions %}
120 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
120 <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 }}">
122 <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
122 <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
123 </form>
123 </form>
124 {% endfor %}
124 {% endfor %}
searx/webapp.py+1
@@ -584,6 +584,7 @@ def index():
584 'results.html',
584 'results.html',
585 results=results,
585 results=results,
586 q=request.form['q'],
586 q=request.form['q'],
587+ query_prefix=u''.join((request.form['q']).rsplit(search_query.query.decode('utf-8'), 1)),
587 selected_categories=search_query.categories,
588 selected_categories=search_query.categories,
588 pageno=search_query.pageno,
589 pageno=search_query.pageno,
589 time_range=search_query.time_range,
590 time_range=search_query.time_range,