mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
e777ee817b
@ -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.date import parse_date, now, UNDEFINED_DATE, clean_date_for_sort
|
||||||
from calibre.utils.search_query_parser import SearchQueryParser
|
from calibre.utils.search_query_parser import SearchQueryParser
|
||||||
from calibre.utils.pyparsing import ParseException
|
from calibre.utils.pyparsing import ParseException
|
||||||
from calibre.utils.localization import (canonicalize_lang, lang_map, get_udc,
|
from calibre.utils.localization import (canonicalize_lang, lang_map, get_udc)
|
||||||
get_lang)
|
|
||||||
from calibre.ebooks.metadata import title_sort, author_to_author_sort
|
from calibre.ebooks.metadata import title_sort, author_to_author_sort
|
||||||
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
@ -133,8 +132,8 @@ def _match(query, value, matchkind):
|
|||||||
else:
|
else:
|
||||||
internal_match_ok = False
|
internal_match_ok = False
|
||||||
for t in value:
|
for t in value:
|
||||||
t = icu_lower(t)
|
|
||||||
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
|
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
|
||||||
|
t = icu_lower(t)
|
||||||
if (matchkind == EQUALS_MATCH):
|
if (matchkind == EQUALS_MATCH):
|
||||||
if internal_match_ok:
|
if internal_match_ok:
|
||||||
if query == t:
|
if query == t:
|
||||||
@ -151,7 +150,7 @@ def _match(query, value, matchkind):
|
|||||||
elif query == t:
|
elif query == t:
|
||||||
return True
|
return True
|
||||||
elif matchkind == REGEXP_MATCH:
|
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:
|
elif matchkind == CONTAINS_MATCH:
|
||||||
if pref_use_primary_find_in_search:
|
if pref_use_primary_find_in_search:
|
||||||
return primary_find(query, t)[0] != -1
|
return primary_find(query, t)[0] != -1
|
||||||
@ -233,7 +232,6 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
'''
|
'''
|
||||||
def __init__(self, FIELD_MAP, field_metadata, db_prefs=None):
|
def __init__(self, FIELD_MAP, field_metadata, db_prefs=None):
|
||||||
self.FIELD_MAP = FIELD_MAP
|
self.FIELD_MAP = FIELD_MAP
|
||||||
l = get_lang()
|
|
||||||
self.db_prefs = db_prefs
|
self.db_prefs = db_prefs
|
||||||
self.composites = {}
|
self.composites = {}
|
||||||
self.udc = get_udc()
|
self.udc = get_udc()
|
||||||
@ -763,8 +761,6 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
else:
|
else:
|
||||||
q = query
|
q = query
|
||||||
|
|
||||||
au_loc = self.FIELD_MAP['authors']
|
|
||||||
|
|
||||||
for id_ in candidates:
|
for id_ in candidates:
|
||||||
item = self._data[id_]
|
item = self._data[id_]
|
||||||
if item is None: continue
|
if item is None: continue
|
||||||
|
@ -216,7 +216,7 @@ icu_Collator_find(icu_Collator *self, PyObject *args, PyObject *kwargs) {
|
|||||||
if (U_SUCCESS(status)) {
|
if (U_SUCCESS(status)) {
|
||||||
pos = usearch_first(search, &status);
|
pos = usearch_first(search, &status);
|
||||||
if (pos != USEARCH_DONE)
|
if (pos != USEARCH_DONE)
|
||||||
length = (pos == USEARCH_DONE) ? -1 : usearch_getMatchedLength(search);
|
length = usearch_getMatchedLength(search);
|
||||||
else
|
else
|
||||||
pos = -1;
|
pos = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user