fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Track HTML events.
[wolnelektury.git]
/
src
/
search
/
mock_search.py
diff --git
a/src/search/mock_search.py
b/src/search/mock_search.py
index
118078f
..
33d2a5e
100644
(file)
--- a/
src/search/mock_search.py
+++ b/
src/search/mock_search.py
@@
-19,10
+19,13
@@
class Search(Mock):
index = MockIndex()
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
from .index import SearchResult
+ max_results = 20
+
+ if picture: return []
+
qs = Book.objects.filter(findable=True).order_by('?')
results = []
for book in qs[:randint(1, max_results)]:
qs = Book.objects.filter(findable=True).order_by('?')
results = []
for book in qs[:randint(1, max_results)]:
@@
-31,10
+34,7
@@
class Search(Mock):
'book_id': book.pk,
'published_date': randint(1000, 1920),
}
'book_id': book.pk,
'published_date': randint(1000, 1920),
}
- res = SearchResult(doc, how_found='mock', query_terms=
query_term
s)
+ res = SearchResult(doc, how_found='mock', query_terms=
word
s)
results.append(res)
return results
results.append(res)
return results
- def search_everywhere(self, searched, query_terms=None):
- return []
-