X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8b808f24709efb16f6b6eff6abb05b41341573c7..fa9ab52217a8e6912fa4677fc7bb1da21044b470:/apps/search/index.py diff --git a/apps/search/index.py b/apps/search/index.py index 32cf5f922..557f4045c 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -111,7 +111,7 @@ class Index(SolrIndex): Class indexing books. """ def __init__(self): - super(Index, self).__init__() + super(Index, self).__init__(mode='rw') def delete_query(self, *queries): """ @@ -202,7 +202,6 @@ class Index(SolrIndex): "uid": "tag%d" % tag.id } self.index.add(doc) - print "%s %s" % (doc['tag_name'], doc['tag_category']) def create_book_doc(self, book): """ @@ -461,7 +460,6 @@ class Index(SolrIndex): doc = add_part(snippets, header_index=position, header_type=header.tag, text=u''.join(footnote), is_footnote=True) - self.index.add(doc) #print "@ footnote text: %s" % footnote footnote = [] @@ -518,12 +516,13 @@ class Index(SolrIndex): class SearchResult(object): - def __init__(self, doc, how_found=None, query=None): + def __init__(self, doc, how_found=None, query=None, query_terms=None): # self.search = search self.boost = 1.0 self._hits = [] self._processed_hits = None # processed hits self.snippets = [] + self.query_terms = query_terms if 'score' in doc: self._score = doc['score'] @@ -551,7 +550,9 @@ class SearchResult(object): hit = (sec + (header_span,), fragment, self._score, { 'how_found': how_found, 'snippets_pos': snippets_pos, - 'snippets_revision': snippets_rev + 'snippets_revision': snippets_rev, + 'themes': doc.get('themes', []), + 'themes_pl': doc.get('themes_pl', []) }) self._hits.append(hit) @@ -559,7 +560,7 @@ class SearchResult(object): def __unicode__(self): return u"