| 734 | } |
| 735 | |
| 736 | void Processor::SearchPostcode() |
| 737 | { |
| 738 | // Create a copy of the query to trim it in-place. |
| 739 | string_view query(m_query.m_query); |
| 740 | strings::Trim(query); |
| 741 | |
| 742 | /// @todo So, "G4 " now doesn't match UK (Glasgow) postcodes as prefix :) |
| 743 | if (!LooksLikePostcode(query, !m_query.m_prefix.empty())) |
| 744 | return; |
| 745 | |
| 746 | vector<shared_ptr<MwmInfo>> infos; |
| 747 | m_dataSource.GetMwmsInfo(infos); |
| 748 | |
| 749 | auto const normQuery = NormalizeAndSimplifyString(query); |
| 750 | for (auto const & info : infos) |
| 751 | { |
| 752 | auto handle = m_dataSource.GetMwmHandleById(MwmSet::MwmId(info)); |
| 753 | if (!handle.IsAlive()) |
| 754 | continue; |
| 755 | auto & value = *handle.GetValue(); |
| 756 | if (!value.m_cont.IsExist(POSTCODE_POINTS_FILE_TAG)) |
| 757 | continue; |
| 758 | |
| 759 | /// @todo Well, ok for now, but we do only full or "prefix-rect" match w/o possible errors, with only one result. |
| 760 | PostcodePoints postcodes(value); |
| 761 | vector<m2::PointD> points; |
| 762 | postcodes.Get(normQuery, points); |
| 763 | if (points.empty()) |
| 764 | continue; |
| 765 | |
| 766 | m2::RectD r; |
| 767 | for (auto const & p : points) |
| 768 | r.Add(p); |
| 769 | |
| 770 | m_emitter.AddResultNoChecks( |
| 771 | m_ranker.MakeResult(RankerResult(r.Center(), query), true /* needAddress */, true /* needHighlighting */)); |
| 772 | m_emitter.Emit(); |
| 773 | |
| 774 | return; |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | void Processor::SearchBookmarks(bookmarks::GroupId const & groupId) |
| 779 | { |
nothing calls this directly
no test coverage detected