X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ca7bffa0f660afefb98d37ac002b9652e1c858e5..281a6f613c78ffd1fa81951db829a5551fd2e42d:/apps/search/index.py diff --git a/apps/search/index.py b/apps/search/index.py index 4962cae99..da54fe7f0 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): """ @@ -201,6 +201,7 @@ class Index(SolrIndex): "is_pdcounter": False, "uid": "tag%d" % tag.id } + print "ADD 1 %s" % doc self.index.add(doc) def create_book_doc(self, book): @@ -249,6 +250,7 @@ class Index(SolrIndex): book_doc[n] = f book_doc['uid'] = "book%s" % book_doc['book_id'] + print "ADD 2 %s" % book_doc self.index.add(book_doc) del book_doc book_fields = { @@ -460,7 +462,7 @@ class Index(SolrIndex): doc = add_part(snippets, header_index=position, header_type=header.tag, text=u''.join(footnote), is_footnote=True) - + print "ADD 3 %s" % doc self.index.add(doc) #print "@ footnote text: %s" % footnote footnote = [] @@ -496,6 +498,7 @@ class Index(SolrIndex): text=fix_format(frag['text']), themes=frag['themes']) #print '@ FRAG %s' % frag['content'] + print "ADD 4 %s" % doc self.index.add(doc) # Collect content. @@ -510,6 +513,7 @@ class Index(SolrIndex): header_type=header.tag, text=fix_format(content)) #print '@ CONTENT: %s' % fix_format(content) + print "ADD 5 %s" % doc self.index.add(doc) finally: @@ -722,7 +726,7 @@ class Search(SolrIndex): Search facilities. """ def __init__(self, default_field="text"): - super(Search, self).__init__() + super(Search, self).__init__(mode='r') # def get_tokens(self, searched, field='text', cached=None): # """returns tokens analyzed by a proper (for a field) analyzer