Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces for thesaurus datatype #46

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,37 @@
Aggregate(stats FieldStats)
Fetch() map[string]map[string]uint64
}

type ThesaurusSegment interface {
Segment
Thesaurus(field string) (Thesaurus, error)
}

type Thesaurus interface {
SynonymsList(term []byte, except *roaring.Bitmap, prealloc SynonymsList) (SynonymsList, error)

AutomatonIterator(a Automaton,
startKeyInclusive, endKeyExclusive []byte) ThesaurusIterator

Contains(key []byte) (bool, error)
}

type ThesaurusIterator interface {
Next() (*index.ThesaurusEntry, error)

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: index.ThesaurusEntry

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: index.ThesaurusEntry

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: index.ThesaurusEntry

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, macos-latest)

undefined: index.ThesaurusEntry

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.22.x, ubuntu-latest)

undefined: index.ThesaurusEntry

Check failure on line 197 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.22.x, macos-latest)

undefined: index.ThesaurusEntry
}

type SynonymsList interface {
Iterator(prealloc SynonymsIterator) SynonymsIterator
Size() int
}

type SynonymsIterator interface {
Next() (Synonym, error)
Size() int
}

type Synonym interface {
Number() uint32
Term() string
Size() int
}
Loading