Skip to content

Commit

Permalink
interface ordering and vellum abstracting interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
CascadingRadium committed Dec 9, 2024
1 parent 10d6de6 commit d86fabb
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions index.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,21 @@ type CopyReader interface {
CloseCopyReader() error
}

type SynonymReader interface {
IndexReader
SynonymTermReader(ctx context.Context, thesaurusName string, term []byte) (SynonymTermReader, error)
type RegexAutomaton interface {
MatchesRegex(string) bool
}

type IndexReaderRegexp interface {
FieldDictRegexp(field string, regex string) (FieldDict, error)
FieldDictRegexpAutomaton(field string, regex string) (FieldDict, RegexAutomaton, error)
}

type FuzzyAutomaton interface {
MatchAndDistance(term string) (bool, uint8)
}

type IndexReaderFuzzy interface {
FieldDictFuzzy(field string, term string, fuzziness int, prefix string) (FieldDict, error)
FieldDictFuzzyAutomaton(field string, term string, fuzziness int, prefix string) (FieldDict, FuzzyAutomaton, error)
}

type IndexReaderContains interface {
Expand Down Expand Up @@ -206,12 +210,6 @@ type TermFieldReader interface {
Size() int
}

type SynonymTermReader interface {
Next() (string, error)
Close() error
Size() int
}

type DictEntry struct {
Term string
Count uint64
Expand Down Expand Up @@ -263,3 +261,27 @@ type IndexBuilder interface {
Index(doc Document) error
Close() error
}

type SynonymTermReader interface {
Next() (string, error)
Close() error
Size() int
}

type ThesaurusEntry struct {
Term string
}

type ThesaurusKeys interface {
Next() (*ThesaurusEntry, error)
Close() error
}

type ThesaurusReader interface {
IndexReader
SynonymTermReader(ctx context.Context, name string, term []byte) (SynonymTermReader, error)
ThesaurusKeys(name string) (ThesaurusKeys, error)
ThesaurusKeysFuzzy(name string, term string, fuzziness int, prefix string) (ThesaurusKeys, error)
ThesaurusKeysRegexp(name string, regex string) (ThesaurusKeys, error)
ThesaurusKeysPrefix(name string, termPrefix []byte) (ThesaurusKeys, error)
}

0 comments on commit d86fabb

Please sign in to comment.