qdrant / go-client

Go client for Qdrant vector search engine
Apache License 2.0
159 stars 15 forks source link

User facing type is unexported #28

Closed akfaew closed 1 month ago

akfaew commented 1 year ago

I'm going through the sample code, and noticed that one type is unexported.

The sample code is:

140                         Id: &pb.PointId{                                                                                                                                                                                                                                                                                   
141                                 PointIdOptions: &pb.PointId_Num{Num: 2},                                                                                                                                                                                                                                                   
142                         },

I understand that I can use either an int or a uuid. I wanted to learn how to use a uuid:

$ go doc github.com/qdrant/go-client/qdrant.PointId
package go_client // import "github.com/qdrant/go-client/qdrant"

type PointId struct {

        // Types that are assignable to PointIdOptions:
        //      *PointId_Num
        //      *PointId_Uuid
        PointIdOptions isPointId_PointIdOptions `protobuf_oneof:"point_id_options"`
        // Has unexported fields.
}

func (*PointId) Descriptor() ([]byte, []int)
func (x *PointId) GetNum() uint64
func (m *PointId) GetPointIdOptions() isPointId_PointIdOptions
func (x *PointId) GetUuid() string
func (*PointId) ProtoMessage()
func (x *PointId) ProtoReflect() protoreflect.Message
func (x *PointId) Reset()
func (x *PointId) String() string

But we see that isPointId_PointIdOptions is unexported

akfaew commented 1 year ago

It's similar with other types. I'm trying to learn how to delete a point:

$ grep -rw '^func.*Upsert'
points_service_grpc.pb.go:func (c *pointsClient) Upsert(ctx context.Context, in *UpsertPoints, opts ...grpc.CallOption) (*PointsOperationResponse, error) {
points_service_grpc.pb.go:func (UnimplementedPointsServer) Upsert(context.Context, *UpsertPoints) (*PointsOperationResponse, error) {

$ go doc Upsert
package go_client // import "."

func (UnimplementedPointsServer) Upsert(context.Context, *UpsertPoints) (*PointsOperationResponse, error)

$ go doc UnimplementedPointsServer
package go_client // import "."

type UnimplementedPointsServer struct {
}
    UnimplementedPointsServer must be embedded to have forward compatible
    implementations.

func (UnimplementedPointsServer) ClearPayload(context.Context, *ClearPayloadPoints) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) Count(context.Context, *CountPoints) (*CountResponse, error)
func (UnimplementedPointsServer) CreateFieldIndex(context.Context, *CreateFieldIndexCollection) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) Delete(context.Context, *DeletePoints) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) DeleteFieldIndex(context.Context, *DeleteFieldIndexCollection) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) DeletePayload(context.Context, *DeletePayloadPoints) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) DeleteVectors(context.Context, *DeletePointVectors) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) Get(context.Context, *GetPoints) (*GetResponse, error)
func (UnimplementedPointsServer) OverwritePayload(context.Context, *SetPayloadPoints) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) Recommend(context.Context, *RecommendPoints) (*RecommendResponse, error)
func (UnimplementedPointsServer) RecommendBatch(context.Context, *RecommendBatchPoints) (*RecommendBatchResponse, error)
func (UnimplementedPointsServer) RecommendGroups(context.Context, *RecommendPointGroups) (*RecommendGroupsResponse, error)
func (UnimplementedPointsServer) Scroll(context.Context, *ScrollPoints) (*ScrollResponse, error)
func (UnimplementedPointsServer) Search(context.Context, *SearchPoints) (*SearchResponse, error)
func (UnimplementedPointsServer) SearchBatch(context.Context, *SearchBatchPoints) (*SearchBatchResponse, error)
func (UnimplementedPointsServer) SearchGroups(context.Context, *SearchPointGroups) (*SearchGroupsResponse, error)
func (UnimplementedPointsServer) SetPayload(context.Context, *SetPayloadPoints) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) UpdateVectors(context.Context, *UpdatePointVectors) (*PointsOperationResponse, error)
func (UnimplementedPointsServer) Upsert(context.Context, *UpsertPoints) (*PointsOperationResponse, error)

$ go doc DeletePoints
package go_client // import "."

type DeletePoints struct {
        CollectionName string          `protobuf:"bytes,1,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"` // name of the collection
        Wait           *bool           `protobuf:"varint,2,opt,name=wait,proto3,oneof" json:"wait,omitempty"`                                    // Wait until the changes have been applied?
        Points         *PointsSelector `protobuf:"bytes,3,opt,name=points,proto3" json:"points,omitempty"`                                       // Affected points
        Ordering       *WriteOrdering  `protobuf:"bytes,4,opt,name=ordering,proto3,oneof" json:"ordering,omitempty"` // Write ordering guarantees
        // Has unexported fields.
}

func (*DeletePoints) Descriptor() ([]byte, []int)
func (x *DeletePoints) GetCollectionName() string
func (x *DeletePoints) GetOrdering() *WriteOrdering
func (x *DeletePoints) GetPoints() *PointsSelector
func (x *DeletePoints) GetWait() bool
func (*DeletePoints) ProtoMessage()
func (x *DeletePoints) ProtoReflect() protoreflect.Message
func (x *DeletePoints) Reset()
func (x *DeletePoints) String() string

$ go doc PointsSelector
package go_client // import "."

type PointsSelector struct {

        // Types that are assignable to PointsSelectorOneOf:
        //      *PointsSelector_Points
        //      *PointsSelector_Filter
        PointsSelectorOneOf isPointsSelector_PointsSelectorOneOf `protobuf_oneof:"points_selector_one_of"`
        // Has unexported fields.
}

func (*PointsSelector) Descriptor() ([]byte, []int)
func (x *PointsSelector) GetFilter() *Filter
func (x *PointsSelector) GetPoints() *PointsIdsList
func (m *PointsSelector) GetPointsSelectorOneOf() isPointsSelector_PointsSelectorOneOf
func (*PointsSelector) ProtoMessage()
func (x *PointsSelector) ProtoReflect() protoreflect.Message
func (x *PointsSelector) Reset()
func (x *PointsSelector) String() string

And as you can see I'm running into a dead end

generall commented 1 year ago

Hi @akfaew, I have extended the example with usage of UUID: https://github.com/qdrant/go-client/commit/b6372926e08f40dadad40555a1bbb31947b83d37

I hope it helps