github.com/weaviate/weaviate@v1.24.6/test/helper/sample-schema/multishard/multishard.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 multishard
    13  
    14  import (
    15  	"github.com/go-openapi/strfmt"
    16  	"github.com/weaviate/weaviate/entities/models"
    17  	"github.com/weaviate/weaviate/entities/schema"
    18  )
    19  
    20  const (
    21  	MultiShardID1 strfmt.UUID = "aa44bbee-ca5f-4db7-a412-5fc6a23c534a"
    22  	MultiShardID2 strfmt.UUID = "aa44bbee-ca5f-4db7-a412-5fc6a23c534b"
    23  	MultiShardID3 strfmt.UUID = "aa44bbee-ca5f-4db7-a412-5fc6a23c534c"
    24  )
    25  
    26  func ClassContextionaryVectorizer() *models.Class {
    27  	return class("text2vec-contextionary")
    28  }
    29  
    30  func ClassTransformersVectorizer() *models.Class {
    31  	return class("text2vec-transformers")
    32  }
    33  
    34  func class(vectorizer string) *models.Class {
    35  	return &models.Class{
    36  		Class: "MultiShard",
    37  		ModuleConfig: map[string]interface{}{
    38  			vectorizer: map[string]interface{}{
    39  				"vectorizeClassName": false,
    40  			},
    41  		},
    42  		Vectorizer: vectorizer,
    43  		Properties: []*models.Property{
    44  			{
    45  				Name:         "name",
    46  				DataType:     schema.DataTypeText.PropString(),
    47  				Tokenization: models.PropertyTokenizationWhitespace,
    48  				ModuleConfig: map[string]interface{}{
    49  					vectorizer: map[string]interface{}{
    50  						"vectorizePropertyName": false,
    51  					},
    52  				},
    53  			},
    54  		},
    55  		ShardingConfig: map[string]interface{}{
    56  			"actualCount":         float64(2),
    57  			"actualVirtualCount":  float64(128),
    58  			"desiredCount":        float64(2),
    59  			"desiredVirtualCount": float64(128),
    60  			"function":            "murmur3",
    61  			"key":                 "_id",
    62  			"strategy":            "hash",
    63  			"virtualPerPhysical":  float64(128),
    64  		},
    65  	}
    66  }
    67  
    68  func Objects() []*models.Object {
    69  	return []*models.Object{
    70  		{
    71  			Class: "MultiShard",
    72  			ID:    MultiShardID1,
    73  			Properties: map[string]interface{}{
    74  				"name": "multi shard one",
    75  			},
    76  		},
    77  		{
    78  			Class: "MultiShard",
    79  			ID:    MultiShardID2,
    80  			Properties: map[string]interface{}{
    81  				"name": "multi shard two",
    82  			},
    83  		},
    84  		{
    85  			Class: "MultiShard",
    86  			ID:    MultiShardID3,
    87  			Properties: map[string]interface{}{
    88  				"name": "multi shard three",
    89  			},
    90  		},
    91  	}
    92  }