github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/inverted_reindexer_set_to_roaringset.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 "time" 17 18 "github.com/weaviate/weaviate/adapters/repos/db/lsmkv" 19 ) 20 21 type ShardInvertedReindexTaskSetToRoaringSet struct{} 22 23 func (t *ShardInvertedReindexTaskSetToRoaringSet) GetPropertiesToReindex(ctx context.Context, 24 shard ShardLike, 25 ) ([]ReindexableProperty, error) { 26 reindexableProperties := []ReindexableProperty{} 27 28 bucketOptions := []lsmkv.BucketOption{ 29 lsmkv.WithDirtyThreshold(time.Duration(shard.Index().Config.MemtablesFlushDirtyAfter) * time.Second), 30 } 31 32 for name, bucket := range shard.Store().GetBucketsByName() { 33 if bucket.Strategy() == lsmkv.StrategySetCollection && 34 bucket.DesiredStrategy() == lsmkv.StrategyRoaringSet { 35 36 propName, indexType := GetPropNameAndIndexTypeFromBucketName(name) 37 switch indexType { 38 case IndexTypePropValue: 39 reindexableProperties = append(reindexableProperties, 40 ReindexableProperty{ 41 PropertyName: propName, 42 IndexType: IndexTypePropValue, 43 DesiredStrategy: lsmkv.StrategyRoaringSet, 44 BucketOptions: bucketOptions, 45 }, 46 ) 47 case IndexTypePropLength: 48 reindexableProperties = append(reindexableProperties, 49 ReindexableProperty{ 50 PropertyName: propName, 51 IndexType: IndexTypePropLength, 52 DesiredStrategy: lsmkv.StrategyRoaringSet, 53 BucketOptions: bucketOptions, 54 }, 55 ) 56 case IndexTypePropNull: 57 reindexableProperties = append(reindexableProperties, 58 ReindexableProperty{ 59 PropertyName: propName, 60 IndexType: IndexTypePropNull, 61 DesiredStrategy: lsmkv.StrategyRoaringSet, 62 BucketOptions: bucketOptions, 63 }, 64 ) 65 default: 66 // skip remaining 67 } 68 } 69 } 70 71 return reindexableProperties, nil 72 } 73 74 func (t *ShardInvertedReindexTaskSetToRoaringSet) OnPostResumeStore(ctx context.Context, shard ShardLike) error { 75 return nil 76 }