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

Method IsIndexed

schema/schema.go:285–302  ·  view source on GitHub ↗

IsIndexed returns whether the predicate is indexed or not

(ctx context.Context, pred string)

Source from the content-addressed store, hash-verified

283
284// IsIndexed returns whether the predicate is indexed or not
285func (s *state) IsIndexed(ctx context.Context, pred string) bool {
286 isWrite, _ := ctx.Value(IsWrite).(bool)
287 s.RLock()
288 defer s.RUnlock()
289 if isWrite {
290 // TODO(Aman): we could return the query schema if it is a delete.
291 if schema, ok := s.mutSchema[pred]; ok &&
292 (len(schema.Tokenizer) > 0 || len(schema.IndexSpecs) > 0) {
293 return true
294 }
295 }
296
297 if schema, ok := s.predicate[pred]; ok {
298 return len(schema.Tokenizer) > 0 || len(schema.IndexSpecs) > 0
299 }
300
301 return false
302}
303
304// Predicates returns the list of predicates for given group
305func (s *state) Predicates() []string {

Callers 12

sortWithIndexFunction · 0.80
helpProcessTaskMethod · 0.80
parseSrcFnFunction · 0.80
handleHasFunctionMethod · 0.80
verifyStringIndexFunction · 0.80
verifyCustomIndexFunction · 0.80
pickTokenizerFunction · 0.80
pickFactoryCreateSpecFunction · 0.80
indexTokensFunction · 0.80
handleDeleteAllMethod · 0.80
AddMutationWithIndexMethod · 0.80
TestSchemaIndexCustomFunction · 0.80

Calls 3

RLockMethod · 0.80
RUnlockMethod · 0.80
ValueMethod · 0.45

Tested by 1

TestSchemaIndexCustomFunction · 0.64