Updating the autocomplete query for databases