From 5d3f4483d48655682297aa3c945c997633ea45d2 Mon Sep 17 00:00:00 2001
From: Marcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Date: Thu, 1 Mar 2012 12:28:15 +0100
Subject: [PATCH 1/1] when published date is NaN, set to 0

---
 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 ead10b5dd..dc33575bc 100644
--- a/apps/search/index.py
+++ b/apps/search/index.py
@@ -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
-- 
2.20.1