FTS: Fix restrict books working on selected books rather than filtered books

This commit is contained in:
Kovid Goyal 2022-06-29 16:42:08 +05:30
parent cde3ff211c
commit 9787a710c2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -398,7 +398,7 @@ class ResultsView(QTreeView):
gui = get_gui()
restrict = None
if gui and gprefs['fts_library_restrict_books']:
restrict = gui.library_view.get_selected_ids(as_set=True)
restrict = frozenset(gui.library_view.model().all_current_book_ids())
with BusyCursor():
self.m.search(*a, restrict_to_book_ids=restrict, use_stemming=gprefs['fts_library_use_stemmer'])
self.expandAll()

View File

@ -585,6 +585,9 @@ class BooksModel(QAbstractTableModel): # {{{
return 0
return len(self.db.data) if self.db else 0
def all_current_book_ids(self):
return self.db.data._map_filtered
def count(self):
return self.rowCount(None)