github.com/weaviate/weaviate@v1.24.6/usecases/classification/classifier_vector_repo.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 classification 13 14 import ( 15 "context" 16 17 "github.com/weaviate/weaviate/entities/dto" 18 "github.com/weaviate/weaviate/entities/modulecapabilities" 19 "github.com/weaviate/weaviate/entities/search" 20 ) 21 22 type vectorClassSearchRepo struct { 23 vectorRepo vectorRepo 24 } 25 26 func newVectorClassSearchRepo(vectorRepo vectorRepo) *vectorClassSearchRepo { 27 return &vectorClassSearchRepo{vectorRepo} 28 } 29 30 func (r *vectorClassSearchRepo) VectorClassSearch(ctx context.Context, 31 params modulecapabilities.VectorClassSearchParams, 32 ) ([]search.Result, error) { 33 return r.vectorRepo.VectorSearch(ctx, dto.GetParams{ 34 Filters: params.Filters, 35 Pagination: params.Pagination, 36 ClassName: params.ClassName, 37 Properties: r.getProperties(params.Properties), 38 }) 39 } 40 41 func (r *vectorClassSearchRepo) getProperties(properties []string) search.SelectProperties { 42 if len(properties) > 0 { 43 props := search.SelectProperties{} 44 for i := range properties { 45 props = append(props, search.SelectProperty{Name: properties[i]}) 46 } 47 return props 48 } 49 return nil 50 }