fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix pipeline css in audiobook
[wolnelektury.git]
/
src
/
search
/
index.py
diff --git
a/src/search/index.py
b/src/search/index.py
index
4f9a765
..
0bd5c05
100644
(file)
--- a/
src/search/index.py
+++ b/
src/search/index.py
@@
-670,7
+670,7
@@
class SearchResult(object):
m.update(f[self.OTHER])
hits.append(m)
m.update(f[self.OTHER])
hits.append(m)
- hits.sort(
lambda a, b: cmp(a['score'], b['score'])
, reverse=True)
+ hits.sort(
key=lambda h: h['score']
, reverse=True)
self._processed_hits = hits
self._processed_hits = hits
@@
-744,7
+744,7
@@
class Search(SolrIndex):
else:
query = self.index.query()
query = self.apply_filters(query, filters).field_limit(score=True, all_fields=True)
else:
query = self.index.query()
query = self.apply_filters(query, filters).field_limit(score=True, all_fields=True)
- return [SearchResult(found, how_found='search_words'
) for found in query
]
+ return [SearchResult(found, how_found='search_words'
, query_terms=words) for found in query.execute()
]
def get_snippets(self, searchresult, query, field='text', num=1):
"""
def get_snippets(self, searchresult, query, field='text', num=1):
"""
@@
-826,13
+826,9
@@
class Search(SolrIndex):
if is_pdcounter:
if category == 'pd_author':
tag = PDCounterAuthor.objects.get(id=doc.get('tag_id'))
if is_pdcounter:
if category == 'pd_author':
tag = PDCounterAuthor.objects.get(id=doc.get('tag_id'))
- el
if
category == 'pd_book':
+ el
se: #
category == 'pd_book':
tag = PDCounterBook.objects.get(id=doc.get('tag_id'))
tag.category = 'pd_book' # make it look more lik a tag.
tag = PDCounterBook.objects.get(id=doc.get('tag_id'))
tag.category = 'pd_book' # make it look more lik a tag.
- else:
- # WTF
- print ("Warning. cannot get pdcounter tag_id=%d from db; cat=%s" % (
- int(doc.get('tag_id')), category)).encode('utf-8')
pd_tags.append(tag)
else:
tag = catalogue.models.Tag.objects.get(id=doc.get("tag_id"))
pd_tags.append(tag)
else:
tag = catalogue.models.Tag.objects.get(id=doc.get("tag_id"))