X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c2dba41b331a28fb7de510ca0e79d00e95bec99b..99f6dd4f1ff0390de9a9bbd4e3352b953cb9a235:/apps/search/index.py diff --git a/apps/search/index.py b/apps/search/index.py index 822429e75..7fb60b508 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- - +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django.conf import settings import os @@ -134,7 +136,6 @@ class Index(SolrIndex): for res in ids: uids.add(res['uid']) st += rows - # print "Will delete %s" % ','.join([x for x in uids]) if uids: self.index.delete(uids) return True @@ -164,7 +165,7 @@ class Index(SolrIndex): q_id_cat = self.index.Q(q_id & q_cat) tag_qs.append(q_id_cat) - self.delete_query(tag_qs) + self.delete_query(*tag_qs) else: # all q = self.index.Q(tag_id__any=True) self.delete_query(q) @@ -465,7 +466,6 @@ class Index(SolrIndex): text=u''.join(footnote), is_footnote=True) self.index.add(doc) - #print "@ footnote text: %s" % footnote footnote = [] # handle fragments and themes. @@ -498,7 +498,6 @@ class Index(SolrIndex): fragment_anchor=fid, text=fix_format(frag['text']), themes=frag['themes']) - #print '@ FRAG %s' % frag['content'] self.index.add(doc) # Collect content. @@ -511,7 +510,6 @@ class Index(SolrIndex): # in the end, add a section text. doc = add_part(snippets, header_index=position, header_type=header.tag, text=fix_format(content)) - #print '@ CONTENT: %s' % fix_format(content) self.index.add(doc) @@ -881,7 +879,7 @@ class Search(SolrIndex): tag = PDCounterBook.objects.get(id=doc.get('tag_id')) tag.category = 'pd_book' # make it look more lik a tag. else: - print "Warning. cannot get pdcounter tag_id=%d from db; cat=%s" % (int(doc.get('tag_id')), category) + 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"))