Skip to content

Commit

Permalink
exposing the cardinality API of the fst
Browse files Browse the repository at this point in the history
  • Loading branch information
Thejas-bhat committed Dec 6, 2024
1 parent 60ebc9a commit c27a7c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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) {
Expand Down

0 comments on commit c27a7c6

Please sign in to comment.