[search] Exposed a soft limit on the number of bookmarks on index.

This commit is contained in:
Maxim Pimenov 2019-08-30 18:45:12 +03:00 committed by Aleksey Belousov
parent 44c0b4eec7
commit 015f1ac282
2 changed files with 14 additions and 0 deletions

View file

@ -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<ProcessorHandle> & 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<BookmarkInfo> const & marks)
{
vector<BookmarkIdDoc> data;

View file

@ -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<BookmarkInfo> const & marks);
void OnBookmarksUpdated(std::vector<BookmarkInfo> const & marks);
void OnBookmarksDeleted(std::vector<kml::MarkId> const & marks);