github.com/weaviate/weaviate@v1.24.6/test/acceptance/graphql_resolvers/network_fetch_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  // func Test_NetworkFetch(t *testing.T) {
    15  // 	result := AssertGraphQL(t, helper.RootAuth, `
    16  //     {
    17  // 			Network {
    18  // 				Fetch {
    19  // 					Things(where: {
    20  // 						class: {
    21  // 							name: "bestclass"
    22  // 							certainty: 0.8
    23  // 							keywords: [{value: "foo", weight: 0.9}]
    24  // 						},
    25  // 						properties: {
    26  // 							name: "bestproperty"
    27  // 							certainty: 0.8
    28  // 							keywords: [{value: "bar", weight: 0.9}]
    29  // 							operator: Equal
    30  // 							valueString: "some-value"
    31  // 						},
    32  // 					}) {
    33  // 						beacon certainty
    34  // 					}
    35  // 				}
    36  // 			}
    37  // 		}`,
    38  // 	)
    39  
    40  // 	results := result.Get("Network", "Fetch", "Things").Result
    41  // 	expected := []interface{}{
    42  // 		map[string]interface{}{
    43  // 			"beacon":    "weaviate://RemoteWeaviateForAcceptanceTest/things/c2b94c9a-fea2-4f9a-ae40-6d63534633f7",
    44  // 			"certainty": json.Number("0.5"),
    45  // 		},
    46  // 		map[string]interface{}{
    47  // 			"beacon":    "weaviate://RemoteWeaviateForAcceptanceTest/things/32fc9b12-00b8-46b2-962d-63c1f352e090",
    48  // 			"certainty": json.Number("0.7"),
    49  // 		},
    50  // 	}
    51  // 	assert.Equal(t, expected, results)
    52  // }
    53  
    54  // func Test_NetworkFetchFuzzy(t *testing.T) {
    55  // 	result := AssertGraphQL(t, helper.RootAuth, `
    56  //     {
    57  // 			Network {
    58  // 				Fetch {
    59  // 					Fuzzy(value:"something", certainty: 0.5) {
    60  // 						beacon certainty
    61  // 					}
    62  // 				}
    63  // 			}
    64  // 		}`,
    65  // 	)
    66  
    67  // 	results := result.Get("Network", "Fetch", "Fuzzy").Result
    68  // 	expected := []interface{}{
    69  // 		map[string]interface{}{
    70  // 			"beacon":    "weaviate://RemoteWeaviateForAcceptanceTest/things/61c21951-3460-4189-86ad-884a17b70c16",
    71  // 			"certainty": json.Number("0.5"),
    72  // 		},
    73  // 	}
    74  // 	assert.Equal(t, expected, results)
    75  // }