def get_result_list(query_str): query_str = shared.format_query_str(query_str) query = get_query_object(query_str) results = [] if not query: return results prefs = shared.get_prefs() bible = shared.get_bible_data(prefs['language']) chapters = shared.get_chapter_data() matching_books = get_matching_books(bible['books'], query) if 'chapter' not in query: query['chapter'] = 1 chosen_version = choose_best_version(prefs, bible, query) # Build result list from books matching the query for book in matching_books: # Skip result if given chapter exceeds number of chapters in book if query['chapter'] > chapters[book['id']]: continue # Result information results.append(get_result(book, query, chosen_version)) return results
def get_result_list(query_str): query_str = shared.format_query_str(query_str) html = get_search_html(query_str) parser = SearchResultParser() parser.feed(html) return parser.results
def get_result_list(query_str): query_str = shared.format_query_str(query_str) pref_matches = get_pref_matches(query_str) results = [] def filter_by_pref(result): return result['autocomplete'].strip().startswith(query_str.lower()) if pref_matches: pref_name = pref_matches.group(1) pref_value = pref_matches.group(2) if pref_name in pref_callbacks: results = pref_callbacks[pref_name](pref_value) else: results = filter(filter_by_pref, pref_results) else: results = pref_results return results