From 78af18413f739e788c5134fd64eff26507288ca2 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Tue, 25 Jan 2022 16:43:03 +1100 Subject: [PATCH] show at most 500 search results --- Session/Home/GlobalSearch/GlobalSearchViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Session/Home/GlobalSearch/GlobalSearchViewController.swift b/Session/Home/GlobalSearch/GlobalSearchViewController.swift index 80aa405ab..8e227582d 100644 --- a/Session/Home/GlobalSearch/GlobalSearchViewController.swift +++ b/Session/Home/GlobalSearch/GlobalSearchViewController.swift @@ -140,8 +140,8 @@ class GlobalSearchViewController: BaseVC, UITableViewDelegate, UITableViewDataSo guard let self = self else { return } self.isLoading = true // The max search result count is set according to the keyword length. This is just a workaround for performance issue. - // The longer and more accurate the keyword is, the less search results should there be. - searchResults = self.searcher.searchForHomeScreen(searchText: searchText, maxSearchResults: searchText.count * 50, transaction: transaction) + // The longer and more accurate the keyword is, the less search results should there be. + searchResults = self.searcher.searchForHomeScreen(searchText: searchText, maxSearchResults: min(searchText.count * 50, 500), transaction: transaction) }, completionBlock: { [weak self] in AssertIsOnMainThread() guard let self = self, let results = searchResults, self.lastSearchText == searchText else { return }