<commit_before>from gittip import db
from aspen import Response
SQL = "SELECT username, id FROM participants " \
      "WHERE username LIKE %s ORDER BY username"
^L

error = ''
if 'query' not in qs:
    error = "no 'query' key in querystring"
else:
    query = qs['query']
    if len(query) < 2:
        error = "query must be at least two characters"

if error:
    response.code = 400
    response.body = {"error": error}
else:
    response.body = [(r['username'], r['id']) \
                                     for r in db.fetchall(SQL, (query + '%',))]<commit_msg>Make querying case-insensitive; #449<commit_after>from gittip import db
from aspen import Response
SQL = "SELECT username, id FROM participants " \
      "WHERE username_lower LIKE %s ORDER BY username"
^L

error = ''
if 'query' not in qs:
    error = "no 'query' key in querystring"
else:
    query = qs['query']
    if len(query) < 2:
        error = "query must be at least two characters"

if error:
    response.code = 400
    response.body = {"error": error}
else:
    response.body = [(r['username'], r['id']) \
                             for r in db.fetchall(SQL, (query.lower() + '%',))]
{'fraction_non_alphanumeric': 0.1319622964867181, 'fraction_numerical': 0.009425878320479864, 'mean_word_length': 2.65, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7506205', 'n_tokens_mistral': 381, 'n_tokens_neox': 359, 'n_words': 131}