File tree 5 files changed +12
-13
lines changed
5 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class block_freq_index {
21
21
block_freq_index () = default ;
22
22
explicit block_freq_index (MemorySource source) : m_source(std::move(source))
23
23
{
24
- mapper::map (*this , source .data (), mapper::map_flags::warmup);
24
+ mapper::map (*this , m_source .data (), mapper::map_flags::warmup);
25
25
}
26
26
27
27
class builder {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class freq_index {
22
22
23
23
explicit freq_index (MemorySource source) : m_source(std::move(source))
24
24
{
25
- mapper::map (*this , source .data (), mapper::map_flags::warmup);
25
+ mapper::map (*this , m_source .data (), mapper::map_flags::warmup);
26
26
}
27
27
28
28
class builder {
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ class wand_data {
32
32
wand_data () = default ;
33
33
explicit wand_data (MemorySource source) : m_source(std::move(source))
34
34
{
35
- mapper::map (*this , source .data (), mapper::map_flags::warmup);
35
+ mapper::map (*this , m_source .data (), mapper::map_flags::warmup);
36
36
}
37
37
38
38
template <typename LengthsIterator>
Original file line number Diff line number Diff line change @@ -42,18 +42,15 @@ void test_block_freq_index()
42
42
}
43
43
44
44
Temporary_Directory tmpdir;
45
- auto filename = tmpdir.path (). string () + " temp.bin" ;
45
+ auto filename = ( tmpdir.path () / " temp.bin" ). string () ;
46
46
{
47
47
collection_type coll;
48
48
b.build (coll);
49
49
pisa::mapper::freeze (coll, filename.c_str ());
50
50
}
51
51
52
52
{
53
- collection_type coll;
54
- mio::mmap_source m (filename.c_str ());
55
- pisa::mapper::map (coll, m);
56
-
53
+ collection_type coll (pisa::MemorySource::mapped_file (filename));
57
54
for (size_t i = 0 ; i < posting_lists.size (); ++i) {
58
55
auto const & plist = posting_lists[i];
59
56
auto doc_enum = coll[i];
Original file line number Diff line number Diff line change 10
10
11
11
#include " freq_index.hpp"
12
12
#include " mappable/mapper.hpp"
13
+ #include " memory_source.hpp"
13
14
#include " mio/mmap.hpp"
14
15
#include " sequence/indexed_sequence.hpp"
15
16
#include " sequence/partitioned_sequence.hpp"
16
17
#include " sequence/positive_sequence.hpp"
17
18
#include " sequence/uniform_partitioned_sequence.hpp"
19
+ #include " temporary_directory.hpp"
18
20
19
21
template <typename DocsSequence, typename FreqsSequence>
20
22
void test_freq_index ()
21
23
{
24
+ Temporary_Directory tmpdir;
25
+ auto idx_path = (tmpdir.path () / " coll.bin" ).string ();
26
+
22
27
pisa::global_parameters params;
23
28
uint64_t universe = 20000 ;
24
29
using collection_type = pisa::freq_index<DocsSequence, FreqsSequence>;
@@ -40,14 +45,11 @@ void test_freq_index()
40
45
{
41
46
collection_type coll;
42
47
b.build (coll);
43
- pisa::mapper::freeze (coll, " temp.bin " );
48
+ pisa::mapper::freeze (coll, idx_path. c_str () );
44
49
}
45
50
46
51
{
47
- collection_type coll;
48
- mio::mmap_source m (" temp.bin" );
49
- pisa::mapper::map (coll, m);
50
-
52
+ collection_type coll (pisa::MemorySource::mapped_file (idx_path));
51
53
for (size_t i = 0 ; i < posting_lists.size (); ++i) {
52
54
auto const & plist = posting_lists[i];
53
55
auto doc_enum = coll[i];
You can’t perform that action at this time.
0 commit comments