diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-03-19 18:44:47 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-03-19 18:51:22 +0300 |
commit | 9ebeb9645ab213546786a99e09ff814c4f7d266f (patch) | |
tree | e2e313918e0f72816fabeb3345025a83c47e8923 /search | |
parent | 85faa2de2fa22a53cf99154e3333c4c194ceaf1c (diff) |
[search] Pivot features cache lazy initialization.
Diffstat (limited to 'search')
-rw-r--r-- | search/pre_ranker.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp index cea49b9ac7..711526d17c 100644 --- a/search/pre_ranker.cpp +++ b/search/pre_ranker.cpp @@ -78,8 +78,7 @@ void PreRanker::FillMissingFieldsInPreResults() unique_ptr<RankTable> ranks = make_unique<DummyRankTable>(); unique_ptr<RankTable> popularityRanks = make_unique<DummyRankTable>(); unique_ptr<LazyCentersTable> centers; - - m_pivotFeatures.SetPosition(m_params.m_accuratePivotCenter, m_params.m_scale); + bool pivotFeaturesInitialized = false; ForEach([&](PreRankerResult & r) { FeatureID const & id = r.GetId(); @@ -116,6 +115,11 @@ void PreRanker::FillMissingFieldsInPreResults() } else { + if (!pivotFeaturesInitialized) + { + m_pivotFeatures.SetPosition(m_params.m_accuratePivotCenter, m_params.m_scale); + pivotFeaturesInitialized = true; + } info.m_distanceToPivot = m_pivotFeatures.GetDistanceToFeatureMeters(id); } }); |