diff --git a/src/calibre/db/notes/connect.py b/src/calibre/db/notes/connect.py index ad001252f8..ce5241ad73 100644 --- a/src/calibre/db/notes/connect.py +++ b/src/calibre/db/notes/connect.py @@ -200,6 +200,7 @@ class Notes: def set_note(self, conn, field_name, item_id, item_value, marked_up_text='', used_resource_hashes=(), searchable_text=copy_marked_up_text): if searchable_text is copy_marked_up_text: searchable_text = marked_up_text + searchable_text = item_value + '\n' + searchable_text note_id = self.note_id_for(conn, field_name, item_id) old_resources = frozenset(self.resources_used_by(conn, note_id)) if not marked_up_text: diff --git a/src/calibre/db/tests/notes.py b/src/calibre/db/tests/notes.py index 460c8d08fd..132d992ade 100644 --- a/src/calibre/db/tests/notes.py +++ b/src/calibre/db/tests/notes.py @@ -120,6 +120,11 @@ def test_fts(self: 'NotesTest'): self.ae(ids_for_search('common'), {('authors', authors[0]), ('authors', authors[1]), ('tags', tags[0]), ('tags', tags[1])}) self.ae(ids_for_search('common', ('tags',)), {('tags', tags[0]), ('tags', tags[1])}) + # test that searching by item value works + an = cache.get_item_name('authors', authors[0]) + self.ae(ids_for_search(' AND '.join(an.split()), ('authors',)), {('authors', authors[0])}) + + class NotesTest(BaseTest): ae = BaseTest.assertEqual