From f4fb43875fe83d1556522600767d0b365fde37ed Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 21 Jan 2013 11:25:09 +0530 Subject: [PATCH] ... --- src/calibre/db/search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/search.py b/src/calibre/db/search.py index 743922e6e4..5a02a5e5da 100644 --- a/src/calibre/db/search.py +++ b/src/calibre/db/search.py @@ -557,6 +557,9 @@ class Search(object): if not q: return all_book_ids + if not isinstance(q, type(u'')): + q = q.decode('utf-8') + # We construct a new parser instance per search as pyparsing is not # thread safe. On my desktop, constructing a SearchQueryParser instance # takes 0.000975 seconds and restoring it from a pickle takes @@ -567,8 +570,9 @@ class Search(object): self.keypair_search, prefs[ 'limit_search_columns' ], prefs[ 'limit_search_columns_to' ], self.all_search_locations) + try: - ret = sqp.parse(query) + ret = sqp.parse(q) finally: sqp.dbcache = None return ret