github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/helpers/helpers.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 helpers
    13  
    14  import (
    15  	"fmt"
    16  
    17  	"github.com/weaviate/weaviate/entities/filters"
    18  )
    19  
    20  var (
    21  	ObjectsBucket              = []byte("objects")
    22  	ObjectsBucketLSM           = "objects"
    23  	VectorsCompressedBucketLSM = "vectors_compressed"
    24  	VectorsBucketLSM           = "vectors"
    25  	DimensionsBucketLSM        = "dimensions"
    26  )
    27  
    28  // MetaCountProp helps create an internally used propName for meta props that
    29  // don't explicitly exist in the user schema, but are required for proper
    30  // indexing, such as the count of arrays.
    31  func MetaCountProp(propName string) string {
    32  	return fmt.Sprintf("%s__meta_count", propName)
    33  }
    34  
    35  func PropLength(propName string) string {
    36  	return propName + filters.InternalPropertyLength
    37  }
    38  
    39  func PropNull(propName string) string {
    40  	return propName + filters.InternalNullIndex
    41  }
    42  
    43  // BucketFromPropNameLSM creates string used as the bucket name
    44  // for a particular prop in the inverted index
    45  func BucketFromPropNameLSM(propName string) string {
    46  	return fmt.Sprintf("property_%s", propName)
    47  }
    48  
    49  func BucketFromPropNameLengthLSM(propName string) string {
    50  	return BucketFromPropNameLSM(PropLength(propName))
    51  }
    52  
    53  func BucketFromPropNameNullLSM(propName string) string {
    54  	return BucketFromPropNameLSM(PropNull(propName))
    55  }
    56  
    57  func BucketFromPropNameMetaCountLSM(propName string) string {
    58  	return BucketFromPropNameLSM(MetaCountProp(propName))
    59  }
    60  
    61  func TempBucketFromBucketName(bucketName string) string {
    62  	return bucketName + "_temp"
    63  }
    64  
    65  func BucketSearchableFromPropNameLSM(propName string) string {
    66  	return BucketFromPropNameLSM(propName + "_searchable")
    67  }