From 6e374f03fd5a0b9c7725f8268dd9c7d57d49ee89 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Mon, 30 Jan 2012 17:14:35 +0100 Subject: [PATCH] check for empty source in dc --- apps/search/index.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/search/index.py b/apps/search/index.py index d63d3f8b4..993c7d7ba 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 -- 2.20.1