github.com/weaviate/weaviate@v1.24.6/usecases/traverser/traverser_explore_concepts.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 traverser 13 14 import ( 15 "context" 16 17 "github.com/weaviate/weaviate/entities/models" 18 "github.com/weaviate/weaviate/entities/search" 19 "github.com/weaviate/weaviate/entities/searchparams" 20 ) 21 22 // Explore through unstructured search terms 23 func (t *Traverser) Explore(ctx context.Context, 24 principal *models.Principal, params ExploreParams, 25 ) ([]search.Result, error) { 26 if params.Limit == 0 { 27 params.Limit = 20 28 } 29 30 err := t.authorizer.Authorize(principal, "get", "traversal/*") 31 if err != nil { 32 return nil, err 33 } 34 35 // to conduct a cross-class vector search, all classes must 36 // be configured with the same vector index distance type. 37 // additionally, certainty cannot be passed to Explore when 38 // the classes are configured to use a distance type other 39 // than cosine. 40 if err := t.validateExploreDistance(params); err != nil { 41 return nil, err 42 } 43 44 return t.explorer.CrossClassVectorSearch(ctx, params) 45 } 46 47 // ExploreParams are the parameters used by the GraphQL `Explore { }` API 48 type ExploreParams struct { 49 NearVector *searchparams.NearVector 50 NearObject *searchparams.NearObject 51 Offset int 52 Limit int 53 ModuleParams map[string]interface{} 54 WithCertaintyProp bool 55 }