github.com/weaviate/weaviate@v1.24.6/adapters/handlers/graphql/local/local.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 local 13 14 import ( 15 "github.com/sirupsen/logrus" 16 "github.com/tailor-inc/graphql" 17 "github.com/weaviate/weaviate/adapters/handlers/graphql/local/aggregate" 18 "github.com/weaviate/weaviate/adapters/handlers/graphql/local/explore" 19 "github.com/weaviate/weaviate/adapters/handlers/graphql/local/get" 20 "github.com/weaviate/weaviate/entities/schema" 21 "github.com/weaviate/weaviate/usecases/config" 22 "github.com/weaviate/weaviate/usecases/modules" 23 ) 24 25 // Build the local queries from the database schema. 26 func Build(dbSchema *schema.Schema, logger logrus.FieldLogger, 27 config config.Config, modulesProvider *modules.Provider, 28 ) (graphql.Fields, error) { 29 getField, err := get.Build(dbSchema, logger, modulesProvider) 30 if err != nil { 31 return nil, err 32 } 33 34 aggregateField, err := aggregate.Build(dbSchema, config, modulesProvider) 35 if err != nil { 36 return nil, err 37 } 38 39 if modulesProvider.HasMultipleVectorizers() { 40 localFields := graphql.Fields{ 41 "Get": getField, 42 "Aggregate": aggregateField, 43 } 44 45 return localFields, nil 46 } 47 48 exploreField := explore.Build(dbSchema.Objects, modulesProvider) 49 50 localFields := graphql.Fields{ 51 "Get": getField, 52 "Aggregate": aggregateField, 53 "Explore": exploreField, 54 } 55 56 return localFields, nil 57 }