Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterTextIndexerServer(s grpc.ServiceRegistrar, srv TextIndexerServer)
- type Document
- func (*Document) Descriptor() ([]byte, []int)deprecated
- func (x *Document) GetContent() string
- func (x *Document) GetIndexedAt() *timestamppb.Timestamp
- func (x *Document) GetLinkId() []byte
- func (x *Document) GetTitle() string
- func (x *Document) GetUrl() string
- func (*Document) ProtoMessage()
- func (x *Document) ProtoReflect() protoreflect.Message
- func (x *Document) Reset()
- func (x *Document) String() string
- type Query
- func (*Query) Descriptor() ([]byte, []int)deprecated
- func (x *Query) GetExpression() string
- func (x *Query) GetOffset() uint64
- func (x *Query) GetType() Query_Type
- func (*Query) ProtoMessage()
- func (x *Query) ProtoReflect() protoreflect.Message
- func (x *Query) Reset()
- func (x *Query) String() string
- type QueryResult
- func (*QueryResult) Descriptor() ([]byte, []int)deprecated
- func (x *QueryResult) GetDoc() *Document
- func (x *QueryResult) GetDocCount() uint64
- func (m *QueryResult) GetResult() isQueryResult_Result
- func (*QueryResult) ProtoMessage()
- func (x *QueryResult) ProtoReflect() protoreflect.Message
- func (x *QueryResult) Reset()
- func (x *QueryResult) String() string
- type QueryResult_Doc
- type QueryResult_DocCount
- type Query_Type
- type TextIndexerClient
- type TextIndexerServer
- type TextIndexer_SearchClient
- type TextIndexer_SearchServer
- type UnimplementedTextIndexerServer
- type UnsafeTextIndexerServer
- type UpdateScoreRequest
- func (*UpdateScoreRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateScoreRequest) GetLinkId() []byte
- func (x *UpdateScoreRequest) GetPageRankScore() float64
- func (*UpdateScoreRequest) ProtoMessage()
- func (x *UpdateScoreRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateScoreRequest) Reset()
- func (x *UpdateScoreRequest) String() string
Constants ¶
const ( TextIndexer_Index_FullMethodName = "/proto.TextIndexer/Index" TextIndexer_Search_FullMethodName = "/proto.TextIndexer/Search" TextIndexer_UpdateScore_FullMethodName = "/proto.TextIndexer/UpdateScore" )
Variables ¶
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.
var File_api_proto protoreflect.FileDescriptor
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) GetContent ¶
func (*Document) GetIndexedAt ¶
func (x *Document) GetIndexedAt() *timestamppb.Timestamp
func (*Document) ProtoMessage ¶
func (*Document) ProtoMessage()
func (*Document) ProtoReflect ¶
func (x *Document) ProtoReflect() protoreflect.Message
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) GetExpression ¶
func (*Query) GetType ¶
func (x *Query) GetType() Query_Type
func (*Query) ProtoMessage ¶
func (*Query) ProtoMessage()
func (*Query) ProtoReflect ¶
func (x *Query) ProtoReflect() protoreflect.Message
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 ¶
func (Query_Type) Type() protoreflect.EnumType
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.
func NewTextIndexerClient ¶
func NewTextIndexerClient(cc grpc.ClientConnInterface) TextIndexerClient
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) Search ¶
func (UnimplementedTextIndexerServer) Search(*Query, TextIndexer_SearchServer) error
func (UnimplementedTextIndexerServer) UpdateScore ¶
func (UnimplementedTextIndexerServer) UpdateScore(context.Context, *UpdateScoreRequest) (*emptypb.Empty, error)
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