proto

package
v0.0.0-...-7b67181 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextIndexer_Index_FullMethodName       = "/proto.TextIndexer/Index"
	TextIndexer_Search_FullMethodName      = "/proto.TextIndexer/Search"
	TextIndexer_UpdateScore_FullMethodName = "/proto.TextIndexer/UpdateScore"
)

Variables

View Source
var (
	Query_Type_name = map[int32]string{
		0: "MATCH",
		1: "PHRASE",
	}
	Query_Type_value = map[string]int32{
		"MATCH":  0,
		"PHRASE": 1,
	}
)

Enum value maps for Query_Type.

View Source
var TextIndexer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.TextIndexer",
	HandlerType: (*TextIndexerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Index",
			Handler:    _TextIndexer_Index_Handler,
		},
		{
			MethodName: "UpdateScore",
			Handler:    _TextIndexer_UpdateScore_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Search",
			Handler:       _TextIndexer_Search_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "api.proto",
}

TextIndexer_ServiceDesc is the grpc.ServiceDesc for TextIndexer service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterTextIndexerServer

func RegisterTextIndexerServer(s grpc.ServiceRegistrar, srv TextIndexerServer)

Types

type Document

type Document struct {
	LinkId    []byte                 `protobuf:"bytes,1,opt,name=link_id,json=linkId,proto3" json:"link_id,omitempty"`
	Url       string                 `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	Title     string                 `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
	Content   string                 `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
	IndexedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=indexed_at,json=indexedAt,proto3" json:"indexed_at,omitempty"`
	// contains filtered or unexported fields
}

Document represents an indexed document.

func (*Document) Descriptor deprecated

func (*Document) Descriptor() ([]byte, []int)

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetContent

func (x *Document) GetContent() string

func (*Document) GetIndexedAt

func (x *Document) GetIndexedAt() *timestamppb.Timestamp

func (*Document) GetLinkId

func (x *Document) GetLinkId() []byte

func (*Document) GetTitle

func (x *Document) GetTitle() string

func (*Document) GetUrl

func (x *Document) GetUrl() string

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

type Query

type Query struct {
	Type       Query_Type `protobuf:"varint,1,opt,name=type,proto3,enum=proto.Query_Type" json:"type,omitempty"`
	Expression string     `protobuf:"bytes,2,opt,name=expression,proto3" json:"expression,omitempty"`
	// Allow for pagination.
	Offset uint64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

Query represents a search query.

func (*Query) Descriptor deprecated

func (*Query) Descriptor() ([]byte, []int)

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetExpression

func (x *Query) GetExpression() string

func (*Query) GetOffset

func (x *Query) GetOffset() uint64

func (*Query) GetType

func (x *Query) GetType() Query_Type

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

type QueryResult

type QueryResult struct {

	// The first QueryResult will contain the document count, and all subsequent responses will contain the actual documents.
	//
	// Types that are assignable to Result:
	//
	//	*QueryResult_DocCount
	//	*QueryResult_Doc
	Result isQueryResult_Result `protobuf_oneof:"result"`
	// contains filtered or unexported fields
}

QueryResult contains either the total count of results for a query or a single document from the resultset.

func (*QueryResult) Descriptor deprecated

func (*QueryResult) Descriptor() ([]byte, []int)

Deprecated: Use QueryResult.ProtoReflect.Descriptor instead.

func (*QueryResult) GetDoc

func (x *QueryResult) GetDoc() *Document

func (*QueryResult) GetDocCount

func (x *QueryResult) GetDocCount() uint64

func (*QueryResult) GetResult

func (m *QueryResult) GetResult() isQueryResult_Result

func (*QueryResult) ProtoMessage

func (*QueryResult) ProtoMessage()

func (*QueryResult) ProtoReflect

func (x *QueryResult) ProtoReflect() protoreflect.Message

func (*QueryResult) Reset

func (x *QueryResult) Reset()

func (*QueryResult) String

func (x *QueryResult) String() string

type QueryResult_Doc

type QueryResult_Doc struct {
	Doc *Document `protobuf:"bytes,2,opt,name=doc,proto3,oneof"`
}

type QueryResult_DocCount

type QueryResult_DocCount struct {
	DocCount uint64 `protobuf:"varint,1,opt,name=doc_count,json=docCount,proto3,oneof"`
}

type Query_Type

type Query_Type int32
const (
	// Match queries are the default.
	Query_MATCH  Query_Type = 0
	Query_PHRASE Query_Type = 1
)

func (Query_Type) Descriptor

func (Query_Type) Descriptor() protoreflect.EnumDescriptor

func (Query_Type) Enum

func (x Query_Type) Enum() *Query_Type

func (Query_Type) EnumDescriptor deprecated

func (Query_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Query_Type.Descriptor instead.

func (Query_Type) Number

func (x Query_Type) Number() protoreflect.EnumNumber

func (Query_Type) String

func (x Query_Type) String() string

func (Query_Type) Type

type TextIndexerClient

type TextIndexerClient interface {
	// Index inserts a new document to the index or updates the index entry for
	// and existing document.
	Index(ctx context.Context, in *Document, opts ...grpc.CallOption) (*Document, error)
	// Search the index for a particular query and stream the results back to
	// the client. The first response will include the total result count while
	// all subsequent responses will include documents from the resultset.
	Search(ctx context.Context, in *Query, opts ...grpc.CallOption) (TextIndexer_SearchClient, error)
	// UpdateScore updates the PageRank score for a document with the specified
	// link ID.
	UpdateScore(ctx context.Context, in *UpdateScoreRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

TextIndexerClient is the client API for TextIndexer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type TextIndexerServer

type TextIndexerServer interface {
	// Index inserts a new document to the index or updates the index entry for
	// and existing document.
	Index(context.Context, *Document) (*Document, error)
	// Search the index for a particular query and stream the results back to
	// the client. The first response will include the total result count while
	// all subsequent responses will include documents from the resultset.
	Search(*Query, TextIndexer_SearchServer) error
	// UpdateScore updates the PageRank score for a document with the specified
	// link ID.
	UpdateScore(context.Context, *UpdateScoreRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

TextIndexerServer is the server API for TextIndexer service. All implementations must embed UnimplementedTextIndexerServer for forward compatibility

type TextIndexer_SearchClient

type TextIndexer_SearchClient interface {
	Recv() (*QueryResult, error)
	grpc.ClientStream
}

type TextIndexer_SearchServer

type TextIndexer_SearchServer interface {
	Send(*QueryResult) error
	grpc.ServerStream
}

type UnimplementedTextIndexerServer

type UnimplementedTextIndexerServer struct {
}

UnimplementedTextIndexerServer must be embedded to have forward compatible implementations.

func (UnimplementedTextIndexerServer) Index

func (UnimplementedTextIndexerServer) Search

func (UnimplementedTextIndexerServer) UpdateScore

type UnsafeTextIndexerServer

type UnsafeTextIndexerServer interface {
	// contains filtered or unexported methods
}

UnsafeTextIndexerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TextIndexerServer will result in compilation errors.

type UpdateScoreRequest

type UpdateScoreRequest struct {
	LinkId        []byte  `protobuf:"bytes,1,opt,name=link_id,json=linkId,proto3" json:"link_id,omitempty"`
	PageRankScore float64 `protobuf:"fixed64,2,opt,name=page_rank_score,json=pageRankScore,proto3" json:"page_rank_score,omitempty"`
	// contains filtered or unexported fields
}

UpdateScoreRequest encapsulates the parameters for the UpdateScore RPC.

func (*UpdateScoreRequest) Descriptor deprecated

func (*UpdateScoreRequest) Descriptor() ([]byte, []int)

Deprecated: Use UpdateScoreRequest.ProtoReflect.Descriptor instead.

func (*UpdateScoreRequest) GetLinkId

func (x *UpdateScoreRequest) GetLinkId() []byte

func (*UpdateScoreRequest) GetPageRankScore

func (x *UpdateScoreRequest) GetPageRankScore() float64

func (*UpdateScoreRequest) ProtoMessage

func (*UpdateScoreRequest) ProtoMessage()

func (*UpdateScoreRequest) ProtoReflect

func (x *UpdateScoreRequest) ProtoReflect() protoreflect.Message

func (*UpdateScoreRequest) Reset

func (x *UpdateScoreRequest) Reset()

func (*UpdateScoreRequest) String

func (x *UpdateScoreRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL