From 5c7381118c2124344beb7c65ff8aeb4213451be4 Mon Sep 17 00:00:00 2001 From: Sivan Ratson <89018301+Sivan22@users.noreply.github.com> Date: Fri, 22 Nov 2024 00:08:28 +0200 Subject: [PATCH] fix: only warn user if >5 books not indexed --- .../full_text_search/tantivy_full_text_search.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/screens/full_text_search/tantivy_full_text_search.dart b/lib/screens/full_text_search/tantivy_full_text_search.dart index 7774ccab..08b46b60 100644 --- a/lib/screens/full_text_search/tantivy_full_text_search.dart +++ b/lib/screens/full_text_search/tantivy_full_text_search.dart @@ -28,14 +28,12 @@ class _TantivyFullTextSearchState extends State void initState() { super.initState(); () async { - widget.tab.booksToSearch.value = - (await context.read().library).getAllBooks().toSet(); + final allBooks = (await context.read().library).getAllBooks(); + widget.tab.booksToSearch.value = allBooks.toSet(); // Check if index is up to date - final totalBooks = widget.tab.booksToSearch.value.length; + final totalBooks = allBooks.length; final indexedBooks = TantivyDataProvider.instance.booksDone.length; - setState(() { - _showIndexWarning = totalBooks != indexedBooks; - }); + _showIndexWarning = totalBooks - indexedBooks > 5; }(); widget.tab.aproximateSearch.addListener(() => updateResults()); widget.tab.booksToSearch.addListener(() => updateResults());