[search] Fix bug with points coding in search index generation.

This commit is contained in:
vng 2012-02-11 00:34:31 +03:00 committed by Alex Zolotarev
parent edd7834f31
commit f8209a8981
4 changed files with 12 additions and 8 deletions

View file

@ -202,8 +202,7 @@ namespace feature
feature::DataHeader header;
header.Load(container.GetReader(HEADER_FILE_TAG));
serial::CodingParams cp(search::POINT_CODING_BITS,
header.GetDefCodingParams().GetBasePointUint64());
serial::CodingParams cp(search::GetCPForTrie(header.GetDefCodingParams()));
scoped_ptr<search::TrieIterator> pTrieRoot(
::trie::reader::ReadTrie(container.GetReader(SEARCH_INDEX_FILE_TAG),

View file

@ -164,8 +164,7 @@ void indexer::BuildSearchIndex(FeaturesVector const & featuresVector, Writer & w
{
{
StringsFile names(tmpFilePath);
serial::CodingParams cp(search::POINT_CODING_BITS,
featuresVector.GetCodingParams().GetBasePointUint64());
serial::CodingParams cp(search::GetCPForTrie(featuresVector.GetCodingParams()));
featuresVector.ForEachOffset(FeatureInserter(names, cp));
@ -182,7 +181,7 @@ void indexer::BuildSearchIndex(FeaturesVector const & featuresVector, Writer & w
bool indexer::BuildSearchIndexFromDatFile(string const & fName)
{
LOG(LINFO, ("Start building search index ..."));
LOG(LINFO, ("Start building search index. Bits = ", search::POINT_CODING_BITS));
try
{
@ -200,6 +199,8 @@ bool indexer::BuildSearchIndexFromDatFile(string const & fName)
FileWriter writer(tmpFile);
BuildSearchIndex(featuresVector, writer, pl.WritablePathForFile(fName + ".search_index_1.tmp"));
LOG(LINFO, ("Search index size = ", writer.Size()));
}
{

View file

@ -51,6 +51,11 @@ typedef ::trie::reader::EmptyValueReader EdgeValueReader;
trie::EdgeValueReader::ValueType> TrieIterator;
static const uint8_t CATEGORIES_LANG = 128;
static const uint8_t POINT_CODING_BITS = 24;
static const uint8_t POINT_CODING_BITS = 20;
inline serial::CodingParams GetCPForTrie(serial::CodingParams const & orig)
{
CoordPointT const p = PointU2PointD(orig.GetBasePoint(), orig.GetCoordBits());
return serial::CodingParams(POINT_CODING_BITS, m2::PointD(p.first, p.second));
}
} // namespace search

View file

@ -629,8 +629,7 @@ void Query::SearchFeatures(vector<vector<strings::UniString> > const & tokens,
if (pMwm->m_cont.IsReaderExist(SEARCH_INDEX_FILE_TAG))
{
feature::DataHeader const & header = pMwm->GetHeader();
serial::CodingParams cp(POINT_CODING_BITS,
header.GetDefCodingParams().GetBasePointUint64());
serial::CodingParams cp(GetCPForTrie(header.GetDefCodingParams()));
scoped_ptr<TrieIterator> pTrieRoot(::trie::reader::ReadTrie(
pMwm->m_cont.GetReader(SEARCH_INDEX_FILE_TAG),