mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-06 04:24:29 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
31
search/common.hpp
Normal file
31
search/common.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "indexer/categories_holder.hpp"
|
||||
|
||||
#include "base/buffer_vector.hpp"
|
||||
#include "base/small_set.hpp"
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
namespace search
|
||||
{
|
||||
// The prefix is stored separately.
|
||||
// todo(@m, @y) Find a way (similar to TokenSlice maybe?) to unify
|
||||
// the prefix and non-prefix tokens.
|
||||
using QueryTokens = buffer_vector<strings::UniString, 32>;
|
||||
|
||||
using Locales = base::SafeSmallSet<CategoriesHolder::kLocaleMapping.size() + 1>;
|
||||
|
||||
/// Upper bound for max count of tokens for indexing and scoring.
|
||||
size_t constexpr kMaxNumTokens = 32;
|
||||
size_t constexpr kMaxNumSuggests = 5;
|
||||
|
||||
struct QueryString
|
||||
{
|
||||
std::string m_query; ///< raw UTF8 query string
|
||||
QueryTokens m_tokens; ///< splitted by UniChar tokens (not including last prefix)
|
||||
strings::UniString m_prefix; ///< last prefix or empty (if query is ended with separator)
|
||||
|
||||
bool IsEmpty() const { return m_tokens.empty() && m_prefix.empty(); }
|
||||
};
|
||||
|
||||
} // namespace search
|
||||
Reference in New Issue
Block a user