IsIndexed returns whether the predicate is indexed or not
(ctx context.Context, pred string)
| 283 | |
| 284 | // IsIndexed returns whether the predicate is indexed or not |
| 285 | func (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 |
| 305 | func (s *state) Predicates() []string { |