| 239 | } |
| 240 | |
| 241 | void MetadataFilter::eval( |
| 242 | std::vector<std::pair<const LeafNode*, std::vector<uint64_t>>>& |
| 243 | leafNodeResults, |
| 244 | std::vector<uint64_t>& finalResult) { |
| 245 | if (!root_) { |
| 246 | return; |
| 247 | } |
| 248 | LeafResults leafResults; |
| 249 | for (auto& [leaf, result] : leafNodeResults) { |
| 250 | BOLT_CHECK_EQ( |
| 251 | result.size(), |
| 252 | finalResult.size(), |
| 253 | "Result size mismatch: {}", |
| 254 | leaf->field().toString()); |
| 255 | BOLT_CHECK( |
| 256 | leafResults.emplace(leaf, &result).second, |
| 257 | "Duplicate results: {}", |
| 258 | leaf->field().toString()); |
| 259 | } |
| 260 | const auto bitCount = finalResult.size() * 64; |
| 261 | if (auto* combined = root_->eval(leafResults, bitCount)) { |
| 262 | bits::orBits(finalResult.data(), combined, 0, bitCount); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | std::string MetadataFilter::toString() const { |
| 267 | return !root_ ? "" : root_->toString(); |
no test coverage detected