Skip to content

Commit c27a7c6

Browse files
committed
exposing the cardinality API of the fst
1 parent 60ebc9a commit c27a7c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dict.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ type Dictionary struct {
3838
// represents an immutable, empty dictionary
3939
var emptyDictionary = &Dictionary{}
4040

41+
func (d *Dictionary) Cardinality() int {
42+
if d.fst != nil {
43+
return d.fst.Len()
44+
}
45+
return 0
46+
}
47+
4148
// PostingsList returns the postings list for the specified term
4249
func (d *Dictionary) PostingsList(term []byte, except *roaring.Bitmap,
4350
prealloc segment.PostingsList) (segment.PostingsList, error) {

0 commit comments

Comments
 (0)