This commit is contained in:
Kovid Goyal 2012-07-06 17:09:23 +05:30
parent e1c7404e02
commit fdad502205

View File

@ -15,8 +15,7 @@ from calibre.utils.config import tweaks, prefs
from calibre.utils.date import parse_date, now, UNDEFINED_DATE, clean_date_for_sort
from calibre.utils.search_query_parser import SearchQueryParser
from calibre.utils.pyparsing import ParseException
from calibre.utils.localization import (canonicalize_lang, lang_map, get_udc,
get_lang)
from calibre.utils.localization import (canonicalize_lang, lang_map, get_udc)
from calibre.ebooks.metadata import title_sort, author_to_author_sort
from calibre.ebooks.metadata.opf2 import metadata_to_opf
from calibre import prints
@ -131,8 +130,8 @@ def _match(query, value, matchkind):
else:
internal_match_ok = False
for t in value:
t = icu_lower(t)
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
t = icu_lower(t)
if (matchkind == EQUALS_MATCH):
if internal_match_ok:
if query == t:
@ -149,7 +148,7 @@ def _match(query, value, matchkind):
elif query == t:
return True
elif matchkind == REGEXP_MATCH:
return re.search(query, t, re.I|re.UNICODE)
return re.search(query, icu_lower(t), re.I|re.UNICODE)
elif matchkind == CONTAINS_MATCH:
return primary_find(query, t)[0] != -1
except re.error:
@ -228,7 +227,6 @@ class ResultCache(SearchQueryParser): # {{{
'''
def __init__(self, FIELD_MAP, field_metadata, db_prefs=None):
self.FIELD_MAP = FIELD_MAP
l = get_lang()
self.db_prefs = db_prefs
self.composites = {}
self.udc = get_udc()
@ -751,8 +749,6 @@ class ResultCache(SearchQueryParser): # {{{
else:
q = query
au_loc = self.FIELD_MAP['authors']
for id_ in candidates:
item = self._data[id_]
if item is None: continue