Skip to content

Commit

Permalink
Review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpimenov authored and tatiana-yan committed Mar 11, 2020
1 parent 35ed58b commit d61ad24
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions search/search_quality/assessment_tool/search_request_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ void SearchRequestRunner::InitiateBackgroundSearch(size_t from, size_t to)
{
CHECK(m_contexts[index].m_searchState == Context::SearchState::Completed, ());
++m_backgroundNumProcessed;
LOG(LINFO, ("Using results from an earlier search for request number", index + 1));
if (m_backgroundNumProcessed == to - from + 1)
PrintBackgroundSearchStats();
}
}

Expand Down Expand Up @@ -215,6 +218,7 @@ void SearchRequestRunner::RunRequest(size_t index, bool background, size_t times
if (background)
{
++m_backgroundNumProcessed;
m_backgroundQueryHandles.erase(index);
if (m_backgroundNumProcessed == m_backgroundLastIndex - m_backgroundFirstIndex + 1)
PrintBackgroundSearchStats();
else
Expand Down Expand Up @@ -242,18 +246,11 @@ void SearchRequestRunner::PrintBackgroundSearchStats() const
vitals.reserve(m_backgroundLastIndex - m_backgroundFirstIndex + 1);
for (size_t index = m_backgroundFirstIndex; index <= m_backgroundLastIndex; ++index)
{
auto const & context = m_contexts[index];
auto const & edits = context.m_foundResultsEdits;
bool foundVital = false;
for (auto const & entry : edits.GetEntries())
{
if (entry.m_currRelevance == search::Sample::Result::Relevance::Vital)
{
foundVital = true;
break;
}
}

auto const & entries = m_contexts[index].m_foundResultsEdits.GetEntries();
bool const foundVital =
any_of(entries.begin(), entries.end(), [](ResultsEdits::Entry const & e) {
return e.m_currRelevance == search::Sample::Result::Relevance::Vital;
});
if (foundVital)
vitals.emplace_back(index + 1);
}
Expand Down

0 comments on commit d61ad24

Please sign in to comment.