Skip to content

Commit

Permalink
fix: only warn user if >5 books not indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sivan22 committed Nov 21, 2024
1 parent 7f8e9b8 commit 5c73811
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/screens/full_text_search/tantivy_full_text_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ class _TantivyFullTextSearchState extends State<TantivyFullTextSearch>
void initState() {
super.initState();
() async {
widget.tab.booksToSearch.value =
(await context.read<AppModel>().library).getAllBooks().toSet();
final allBooks = (await context.read<AppModel>().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());
Expand Down

0 comments on commit 5c73811

Please sign in to comment.