when published date is NaN, set to 0
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Thu, 1 Mar 2012 11:28:15 +0000 (12:28 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Thu, 1 Mar 2012 11:28:15 +0000 (12:28 +0100)
apps/search/index.py

index ead10b5..dc33575 100644 (file)
@@ -650,9 +650,10 @@ class SearchResult(object):
         self.book_id = int(stored.get("book_id"))
 
         pd = stored.get("published_date")
-        if pd is None:
-            pd = 0
-        self.published_date = int(pd)
+        try:
+            self.published_date = int(pd)
+        except ValueError:
+            self.published_date = 0
 
         header_type = stored.get("header_type")
         # we have a content hit in some header of fragment