Fix #1914910 [Annotations Browser: Error when searching for punctuation](https://bugs.launchpad.net/calibre/+bug/1914910)

This commit is contained in:
Kovid Goyal 2021-02-07 19:49:35 +05:30
parent 973bd004d8
commit e723f56973
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -17,6 +17,7 @@ from urllib.parse import quote
from calibre import prepare_string_for_xml
from calibre.ebooks.metadata import authors_to_string, fmt_sidx
from calibre.db.backend import FTSQueryError
from calibre.gui2 import Application, choose_save_file, config, error_dialog, gprefs
from calibre.gui2.dialogs.confirm_delete import confirm
from calibre.gui2.viewer.widgets import ResultsDelegate, SearchBox
@ -543,6 +544,7 @@ class BrowsePanel(QWidget):
if q == self.current_query:
self.results_list.show_next(backwards)
return
try:
with BusyCursor():
db = current_db()
if not q['fts_engine_query']:
@ -559,6 +561,12 @@ class BrowsePanel(QWidget):
)
self.results_list.set_results(results, bool(q['fts_engine_query']))
self.current_query = q
except FTSQueryError as err:
return error_dialog(self, _('Invalid search expression'), '<p>' + _(
'The search expression: {0} is invalid. The search syntax used is the'
'SQLite Full text Search Query syntax, <a href="{1}">described here</a>.').format(
err.query, 'https://www.sqlite.org/fts5.html#full_text_query_syntax'),
det_msg=str(err), show=True)
def effective_query_changed(self):
self.do_find()