| 136 | } |
| 137 | |
| 138 | void PostingsSerialization::serialize(const roaring::api::roaring_bitmap_t & postings, UInt64 header, WriteBuffer & ostr) |
| 139 | { |
| 140 | if (header & RawPostings) |
| 141 | { |
| 142 | roaring::api::roaring_uint32_iterator_t it; |
| 143 | roaring_iterator_init(&postings, &it); |
| 144 | |
| 145 | while (it.has_value) |
| 146 | { |
| 147 | writeVarUInt(it.current_value, ostr); |
| 148 | roaring::api::roaring_uint32_iterator_advance(&it); |
| 149 | } |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | size_t num_bytes = roaring::api::roaring_bitmap_portable_size_in_bytes(&postings); |
| 154 | writeVarUInt(num_bytes, ostr); |
| 155 | |
| 156 | std::vector<char> memory(num_bytes); |
| 157 | roaring::api::roaring_bitmap_portable_serialize(&postings, memory.data()); |
| 158 | ostr.write(memory.data(), num_bytes); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | void PostingsSerialization::serialize(const PostingList & postings, TokenPostingsInfo & info, size_t posting_list_block_size, WriteBuffer & ostr) |
| 163 | { |