blob: a2cd96b5d95162ffd75bb33da147ad5ffbe49333 (
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
|
#include "index_builder.hpp"
#include "data_header_reader.hpp"
#include "features_vector.hpp"
#include "../storage/defines.hpp"
#include "../coding/file_container.hpp"
namespace indexer
{
bool BuildIndexFromDatFile(string const & datFile, string const & tmpFile)
{
try
{
FilesContainerR readCont(datFile);
FeaturesVector featuresVector(readCont);
FilesContainerW writeCont(datFile, FileWriter::OP_APPEND);
FileWriter writer = writeCont.GetWriter(INDEX_FILE_TAG);
BuildIndex(featuresVector, writer, tmpFile);
writeCont.Finish();
}
catch (Reader::OpenException const & e)
{
LOG(LERROR, (e.what(), " file is not found"));
return false;
}
catch (Reader::Exception const & e)
{
LOG(LERROR, ("Unknown error while reading file ", e.what()));
return false;
}
catch (Writer::Exception const & e)
{
LOG(LERROR, ("Error writing index file", e.what()));
}
return true;
}
} // namespace indexer
|