diff --git a/dict.go b/dict.go index bd54ab0..ac31ef7 100644 --- a/dict.go +++ b/dict.go @@ -35,6 +35,13 @@ type Dictionary struct { // represents an immutable, empty dictionary var emptyDictionary = &Dictionary{} +func (d *Dictionary) Cardinality() int { + if d.fst != nil { + return d.fst.Len() + } + return 0 +} + // PostingsList returns the postings list for the specified term func (d *Dictionary) PostingsList(term []byte, except *roaring.Bitmap, prealloc segment.PostingsList) (segment.PostingsList, error) {