fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change text for missing authors in public domain
[wolnelektury.git]
/
src
/
search
/
views.py
diff --git
a/src/search/views.py
b/src/search/views.py
index
bda24b0
..
f7f6040
100644
(file)
--- a/
src/search/views.py
+++ b/
src/search/views.py
@@
-142,8
+142,8
@@
def main(request):
(['metadata'], True),
(['text', 'themes_pl'], False),
)
(['metadata'], True),
(['text', 'themes_pl'], False),
)
- for fields
et
, is_book in fieldsets:
- search_fields += fields
et
+ for fields, is_book in fieldsets:
+ search_fields += fields
results_parts.append(search.search_words(words, search_fields, book=is_book))
results = []
results_parts.append(search.search_words(words, search_fields, book=is_book))
results = []
@@
-157,6
+157,10
@@
def main(request):
results.append(result)
ids_results[book_id] = result
results.append(result)
ids_results[book_id] = result
+ descendant_ids = set(
+ Book.objects.filter(id__in=ids_results, ancestor__in=ids_results).values_list('id', flat=True))
+ results = [result for result in results if result.book_id not in descendant_ids]
+
for result in results:
search.get_snippets(result, query, num=3)
for result in results:
search.get_snippets(result, query, num=3)