github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/shard_init_properties.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package db 13 14 import ( 15 "context" 16 17 enterrors "github.com/weaviate/weaviate/entities/errors" 18 19 "github.com/pkg/errors" 20 "github.com/weaviate/weaviate/adapters/repos/db/propertyspecific" 21 "github.com/weaviate/weaviate/entities/models" 22 ) 23 24 func (s *Shard) initProperties(class *models.Class) error { 25 s.propertyIndices = propertyspecific.Indices{} 26 if class == nil { 27 return nil 28 } 29 30 eg := enterrors.NewErrorGroupWrapper(s.index.logger) 31 for _, prop := range class.Properties { 32 s.createPropertyIndex(context.TODO(), prop, eg) 33 } 34 35 eg.Go(func() error { 36 if err := s.addIDProperty(context.TODO()); err != nil { 37 return errors.Wrap(err, "create id property index") 38 } 39 return nil 40 }) 41 42 if s.index.invertedIndexConfig.IndexTimestamps { 43 eg.Go(func() error { 44 if err := s.addTimestampProperties(context.TODO()); err != nil { 45 return errors.Wrap(err, "create timestamp properties indexes") 46 } 47 return nil 48 }) 49 } 50 51 if s.index.Config.TrackVectorDimensions { 52 eg.Go(func() error { 53 if err := s.addDimensionsProperty(context.TODO()); err != nil { 54 return errors.Wrap(err, "crreate dimensions property index") 55 } 56 return nil 57 }) 58 } 59 60 if err := eg.Wait(); err != nil { 61 return errors.Wrapf(err, "init properties on shard '%s'", s.ID()) 62 } 63 return nil 64 }