def search_hashtags(search_query): result = {} json_data = raw_to_json(Hashtag.search(search_query.replace("&", " ").split())[0]) result[search_query] = json_data json_data = raw_to_json(Hashtag.search(search_query.replace("&", " ").split())[1]) result[search_query+"_or"] = json_data return jsonify(result)
def search(search_query): search_query_strings = search_query.replace("&", " ").split() json_data = { "tweets" : raw_to_json(Tweet.search(search_query_strings)[0]), "tweets_or": raw_to_json(Tweet.search(search_query_strings)[1]), "hashtags" : raw_to_json(Hashtag.search(search_query_strings)[0]), "hashtags_or": raw_to_json(Hashtag.search(search_query_strings)[1]) } return jsonify(json_data)