From 87ab4d9dd1e3cd34b45a4bfba57374ee1d7a4457 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 15 Mar 2018 02:33:28 +0300 Subject: [PATCH] Improve local search in sticker sets. - Don't index special sticker sets, like "Favorite stickers". - Show "Not found." if no local results and waiting for server-side. --- .../SourceFiles/chat_helpers/stickers_list_widget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 19ff63ab38..dc424b09c4 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -919,7 +919,7 @@ void StickersListWidget::refreshSearchRows( _searchSets.clear(); fillLocalSearchRows(_searchNextQuery); - if (!cloudSets && _searchSets.empty()) { + if (!cloudSets && _searchNextQuery.isEmpty()) { showStickerSet(!_mySets.empty() ? _mySets[0].id : Stickers::FeaturedSetId); @@ -1711,7 +1711,11 @@ void StickersListWidget::refreshSearchSets() { void StickersListWidget::refreshSearchIndex() { _searchIndex.clear(); for (const auto &set : _mySets) { - const auto list = TextUtilities::PrepareSearchWords(set.title + ' ' + set.shortName); + if (set.flags & MTPDstickerSet_ClientFlag::f_special) { + continue; + } + const auto string = set.title + ' ' + set.shortName; + const auto list = TextUtilities::PrepareSearchWords(string); _searchIndex.emplace_back(set.id, list); } }