mirror of
https://github.com/searxng/searxng
synced 2024-11-07 03:20:28 +00:00
Merge pull request #2127 from msafadieh/master
[fix] fix the browser autocomplete feature.
This commit is contained in:
commit
f3bfc19a55
@ -13,6 +13,6 @@
|
|||||||
</Url>
|
</Url>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if autocomplete %}
|
{% if autocomplete %}
|
||||||
<Url rel="suggestions" type="application/json" template="{{ host }}autocompleter"/>
|
<Url rel="suggestions" type="application/x-suggestions+json" template="{{ host }}autocompleter?q={searchTerms}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</OpenSearchDescription>
|
</OpenSearchDescription>
|
||||||
|
@ -790,13 +790,13 @@ def autocompleter():
|
|||||||
results.append(raw_text_query.getFullQuery())
|
results.append(raw_text_query.getFullQuery())
|
||||||
|
|
||||||
# return autocompleter results
|
# return autocompleter results
|
||||||
if request.form.get('format') == 'x-suggestions':
|
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
|
||||||
return Response(json.dumps([raw_text_query.query, results]),
|
|
||||||
mimetype='application/json')
|
|
||||||
|
|
||||||
return Response(json.dumps(results),
|
return Response(json.dumps(results),
|
||||||
mimetype='application/json')
|
mimetype='application/json')
|
||||||
|
|
||||||
|
return Response(json.dumps([raw_text_query.query, results]),
|
||||||
|
mimetype='application/x-suggestions+json')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/preferences', methods=['GET', 'POST'])
|
@app.route('/preferences', methods=['GET', 'POST'])
|
||||||
def preferences():
|
def preferences():
|
||||||
|
Loading…
Reference in New Issue
Block a user