github.com/weaviate/weaviate@v1.24.6/test/acceptance/vector_distances/data_test.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 test
    13  
    14  import (
    15  	"testing"
    16  
    17  	"github.com/weaviate/weaviate/entities/models"
    18  	"github.com/weaviate/weaviate/entities/schema"
    19  )
    20  
    21  func addTestSchemaCosine(t *testing.T) {
    22  	createObjectClass(t, &models.Class{
    23  		Class:      "Cosine_Class",
    24  		Vectorizer: "none",
    25  		Properties: []*models.Property{
    26  			{
    27  				Name:         "name",
    28  				DataType:     schema.DataTypeText.PropString(),
    29  				Tokenization: models.PropertyTokenizationWhitespace,
    30  			},
    31  		},
    32  		VectorIndexConfig: map[string]interface{}{
    33  			"distance": "cosine",
    34  		},
    35  	})
    36  }
    37  
    38  func addTestSchemaOther(t *testing.T) {
    39  	createObjectClass(t, &models.Class{
    40  		Class:      "Dot_Class",
    41  		Vectorizer: "none",
    42  		Properties: []*models.Property{
    43  			{
    44  				Name:         "name",
    45  				DataType:     schema.DataTypeText.PropString(),
    46  				Tokenization: models.PropertyTokenizationWhitespace,
    47  			},
    48  		},
    49  		VectorIndexConfig: map[string]interface{}{
    50  			"distance": "dot",
    51  		},
    52  	})
    53  
    54  	createObjectClass(t, &models.Class{
    55  		Class:      "L2Squared_Class",
    56  		Vectorizer: "none",
    57  		Properties: []*models.Property{
    58  			{
    59  				Name:         "name",
    60  				DataType:     schema.DataTypeText.PropString(),
    61  				Tokenization: models.PropertyTokenizationWhitespace,
    62  			},
    63  		},
    64  		VectorIndexConfig: map[string]interface{}{
    65  			"distance": "l2-squared",
    66  		},
    67  	})
    68  
    69  	createObjectClass(t, &models.Class{
    70  		Class:      "Manhattan_Class",
    71  		Vectorizer: "none",
    72  		Properties: []*models.Property{
    73  			{
    74  				Name:         "name",
    75  				DataType:     schema.DataTypeText.PropString(),
    76  				Tokenization: models.PropertyTokenizationWhitespace,
    77  			},
    78  		},
    79  		VectorIndexConfig: map[string]interface{}{
    80  			"distance": "manhattan",
    81  		},
    82  	})
    83  
    84  	createObjectClass(t, &models.Class{
    85  		Class:      "Hamming_Class",
    86  		Vectorizer: "none",
    87  		Properties: []*models.Property{
    88  			{
    89  				Name:         "name",
    90  				DataType:     schema.DataTypeText.PropString(),
    91  				Tokenization: models.PropertyTokenizationWhitespace,
    92  			},
    93  		},
    94  		VectorIndexConfig: map[string]interface{}{
    95  			"distance": "hamming",
    96  		},
    97  	})
    98  }