X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/386957d4f29d34d557a62065575a40c83d7d3ede..faef1a564460905fd4c78953bf2f7023b5a94fc7:/apps/search/index.py diff --git a/apps/search/index.py b/apps/search/index.py index 9617077d9..6d97047a0 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -276,7 +276,7 @@ class Index(BaseIndex): footnote_tags = ['pa', 'pt', 'pr', 'pe'] - skip_header_tags = ['autor_utworu', 'nazwa_utworu', 'dzielo_nadrzedne'] + skip_header_tags = ['autor_utworu', 'nazwa_utworu', 'dzielo_nadrzedne', '{http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF'] published_date_re = re.compile("([0-9]+)[\]. ]*$") @@ -323,7 +323,6 @@ class Index(BaseIndex): # get published date source = book_info.source_name match = self.published_date_re.search(source) - print("published date is %s %s" % (match, match is not None and match.groups())) if match is not None: fields["published_date"] = Field("published_date", str(match.groups()[0]), Field.Store.YES, Field.Index.NOT_ANALYZED) @@ -426,9 +425,8 @@ class Index(BaseIndex): fragments = {} snippets = Snippets(book.id).open('w') - position = 0 try: - for header in list(master): + for header, position in zip(list(master), range(len(master))): if header.tag in self.skip_header_tags: continue @@ -441,15 +439,15 @@ class Index(BaseIndex): for start, end in walker(header, ignore_tags=self.ignore_content_tags): # handle footnotes - if start is not None and start.tag in self.footnote_tags: - footnote = ' '.join(start.itertext()) - elif end is not None and footnote is not None and end.tag in self.footnote_tags: - doc = add_part(snippets, header_index=position, header_type=header.tag, - content=footnote) + # if start is not None and start.tag in self.footnote_tags: + # footnote = ' '.join(start.itertext()) + # elif end is not None and footnote is not None and end.tag in self.footnote_tags: + # doc = add_part(snippets, header_index=position, header_type=header.tag, + # content=footnote) - self.index.addDocument(doc) + # self.index.addDocument(doc) - footnote = None + # footnote = None # handle fragments and themes. if start is not None and start.tag == 'begin': @@ -496,7 +494,6 @@ class Index(BaseIndex): content=fix_format(content)) self.index.addDocument(doc) - position += 1 finally: snippets.close() @@ -619,7 +616,6 @@ class SearchResult(object): pd = stored.get("published_date") if pd is None: - print "published_date is none for book %d" % self.book_id pd = 0 self.published_date = int(pd)