github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/searcher.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 modulecapabilities 13 14 import ( 15 "context" 16 17 "github.com/go-openapi/strfmt" 18 "github.com/weaviate/weaviate/entities/moduletools" 19 ) 20 21 // FindVectorFn method for getting a vector of given object by its ID 22 type FindVectorFn = func(ctx context.Context, className string, id strfmt.UUID, tenant, targetVector string) ([]float32, string, error) 23 24 // VectorForParams defines method for passing a raw searcher content to the module 25 // and exchanging it for a vector. Warning: Argument "cfg" 26 // (moduletools.ClassConfig) is not guaranteed to be non-nil. Implementations 27 // have to provide a nil check before using it. It is generally present on 28 // class-based action, but is not present on Cross-Class requests, such as 29 // Explore {} 30 type VectorForParams = func(ctx context.Context, params interface{}, 31 className string, findVectorFn FindVectorFn, cfg moduletools.ClassConfig) ([]float32, error) 32 33 // ArgumentVectorForParams contains argument definitions and it's respective 34 // vector for params search method 35 type ArgumentVectorForParams = map[string]VectorForParams 36 37 // Searcher defines all methods for all searchers 38 // for getting a vector from a given raw searcher content 39 type Searcher interface { 40 VectorSearches() ArgumentVectorForParams 41 } 42 43 // ModuleArgumentVectorForParams contains module's argument definitions and it's 44 // vector for params search method 45 type ModuleArgumentVectorForParams = map[string]ArgumentVectorForParams 46 47 // DependencySearcher defines all of the available searches loaded as a dependency 48 type DependencySearcher interface { 49 VectorSearches() ModuleArgumentVectorForParams 50 }