document

package
v3.2.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Apache-2.0, MIT Imports: 42 Imported by: 1

Documentation

Index

Constants

View Source
const (
	URLParamDbName    = "db_name"
	URLParamSpaceName = "space_name"
	URLParamID        = "_id"
	URLParams         = "url_params"
	ReqsBody          = "req_body"
	SpaceEntity       = "space_entity"
	IDType            = "id_type"
	IDIsLong          = "IDIsLong"
	QueryIsOnlyID     = "QueryIsOnlyID"
	URLQueryTimeout   = "timeout"
)
View Source
const (
	// key index field
	IndexField      = "_index"
	UIDField        = "_uid"
	TypeField       = "_type"
	IDField         = "_id"
	SourceField     = "_source"
	SizeField       = "_size"
	AllField        = "_all"
	FieldNamesField = "_field_names"
	IgnoredField    = "_ignored"
	RoutingField    = "_routing"
	MetaField       = "_meta"
)
View Source
const (
	URLQueryFrom            = "from"
	URLQuerySize            = "size"
	UrlQueryRouting         = "routing"
	UrlQueryTypedKey        = "typed_keys"
	UrlQueryVersion         = "version"
	UrlQueryRetryOnConflict = "retry_on_conflict"
	UrlQueryOpType          = "op_type"
	UrlQueryRefresh         = "refresh"
	UrlQueryURISort         = "sort"
	UrlQueryTimeout         = "timeout"
	ClientTypeValue         = "client_type"
	DefaultSzie             = 50
	URLQueryRefresh         = "refresh"
)
View Source
const (
	DB = "db"

	NodeID = "node_id"
)

Variables

fields index map

Functions

func Auth

Auth valid whether username is root and password equal config

func Cost

func Cost(name string, t time.Time)

Cost record how long the function use

func DocToContent

func DocToContent(dh []*vearchpb.ResultItem, head *vearchpb.RequestHead, space *entity.Space) ([]byte, error)

func ExportDocumentHandler

func ExportDocumentHandler(httpServer *netutil.Server, client *client.Client)

func ExportRpcHandler

func ExportRpcHandler(rpcServer *grpc.Server, client *client.Client)

func FlushToContent

func FlushToContent(shards *vearchpb.SearchStatus) ([]byte, error)

func ForceMergeToContent

func ForceMergeToContent(shards *vearchpb.SearchStatus) ([]byte, error)

func GetVectorFieldValue

func GetVectorFieldValue(doc *vearchpb.Document, space *entity.Space) (floatFeatureMap map[string][]float32, binaryFeatureMap map[string][]int32, err error)

func MakeQueryFeature

func MakeQueryFeature(floatFeatureMap map[string][]float32, binaryFeatureMap map[string][]int32) ([]byte, error)

func MapDocument

func MapDocument(source []byte, retrievalType string, proMap map[string]*entity.SpaceProperties) ([]*vearchpb.Field, error)

parse doc

func NewMasterService

func NewMasterService(client *client.Client) (*masterService, error)

func SearchNullToContent

func SearchNullToContent(searchStatus vearchpb.SearchStatus, took time.Duration) ([]byte, error)

func ToContent

func ToContent(sr *vearchpb.SearchResult, head *vearchpb.RequestHead, took time.Duration, space *entity.Space) ([]byte, error)

func ToContentIds

func ToContentIds(srs []*vearchpb.SearchResult, space *entity.Space) ([]byte, error)

func ToContentMapBinaryFeature

func ToContentMapBinaryFeature(space *entity.Space, items []*vearchpb.Item) map[string][]int32

func ToContentMapFloatFeature

func ToContentMapFloatFeature(space *entity.Space, items []*vearchpb.Item) map[string][]float32

func ToContents

func ToContents(srs []*vearchpb.SearchResult, head *vearchpb.RequestHead, took time.Duration, space *entity.Space) ([]byte, error)

Types

type DocumentHandler

type DocumentHandler struct {
	// contains filtered or unexported fields
}

func (*DocumentHandler) ExportToServer

func (handler *DocumentHandler) ExportToServer() error

func (*DocumentHandler) GorillaExport

func (handler *DocumentHandler) GorillaExport(masterService *masterService) error

func (*DocumentHandler) GorillaExportMonitor

func (handler *DocumentHandler) GorillaExportMonitor(monitorService *monitorService) error

export monitor API by gorilla

type MasterClusterAPI

type MasterClusterAPI struct {
	Dh *vearchhttp.BaseHandler
	// contains filtered or unexported fields
}

func (*MasterClusterAPI) Auth

func (*MasterClusterAPI) ChangeMember

func (mApi *MasterClusterAPI) ChangeMember(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

func (*MasterClusterAPI) ChangeReplicas

func (mApi *MasterClusterAPI) ChangeReplicas(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

change replicas by dbname and spaceName

func (*MasterClusterAPI) FailServerClear

func (mApi *MasterClusterAPI) FailServerClear(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

FailServerClear : clear fail server by nodeID

func (*MasterClusterAPI) FailServerList

func (mApi *MasterClusterAPI) FailServerList(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

FailServerList : list fail servers

func (*MasterClusterAPI) RecoverFailServer

func (mApi *MasterClusterAPI) RecoverFailServer(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

recover the failserver by a newserver

func (*MasterClusterAPI) RemoveServerMeta

func (mApi *MasterClusterAPI) RemoveServerMeta(ctx context.Context, w http.ResponseWriter,
	r *http.Request, params netutil.UriParams) (context.Context, bool)

RemoveServerMeta : remove etcd meta about the nodeID

type MasterMonitorAPI

type MasterMonitorAPI struct {
	// contains filtered or unexported fields
}

export monitor

type Request

type Request interface {
	GetHead() *vearchpb.RequestHead
}

type RpcHandler

type RpcHandler struct {
	// contains filtered or unexported fields
}

func (*RpcHandler) Add

func (handler *RpcHandler) Add(ctx context.Context, req *vearchpb.AddRequest) (reply *vearchpb.AddResponse, err error)

func (*RpcHandler) Bulk

func (handler *RpcHandler) Bulk(ctx context.Context, req *vearchpb.BulkRequest) (reply *vearchpb.BulkResponse, err error)

func (*RpcHandler) Delete

func (handler *RpcHandler) Delete(ctx context.Context, req *vearchpb.DeleteRequest) (reply *vearchpb.DeleteResponse, err error)

func (*RpcHandler) Get

func (handler *RpcHandler) Get(ctx context.Context, req *vearchpb.GetRequest) (reply *vearchpb.GetResponse, err error)

func (*RpcHandler) MSearch

func (handler *RpcHandler) MSearch(ctx context.Context, req *vearchpb.MSearchRequest) (reply *vearchpb.SearchResponse, err error)

func (*RpcHandler) Search

func (handler *RpcHandler) Search(ctx context.Context, req *vearchpb.SearchRequest) (reply *vearchpb.SearchResponse, err error)

func (*RpcHandler) SearchByID

func (handler *RpcHandler) SearchByID(ctx context.Context, req *vearchpb.SearchRequest) (reply *vearchpb.SearchResponse, err error)

func (*RpcHandler) Space

func (handler *RpcHandler) Space(ctx context.Context, req *vearchpb.RequestHead) (reply *vearchpb.Table, err error)

func (*RpcHandler) Update

func (handler *RpcHandler) Update(ctx context.Context, req *vearchpb.UpdateRequest) (reply *vearchpb.UpdateResponse, err error)

type VectorQuery

type VectorQuery struct {
	Field         string          `json:"field"`
	FeatureData   json.RawMessage `json:"feature"`
	Feature       []float32       `json:"-"`
	FeatureUint8  []uint8         `json:"-"`
	Symbol        string          `json:"symbol"`
	Value         *float64        `json:"value"`
	Boost         *float64        `json:"boost"`
	Format        *string         `json:"format,omitempty"`
	MinScore      *float64        `json:"min_score,omitempty"`
	MaxScore      *float64        `json:"max_score,omitempty"`
	RetrievalType string          `json:"retrieval_type"`
}

func (*VectorQuery) ToC

func (query *VectorQuery) ToC(retrievalType string) (*vearchpb.VectorQuery, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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