X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ca7bffa0f660afefb98d37ac002b9652e1c858e5..fa9ab52217a8e6912fa4677fc7bb1da21044b470:/apps/search/index.py diff --git a/apps/search/index.py b/apps/search/index.py index 4962cae99..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): """ @@ -460,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 = [] @@ -649,7 +648,6 @@ class SearchResult(object): except catalogue.models.Fragment.DoesNotExist: # stale index continue - print f # Figure out if we were searching for a token matching some word in theme name. themes = frag.tags.filter(category='theme') themes_hit = set() @@ -722,7 +720,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 @@ -954,7 +952,6 @@ class Search(SolrIndex): continue text = snippets.get((int(position), int(length))) - print "== %s -- %s ==" % (query, text) snip = self.index.highlight(text=text, field=field, q=query) snips[idx] = snip if snip: @@ -971,6 +968,7 @@ class Search(SolrIndex): snips = map(lambda s: s and s.replace("/\n", "\n"), snips) searchresult.snippets = snips + return snips def hint_tags(self, query, pdcounter=True, prefix=True):