forked from organicmaps/organicmaps
[search] Increase emitted search results count.
This commit is contained in:
parent
f39540011b
commit
dab46e95e8
5 changed files with 12 additions and 11 deletions
|
@ -88,7 +88,7 @@ bool Result::operator== (Result const & r) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Results::AddResultCheckExistingEx(Result const & r)
|
||||
bool Results::AddResultCheckExisting(Result const & r)
|
||||
{
|
||||
if (find(m_vec.begin(), m_vec.end(), r) == m_vec.end())
|
||||
{
|
||||
|
|
|
@ -100,12 +100,12 @@ public:
|
|||
bool IsEndedNormal() const { return (m_status == ENDED); }
|
||||
//@}
|
||||
|
||||
inline void AddResult(Result const & r) { m_vec.push_back(r); }
|
||||
inline void AddResultCheckExisting(Result const & r)
|
||||
inline bool AddResult(Result const & r)
|
||||
{
|
||||
(void)AddResultCheckExistingEx(r);
|
||||
m_vec.push_back(r);
|
||||
return true;
|
||||
}
|
||||
bool AddResultCheckExistingEx(Result const & r);
|
||||
bool AddResultCheckExisting(Result const & r);
|
||||
|
||||
inline void Clear() { m_vec.clear(); }
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ void Engine::SearchAsync()
|
|||
m_pQuery->SearchAdditional(res,
|
||||
params.NeedSearch(SearchParams::AROUND_POSITION),
|
||||
params.NeedSearch(SearchParams::IN_VIEWPORT),
|
||||
2 * RESULTS_COUNT);
|
||||
RESULTS_COUNT);
|
||||
}
|
||||
catch (Query::CancelException const &)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
void ClearAllCaches();
|
||||
|
||||
private:
|
||||
static const int RESULTS_COUNT = 15;
|
||||
static const int RESULTS_COUNT = 30;
|
||||
|
||||
void SetViewportAsync(m2::RectD const & viewport, m2::RectD const & nearby);
|
||||
void SearchAsync();
|
||||
|
|
|
@ -612,7 +612,7 @@ void Query::FlushResults(Results & res, bool allMWMs, size_t resCount)
|
|||
|
||||
RemoveDuplicatingLinear(indV);
|
||||
|
||||
void (Results::*addFn)(Result const &) = allMWMs ?
|
||||
bool (Results::*addFn)(Result const &) = allMWMs ?
|
||||
&Results::AddResultCheckExisting :
|
||||
&Results::AddResult;
|
||||
|
||||
|
@ -650,13 +650,14 @@ void Query::FlushResults(Results & res, bool allMWMs, size_t resCount)
|
|||
|
||||
// emit feature results
|
||||
size_t count = res.GetCount();
|
||||
for (size_t i = 0; i < indV.size() && count < resCount; ++i, ++count)
|
||||
for (size_t i = 0; i < indV.size() && count < resCount; ++i)
|
||||
{
|
||||
if (m_cancel) break;
|
||||
|
||||
LOG(LDEBUG, (indV[i]));
|
||||
|
||||
(res.*addFn)(MakeResult(*(indV[i])));
|
||||
if ((res.*addFn)(MakeResult(*(indV[i]))))
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,7 +736,7 @@ template <class T> void Query::ProcessSuggestions(vector<T> & vec, Results & res
|
|||
GetSuggestion(r.GetName(), suggest);
|
||||
if (!suggest.empty() && added < MAX_SUGGESTS_COUNT)
|
||||
{
|
||||
if (res.AddResultCheckExistingEx(Result(r.GetName(), suggest)))
|
||||
if (res.AddResultCheckExisting(Result(r.GetName(), suggest)))
|
||||
{
|
||||
++added;
|
||||
i = vec.erase(i);
|
||||
|
|
Loading…
Add table
Reference in a new issue