From 4730816948861ff1e67630a0b4af5df1b379ad40 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Fri, 13 Jul 2012 15:53:26 +0200 Subject: [PATCH] Fix terrible regression in search --- src/calibre/library/caches.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 4f0cc82fa9..e9bb6286f3 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -156,12 +156,14 @@ def _match(query, value, matchkind): elif query == t: return True elif matchkind == REGEXP_MATCH: - return re.search(query, t, re.I|re.UNICODE) + if re.search(query, t, re.I|re.UNICODE): + return True elif matchkind == CONTAINS_MATCH: if pref_use_primary_find_in_search: - return primary_find(query, t)[0] != -1 - else: - return query in t + if primary_find(query, t)[0] != -1: + return True + elif query in t: + return True except re.error: pass return False