diff --git a/dict.go b/dict.go index e30bf242..9b7cd1ee 100644 --- a/dict.go +++ b/dict.go @@ -46,6 +46,13 @@ func (d *Dictionary) PostingsList(term []byte, except *roaring.Bitmap, return d.postingsList(term, except, preallocPL) } +func (d *Dictionary) Cardinality() int { + if d.fst != nil { + return d.fst.Len() + } + return 0 +} + func (d *Dictionary) postingsList(term []byte, except *roaring.Bitmap, rv *PostingsList) (*PostingsList, error) { if d.fstReader == nil { if rv == nil || rv == emptyPostingsList {