Welcome to mirror list, hosted at ThFree Co, Russian Federation.

search_params.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dd151003e2f745ff23895920814bf0bc18a9b7e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once

#include "search/hotels_filter.hpp"
#include "search/mode.hpp"

#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"

#include <cstddef>
#include <functional>
#include <memory>
#include <string>

#include <boost/optional.hpp>

namespace search
{
class Results;
class Tracer;

struct SearchParams
{
  static size_t const kDefaultNumBookmarksResults = 1000;
  static size_t const kDefaultNumResultsEverywhere = 30;
  static size_t const kDefaultNumResultsInViewport = 200;

  using OnStarted = std::function<void()>;
  using OnResults = std::function<void(Results const &)>;

  bool IsEqualCommon(SearchParams const & rhs) const;

  void Clear() { m_query.clear(); }

  OnStarted m_onStarted;
  OnResults m_onResults;

  std::string m_query;
  std::string m_inputLocale;

  boost::optional<m2::PointD> m_position;
  m2::RectD m_viewport;

  size_t m_maxNumResults = kDefaultNumResultsEverywhere;

  // Minimal distance between search results in mercators, needed for
  // pre-ranking of viewport search results.
  double m_minDistanceOnMapBetweenResults = 0.0;

  Mode m_mode = Mode::Everywhere;

  // Needed to generate search suggests.
  bool m_suggestsEnabled = false;

  // Needed to generate address for results.
  bool m_needAddress = false;

  // Needed to highlight matching parts of search result names.
  bool m_needHighlighting = false;

  std::shared_ptr<hotels_filter::Rule> m_hotelsFilter;

  std::shared_ptr<Tracer> m_tracer;
};

std::string DebugPrint(SearchParams const & params);
}  // namespace search