X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/967eed676fc83d15b26149047f353ac61faa8217..98062d2158ebe1f734d811691ab15e6887684281:/src/search/mock_search.py diff --git a/src/search/mock_search.py b/src/search/mock_search.py index 6c430400e..33d2a5eaf 100644 --- a/src/search/mock_search.py +++ b/src/search/mock_search.py @@ -19,11 +19,14 @@ class Search(Mock): index = MockIndex() - @staticmethod - def _find_some_books(query_terms=None, max_results=20): + def search_words(self, words, fields, required=None, book=True, picture=False): from .index import SearchResult - qs = Book.objects.order_by('?') + max_results = 20 + + if picture: return [] + + qs = Book.objects.filter(findable=True).order_by('?') results = [] for book in qs[:randint(1, max_results)]: doc = { @@ -31,10 +34,7 @@ class Search(Mock): 'book_id': book.pk, 'published_date': randint(1000, 1920), } - res = SearchResult(doc, how_found='mock', query_terms=query_terms) + res = SearchResult(doc, how_found='mock', query_terms=words) results.append(res) return results - def search_everywhere(self, searched, query_terms=None): - return [] -