X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/94924a2ca60f4f045c739cdb19d859cdcf8959af..5dbe16a08d4f68377aab0013b17d7094267cf98a:/apps/search/index.py?ds=sidebyside diff --git a/apps/search/index.py b/apps/search/index.py index d63d3f8b4..47583ec32 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -332,9 +332,10 @@ class Index(BaseIndex): # get published date source = book_info.source_name - match = self.published_date_re.search(source) - if match is not None: - fields["published_date"] = Field("published_date", str(match.groups()[0]), Field.Store.YES, Field.Index.NOT_ANALYZED) + if hasattr(book_info, 'source_name'): + match = self.published_date_re.search(source) + if match is not None: + fields["published_date"] = Field("published_date", str(match.groups()[0]), Field.Store.YES, Field.Index.NOT_ANALYZED) return fields @@ -758,8 +759,6 @@ class SearchResult(object): def __cmp__(self, other): c = cmp(self.score, other.score) if c == 0: - if not hasattr(other,'published_date') or not hasattr(self, 'published_date'): - import pdb; pdb.set_trace() # this is inverted, because earlier date is better return cmp(other.published_date, self.published_date) else: