From 015f1ac282598b3b5fb0bacb19dd5f8b1daabbb3 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Fri, 30 Aug 2019 18:45:12 +0300 Subject: [PATCH] [search] Exposed a soft limit on the number of bookmarks on index. --- map/search_api.cpp | 8 ++++++++ map/search_api.hpp | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/map/search_api.cpp b/map/search_api.cpp index 70ea3f1c4e..62f6835974 100644 --- a/map/search_api.cpp +++ b/map/search_api.cpp @@ -44,6 +44,8 @@ double const kDistEqualQueryMercator = MercatorBounds::MetersToMercator(kDistEqu // 200 squared kilometers. double const kMaxAreaToLoadAllHotelsInViewport = 2e8; +size_t const kMaximumPossibleNumberOfBookmarksToIndex = 5000; + // Cancels search query by |handle|. void CancelQuery(weak_ptr & handle) { @@ -395,6 +397,12 @@ void SearchAPI::EnableIndexingOfBookmarksDescriptions(bool enable) m_engine.EnableIndexingOfBookmarksDescriptions(enable); } +// static +size_t SearchAPI::GetMaximumPossibleNumberOfBookmarksToIndex() +{ + return kMaximumPossibleNumberOfBookmarksToIndex; +} + void SearchAPI::OnBookmarksCreated(vector const & marks) { vector data; diff --git a/map/search_api.hpp b/map/search_api.hpp index dad366fc02..0c3ff5d77e 100644 --- a/map/search_api.hpp +++ b/map/search_api.hpp @@ -146,6 +146,12 @@ public: void EnableIndexingOfBookmarksDescriptions(bool enable); + // A hint on the maximum number of bookmarks that can be stored in the + // search index for bookmarks. It is advisable that the client send + // OnBookmarksDeleted if the limit is crossed. + // The limit is not enforced by the Search API. + static size_t GetMaximumPossibleNumberOfBookmarksToIndex(); + void OnBookmarksCreated(std::vector const & marks); void OnBookmarksUpdated(std::vector const & marks); void OnBookmarksDeleted(std::vector const & marks);