Exemple #1
0
def awesome_autocomplete(query):
    if not hasattr(g, "autocomplete_strings"):
        g.autocomplete_strings = [
            s.strip() for s in open(os.path.join(os.path.dirname(__file__), "autocomplete_strings.txt"))
        ]
    suggestions = lookups.get_awesomebar_suggestions(g, query)
    return Response(json.dumps([{"value": s} for s in suggestions]), mimetype="application/json")
Exemple #2
0
def autocomplete():
    db = get_db()
    query = request.args.get('query', '')
    suggestions = lookups.get_awesomebar_suggestions(
        get_autocomplete_strings(), query, db)
    _log('  =>  {} results'.format(len(suggestions)))
    return jsonify([{'value': s} for s in sorted(suggestions)])
Exemple #3
0
def awesome_autocomplete(query):
    if not hasattr(g, 'autocomplete_strings'):
        g.autocomplete_strings = [
            s.strip() for s in open(
                os.path.join(os.path.dirname(__file__),
                             'autocomplete_strings.txt'))
        ]
    suggestions = lookups.get_awesomebar_suggestions(g, query)
    return Response(json.dumps([{
        'value': s
    } for s in suggestions]),
                    mimetype='application/json')