Merge from trunk

This commit is contained in:
Charles Haley 2012-07-06 14:55:36 +02:00
commit e777ee817b
2 changed files with 4 additions and 8 deletions

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
@ -133,8 +132,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:
@ -151,7 +150,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:
if pref_use_primary_find_in_search:
return primary_find(query, t)[0] != -1
@ -233,7 +232,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()
@ -763,8 +761,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

View File

@ -216,7 +216,7 @@ icu_Collator_find(icu_Collator *self, PyObject *args, PyObject *kwargs) {
if (U_SUCCESS(status)) {
pos = usearch_first(search, &status);
if (pos != USEARCH_DONE)
length = (pos == USEARCH_DONE) ? -1 : usearch_getMatchedLength(search);
length = usearch_getMatchedLength(search);
else
pos = -1;
}