def event_search_location(value, query):
 locations = list(value.split(','))
 queries = []
 for i in locations:
  response = requests.get(('https://maps.googleapis.com/maps/api/geocode/json?address=' + unicode(i))).json()
  if response['results']:
   lng = float(response['results'][0]['geometry']['location']['lng'])
   lat = float(response['results'][0]['geometry']['location']['lat'])
   queries.append(get_query_close_area(lng, lat))
  queries.append(func.lower(Event.searchable_location_name).contains(i.lower()))
  queries.append(func.lower(Event.location_name).contains(i.lower()))
 return query.filter(or_(*queries))

def event_search_location ( value , query ) : locations = list ( value . split ( ',' ) ) queries = [ ] for i in locations : response = requests . get ( ( 'https://maps.googleapis.com/maps/api/geocode/json?address=' + unicode ( i ) ) ) . json ( ) if response [ 'results' ] : lng = float ( response [ 'results' ] [ 0 ] [ 'geometry' ] [ 'location' ] [ 'lng' ] ) lat = float ( response [ 'results' ] [ 0 ] [ 'geometry' ] [ 'location' ] [ 'lat' ] ) queries . append ( get_query_close_area ( lng , lat ) ) queries . append ( func . lower ( Event . searchable_location_name ) . contains ( i . lower ( ) ) ) queries . append ( func . lower ( Event . location_name ) . contains ( i . lower ( ) ) ) return query . filter ( or_ ( * queries ) )
return all queries which contain either a or b or c when location is a .