55#include " block_inverted_index.hpp"
66#include " freq_index.hpp"
77#include " mappable/mapper.hpp"
8- #include " util/util .hpp"
8+ #include " util/json_stats .hpp"
99
1010namespace pisa {
1111
@@ -34,8 +34,14 @@ void dump_stats(Collection& coll, std::string const& type, uint64_t postings) {
3434 spdlog::info (" Documents: {} bytes, {} bits per element" , docs_size, bits_per_doc);
3535 spdlog::info (" Frequencies: {} bytes, {} bits per element" , freqs_size, bits_per_freq);
3636
37- stats_line ()(" type" , type)(" size" , docs_size + freqs_size)(" docs_size" , docs_size)(
38- " freqs_size" , freqs_size)(" bits_per_doc" , bits_per_doc)(" bits_per_freq" , bits_per_freq);
37+ std::cout << pisa::json_stats ()
38+ .add (" type" , type)
39+ .add (" size" , docs_size + freqs_size)
40+ .add (" docs_size" , docs_size)
41+ .add (" freqs_size" , freqs_size)
42+ .add (" bits_per_doc" , bits_per_doc)
43+ .add (" bits_per_freq" , bits_per_freq)
44+ .str ();
3945}
4046
4147inline void dump_stats (SizeStats const & stats, std::size_t postings) {
@@ -44,8 +50,13 @@ inline void dump_stats(SizeStats const& stats, std::size_t postings) {
4450 double bits_per_freq = stats.freqs * 8.0 / postings;
4551 spdlog::info (" Documents: {} bytes, {} bits per element" , stats.docs , bits_per_doc);
4652 spdlog::info (" Frequencies: {} bytes, {} bits per element" , stats.freqs , bits_per_freq);
47- stats_line ()(" size" , stats.docs + stats.freqs )(" docs_size" , stats.docs )(
48- " freqs_size" , stats.freqs )(" bits_per_doc" , bits_per_doc)(" bits_per_freq" , bits_per_freq);
53+ std::cout << pisa::json_stats ()
54+ .add (" size" , stats.docs + stats.freqs )
55+ .add (" docs_size" , stats.docs )
56+ .add (" freqs_size" , stats.freqs )
57+ .add (" bits_per_doc" , bits_per_doc)
58+ .add (" bits_per_freq" , bits_per_freq)
59+ .str ();
4960}
5061
5162} // namespace pisa
0 commit comments