mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When doing FTS on notes also match on item values
This commit is contained in:
parent
00936dbafb
commit
54c43bc7ef
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user