fieldPostings method

PostingsMap fieldPostings(
  1. Iterable<String> fields
)

Filters the PostingsMap by zone names.

Returns a subset of the PostingsMap instance that only contains entries where a zone name in fields has a key in any document's postings the entry's postings lists.

Implementation

PostingsMap fieldPostings(Iterable<String> fields) => PostingsMap.from(this)
  ..removeWhere((key, value) {
    final docFields = <String>[];
    for (final doc in value.values) {
      docFields.addAll(doc.keys);
    }
    return docFields.toSet().intersection(fields.toSet()).isEmpty;
  });