MCPcopy
hub / github.com/dgraph-io/dgraph / Tokenizer

Interface Tokenizer

tok/tok.go:58–82  ·  view source on GitHub ↗

Tokenizer defines what a tokenizer must provide.

Source from the content-addressed store, hash-verified

56
57// Tokenizer defines what a tokenizer must provide.
58type Tokenizer interface {
59
60 // Name is name of tokenizer. This should be unique.
61 Name() string
62
63 // Type returns the string representation of the typeID that we care about.
64 Type() string
65
66 // Tokens return tokens for a given value. The tokens shouldn't be encoded
67 // with the byte identifier.
68 Tokens(interface{}) ([]string, error)
69
70 // Identifier returns the prefix byte for this token type. This should be
71 // unique. The range 0x80 to 0xff (inclusive) is reserved for user-provided
72 // custom tokenizers.
73 Identifier() byte
74
75 // IsSortable returns true if the tokenizer can be used for sorting/ordering.
76 IsSortable() bool
77
78 // IsLossy returns true if we don't store the values directly as index keys
79 // during tokenization. If a predicate is tokenized using an IsLossy() tokenizer,
80 // then we need to fetch the actual value and compare.
81 IsLossy() bool
82}
83
84var tokenizers = make(map[string]Tokenizer)
85var indexFactories = make(map[string]IndexFactory)

Callers 34

verifyStringIndexFunction · 0.95
SortTopNFunction · 0.65
SortWithFacetFunction · 0.65
TestConversionEdgeCasesFunction · 0.65
ConvertFunction · 0.65
MarshalFunction · 0.65
cantConvertFunction · 0.65
TestTypeForNameFunction · 0.65
encodeMethod · 0.65
cantCoerceScalarFunction · 0.65
compareSchemaUpdatesFunction · 0.65

Implementers 15

GeoTokenizertok/tok.go
IntTokenizertok/tok.go
FloatTokenizertok/tok.go
YearTokenizertok/tok.go
MonthTokenizertok/tok.go
DayTokenizertok/tok.go
HourTokenizertok/tok.go
TermTokenizertok/tok.go
ExactTokenizertok/tok.go
NGramTokenizertok/tok.go

Calls

no outgoing calls

Tested by

no test coverage detected