entity

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 58

Documentation

Overview

Package entity defines entities used in sdk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KvPairsMap

func KvPairsMap(kvps []*common.KeyValuePair) map[string]string

KvPairsMap converts common.KeyValuePair slices into map

func MapKvPairs

func MapKvPairs(m map[string]string) []*common.KeyValuePair

MapKvPairs converts map into common.KeyValuePair slice

Types

type BinaryVector

type BinaryVector []byte

BinaryVector []byte vector wrapper

func (BinaryVector) Dim

func (bv BinaryVector) Dim() int

Dim return vector dimension, note that binary vector is bits count

func (BinaryVector) Serialize

func (bv BinaryVector) Serialize() []byte

Serialize just return bytes

type Collection

type Collection struct {
	ID               int64   // collection id
	Name             string  // collection name
	Schema           *Schema // collection schema, with fields schema and primary key definition
	PhysicalChannels []string
	VirtualChannels  []string
}

Collection represent collection meta in Milvus

type Column

type Column interface {
	Name() string
	Type() FieldType
	Len() int
	FieldData() *schema.FieldData
}

Column interface field type for column-based data frame

func FieldDataColumn

func FieldDataColumn(fd *schema.FieldData, begin, end int) (Column, error)

FieldDataColumn converts schema.FieldData to Column, used int search result conversion logic begin, end specifies the start and end positions

func IDColumns

func IDColumns(idField *schema.IDs, begin, end int) (Column, error)

IDColumns converts schema.IDs to corresponding column currently Int64 / string may be in IDs

type ColumnBinaryVector

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

ColumnBinaryVector generated columns type for BinaryVector

func NewColumnBinaryVector

func NewColumnBinaryVector(name string, dim int, values [][]byte) *ColumnBinaryVector

NewColumnBinaryVector auto generated constructor

func (*ColumnBinaryVector) Data

func (c *ColumnBinaryVector) Data() [][]byte

Data returns column data

func (*ColumnBinaryVector) Dim

func (c *ColumnBinaryVector) Dim() int

Dim returns vector dimension

func (*ColumnBinaryVector) FieldData

func (c *ColumnBinaryVector) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnBinaryVector) Len

func (c *ColumnBinaryVector) Len() int

Len returns column data length

func (*ColumnBinaryVector) Name

func (c *ColumnBinaryVector) Name() string

Name returns column name

func (*ColumnBinaryVector) Type

func (c *ColumnBinaryVector) Type() FieldType

Type returns column FieldType

type ColumnBool

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

ColumnBool generated columns type for Bool

func NewColumnBool

func NewColumnBool(name string, values []bool) *ColumnBool

NewColumnBool auto generated constructor

func (*ColumnBool) Data

func (c *ColumnBool) Data() []bool

Data returns column data

func (*ColumnBool) FieldData

func (c *ColumnBool) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnBool) Len

func (c *ColumnBool) Len() int

Len returns column values length

func (*ColumnBool) Name

func (c *ColumnBool) Name() string

Name returns column name

func (*ColumnBool) Type

func (c *ColumnBool) Type() FieldType

Type returns column FieldType

func (*ColumnBool) ValueByIdx

func (c *ColumnBool) ValueByIdx(idx int) (bool, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnDouble

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

ColumnDouble generated columns type for Double

func NewColumnDouble

func NewColumnDouble(name string, values []float64) *ColumnDouble

NewColumnDouble auto generated constructor

func (*ColumnDouble) Data

func (c *ColumnDouble) Data() []float64

Data returns column data

func (*ColumnDouble) FieldData

func (c *ColumnDouble) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnDouble) Len

func (c *ColumnDouble) Len() int

Len returns column values length

func (*ColumnDouble) Name

func (c *ColumnDouble) Name() string

Name returns column name

func (*ColumnDouble) Type

func (c *ColumnDouble) Type() FieldType

Type returns column FieldType

func (*ColumnDouble) ValueByIdx

func (c *ColumnDouble) ValueByIdx(idx int) (float64, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnFloat

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

ColumnFloat generated columns type for Float

func NewColumnFloat

func NewColumnFloat(name string, values []float32) *ColumnFloat

NewColumnFloat auto generated constructor

func (*ColumnFloat) Data

func (c *ColumnFloat) Data() []float32

Data returns column data

func (*ColumnFloat) FieldData

func (c *ColumnFloat) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnFloat) Len

func (c *ColumnFloat) Len() int

Len returns column values length

func (*ColumnFloat) Name

func (c *ColumnFloat) Name() string

Name returns column name

func (*ColumnFloat) Type

func (c *ColumnFloat) Type() FieldType

Type returns column FieldType

func (*ColumnFloat) ValueByIdx

func (c *ColumnFloat) ValueByIdx(idx int) (float32, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnFloatVector

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

ColumnFloatVector generated columns type for FloatVector

func NewColumnFloatVector

func NewColumnFloatVector(name string, dim int, values [][]float32) *ColumnFloatVector

NewColumnFloatVector auto generated constructor

func (*ColumnFloatVector) Data

func (c *ColumnFloatVector) Data() [][]float32

Data returns column data

func (*ColumnFloatVector) Dim

func (c *ColumnFloatVector) Dim() int

Dim returns vector dimension

func (*ColumnFloatVector) FieldData

func (c *ColumnFloatVector) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnFloatVector) Len

func (c *ColumnFloatVector) Len() int

Len returns column data length

func (*ColumnFloatVector) Name

func (c *ColumnFloatVector) Name() string

Name returns column name

func (*ColumnFloatVector) Type

func (c *ColumnFloatVector) Type() FieldType

Type returns column FieldType

type ColumnInt16

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

ColumnInt16 generated columns type for Int16

func NewColumnInt16

func NewColumnInt16(name string, values []int16) *ColumnInt16

NewColumnInt16 auto generated constructor

func (*ColumnInt16) Data

func (c *ColumnInt16) Data() []int16

Data returns column data

func (*ColumnInt16) FieldData

func (c *ColumnInt16) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnInt16) Len

func (c *ColumnInt16) Len() int

Len returns column values length

func (*ColumnInt16) Name

func (c *ColumnInt16) Name() string

Name returns column name

func (*ColumnInt16) Type

func (c *ColumnInt16) Type() FieldType

Type returns column FieldType

func (*ColumnInt16) ValueByIdx

func (c *ColumnInt16) ValueByIdx(idx int) (int16, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnInt32

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

ColumnInt32 generated columns type for Int32

func NewColumnInt32

func NewColumnInt32(name string, values []int32) *ColumnInt32

NewColumnInt32 auto generated constructor

func (*ColumnInt32) Data

func (c *ColumnInt32) Data() []int32

Data returns column data

func (*ColumnInt32) FieldData

func (c *ColumnInt32) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnInt32) Len

func (c *ColumnInt32) Len() int

Len returns column values length

func (*ColumnInt32) Name

func (c *ColumnInt32) Name() string

Name returns column name

func (*ColumnInt32) Type

func (c *ColumnInt32) Type() FieldType

Type returns column FieldType

func (*ColumnInt32) ValueByIdx

func (c *ColumnInt32) ValueByIdx(idx int) (int32, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnInt64

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

ColumnInt64 generated columns type for Int64

func NewColumnInt64

func NewColumnInt64(name string, values []int64) *ColumnInt64

NewColumnInt64 auto generated constructor

func (*ColumnInt64) Data

func (c *ColumnInt64) Data() []int64

Data returns column data

func (*ColumnInt64) FieldData

func (c *ColumnInt64) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnInt64) Len

func (c *ColumnInt64) Len() int

Len returns column values length

func (*ColumnInt64) Name

func (c *ColumnInt64) Name() string

Name returns column name

func (*ColumnInt64) Type

func (c *ColumnInt64) Type() FieldType

Type returns column FieldType

func (*ColumnInt64) ValueByIdx

func (c *ColumnInt64) ValueByIdx(idx int) (int64, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnInt8

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

ColumnInt8 generated columns type for Int8

func NewColumnInt8

func NewColumnInt8(name string, values []int8) *ColumnInt8

NewColumnInt8 auto generated constructor

func (*ColumnInt8) Data

func (c *ColumnInt8) Data() []int8

Data returns column data

func (*ColumnInt8) FieldData

func (c *ColumnInt8) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnInt8) Len

func (c *ColumnInt8) Len() int

Len returns column values length

func (*ColumnInt8) Name

func (c *ColumnInt8) Name() string

Name returns column name

func (*ColumnInt8) Type

func (c *ColumnInt8) Type() FieldType

Type returns column FieldType

func (*ColumnInt8) ValueByIdx

func (c *ColumnInt8) ValueByIdx(idx int) (int8, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type ColumnString

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

ColumnString generated columns type for String

func NewColumnString

func NewColumnString(name string, values []string) *ColumnString

NewColumnString auto generated constructor

func (*ColumnString) Data

func (c *ColumnString) Data() []string

Data returns column data

func (*ColumnString) FieldData

func (c *ColumnString) FieldData() *schema.FieldData

FieldData return column data mapped to schema.FieldData

func (*ColumnString) Len

func (c *ColumnString) Len() int

Len returns column values length

func (*ColumnString) Name

func (c *ColumnString) Name() string

Name returns column name

func (*ColumnString) Type

func (c *ColumnString) Type() FieldType

Type returns column FieldType

func (*ColumnString) ValueByIdx

func (c *ColumnString) ValueByIdx(idx int) (string, error)

ValueByIdx returns value of the provided index error occurs when index out of range

type Field

type Field struct {
	ID          int64  // field id, generated when collection is created, input value is ignored
	Name        string // field name
	PrimaryKey  bool   // is primary key
	AutoID      bool   // is auto id
	Description string
	DataType    FieldType
	TypeParams  map[string]string
}

Field represent field schema in milvus

func (*Field) ProtoMessage

func (f *Field) ProtoMessage() *schema.FieldSchema

ProtoMessage generetes corresponding FieldSchema

func (*Field) ReadProto

func (f *Field) ReadProto(p *schema.FieldSchema) *Field

ReadProto parses FieldSchema

type FieldType

type FieldType int32

FieldType field data type alias type used in go:generate trick, DO NOT modify names & string

const (
	//FieldTypeNone zero value place holder
	FieldTypeNone FieldType = 0 // zero value place holder
	//FieldTypeBool field type boolean
	FieldTypeBool FieldType = 1
	//FieldTypeInt8 field type int8
	FieldTypeInt8 FieldType = 2
	//FieldTypeInt16 field type int16
	FieldTypeInt16 FieldType = 3
	//FieldTypeInt32 field type int32
	FieldTypeInt32 FieldType = 4
	//FIeldTypeInt64 field type int64
	FieldTypeInt64 FieldType = 5
	//FieldTypeFloat field type float
	FieldTypeFloat FieldType = 10
	//FieldTypeDouble field type double
	FieldTypeDouble FieldType = 11
	//FieldTypeString field type string
	FieldTypeString FieldType = 20
	//FieldTypeBinaryVector field type binary vector
	FieldTypeBinaryVector FieldType = 100
	//FieldTypeFloatVector field type float vector
	FieldTypeFloatVector FieldType = 101
)

Match schema definition

func (FieldType) Name

func (t FieldType) Name() string

Name returns field type name

func (FieldType) PbFieldType

func (t FieldType) PbFieldType() (string, string)

PbFieldType represents FieldType corresponding schema pb type

func (FieldType) String

func (t FieldType) String() string

String returns field type

type FloatVector

type FloatVector []float32

FloatVector float32 vector wrapper

func (FloatVector) Dim

func (fv FloatVector) Dim() int

Dim returns vector dimension

func (FloatVector) Serialize

func (fv FloatVector) Serialize() []byte

Serialize serialize vector into byte slice, used in search placeholder LittleEndian is used for convention

type GenericIndex

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

GenericIndex index struct for general usage no constraint for index is applied

func (GenericIndex) IndexType

func (b GenericIndex) IndexType() IndexType

IndexType implements Index

func (GenericIndex) Name

func (b GenericIndex) Name() string

Name implements Index

func (GenericIndex) Params

func (gi GenericIndex) Params() map[string]string

Params implements Index

type Index

type Index interface {
	Name() string
	IndexType() IndexType
	Params() map[string]string
}

Index represent index in milvus

func NewFlatIndex

func NewFlatIndex(name string, m MetricType) Index

func NewGenericIndex

func NewGenericIndex(name string, it IndexType, params map[string]string) Index

NewGenericIndex create generic index instance

type IndexANNOY

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

IndexANNOY idx type for ANNOY

func NewIndexANNOY

func NewIndexANNOY(metricType MetricType,
	n_trees int,
) (*IndexANNOY, error)

NewIndexANNOY create index with contruction parameters

func (*IndexANNOY) IndexType

func (i *IndexANNOY) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexANNOY) Name

func (i *IndexANNOY) Name() string

Name returns index type name, implementing Index interface

func (*IndexANNOY) Params

func (i *IndexANNOY) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexANNOY) SupportBinary

func (i *IndexANNOY) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexANNOYSearchParam

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

IndexANNOYSearchParam search param struct for index type ANNOY

func NewIndexANNOYSearchParam

func NewIndexANNOYSearchParam(
	search_k int,
) (*IndexANNOYSearchParam, error)

NewIndexANNOYSearchParam create index search param

func (*IndexANNOYSearchParam) Params

func (i *IndexANNOYSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexBinFlat

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

IndexBinFlat idx type for BIN_FLAT

func NewIndexBinFlat

func NewIndexBinFlat(metricType MetricType,
	nlist int,
) (*IndexBinFlat, error)

NewIndexBinFlat create index with contruction parameters

func (*IndexBinFlat) IndexType

func (i *IndexBinFlat) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexBinFlat) Name

func (i *IndexBinFlat) Name() string

Name returns index type name, implementing Index interface

func (*IndexBinFlat) Params

func (i *IndexBinFlat) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexBinFlat) SupportBinary

func (i *IndexBinFlat) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexBinFlatSearchParam

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

IndexBinFlatSearchParam search param struct for index type BIN_FLAT

func NewIndexBinFlatSearchParam

func NewIndexBinFlatSearchParam(
	nprobe int,
) (*IndexBinFlatSearchParam, error)

NewIndexBinFlatSearchParam create index search param

func (*IndexBinFlatSearchParam) Params

func (i *IndexBinFlatSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexBinIvfFlat

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

IndexBinIvfFlat idx type for BIN_IVF_FLAT

func NewIndexBinIvfFlat

func NewIndexBinIvfFlat(metricType MetricType,
	nlist int,
) (*IndexBinIvfFlat, error)

NewIndexBinIvfFlat create index with contruction parameters

func (*IndexBinIvfFlat) IndexType

func (i *IndexBinIvfFlat) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexBinIvfFlat) Name

func (i *IndexBinIvfFlat) Name() string

Name returns index type name, implementing Index interface

func (*IndexBinIvfFlat) Params

func (i *IndexBinIvfFlat) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexBinIvfFlat) SupportBinary

func (i *IndexBinIvfFlat) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexBinIvfFlatSearchParam

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

IndexBinIvfFlatSearchParam search param struct for index type BIN_IVF_FLAT

func NewIndexBinIvfFlatSearchParam

func NewIndexBinIvfFlatSearchParam(
	nprobe int,
) (*IndexBinIvfFlatSearchParam, error)

NewIndexBinIvfFlatSearchParam create index search param

func (*IndexBinIvfFlatSearchParam) Params

func (i *IndexBinIvfFlatSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexFlat

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

IndexFlat idx type for FLAT

func NewIndexFlat

func NewIndexFlat(metricType MetricType,
	nlist int,
) (*IndexFlat, error)

NewIndexFlat create index with contruction parameters

func (*IndexFlat) IndexType

func (i *IndexFlat) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexFlat) Name

func (i *IndexFlat) Name() string

Name returns index type name, implementing Index interface

func (*IndexFlat) Params

func (i *IndexFlat) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexFlat) SupportBinary

func (i *IndexFlat) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexFlatSearchParam

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

IndexFlatSearchParam search param struct for index type FLAT

func NewIndexFlatSearchParam

func NewIndexFlatSearchParam(
	nprobe int,
) (*IndexFlatSearchParam, error)

NewIndexFlatSearchParam create index search param

func (*IndexFlatSearchParam) Params

func (i *IndexFlatSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexHNSW

type IndexHNSW struct {
	M int
	// contains filtered or unexported fields
}

IndexHNSW idx type for HNSW

func NewIndexHNSW

func NewIndexHNSW(metricType MetricType,
	M int,

	efConstruction int,
) (*IndexHNSW, error)

NewIndexHNSW create index with contruction parameters

func (*IndexHNSW) IndexType

func (i *IndexHNSW) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexHNSW) Name

func (i *IndexHNSW) Name() string

Name returns index type name, implementing Index interface

func (*IndexHNSW) Params

func (i *IndexHNSW) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexHNSW) SupportBinary

func (i *IndexHNSW) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexHNSWSearchParam

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

IndexHNSWSearchParam search param struct for index type HNSW

func NewIndexHNSWSearchParam

func NewIndexHNSWSearchParam(
	ef int,
) (*IndexHNSWSearchParam, error)

NewIndexHNSWSearchParam create index search param

func (*IndexHNSWSearchParam) Params

func (i *IndexHNSWSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexIvfFlat

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

IndexIvfFlat idx type for IVF_FLAT

func NewIndexIvfFlat

func NewIndexIvfFlat(metricType MetricType,
	nlist int,
) (*IndexIvfFlat, error)

NewIndexIvfFlat create index with contruction parameters

func (*IndexIvfFlat) IndexType

func (i *IndexIvfFlat) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexIvfFlat) Name

func (i *IndexIvfFlat) Name() string

Name returns index type name, implementing Index interface

func (*IndexIvfFlat) Params

func (i *IndexIvfFlat) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexIvfFlat) SupportBinary

func (i *IndexIvfFlat) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexIvfFlatSearchParam

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

IndexIvfFlatSearchParam search param struct for index type IVF_FLAT

func NewIndexIvfFlatSearchParam

func NewIndexIvfFlatSearchParam(
	nprobe int,
) (*IndexIvfFlatSearchParam, error)

NewIndexIvfFlatSearchParam create index search param

func (*IndexIvfFlatSearchParam) Params

func (i *IndexIvfFlatSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexIvfHNSW

type IndexIvfHNSW struct {
	M int
	// contains filtered or unexported fields
}

IndexIvfHNSW idx type for IVF_HNSW

func NewIndexIvfHNSW

func NewIndexIvfHNSW(metricType MetricType,
	nlist int,

	M int,

	efConstruction int,
) (*IndexIvfHNSW, error)

NewIndexIvfHNSW create index with contruction parameters

func (*IndexIvfHNSW) IndexType

func (i *IndexIvfHNSW) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexIvfHNSW) Name

func (i *IndexIvfHNSW) Name() string

Name returns index type name, implementing Index interface

func (*IndexIvfHNSW) Params

func (i *IndexIvfHNSW) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexIvfHNSW) SupportBinary

func (i *IndexIvfHNSW) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexIvfHNSWSearchParam

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

IndexIvfHNSWSearchParam search param struct for index type IVF_HNSW

func NewIndexIvfHNSWSearchParam

func NewIndexIvfHNSWSearchParam(
	nprobe int,

	ef int,
) (*IndexIvfHNSWSearchParam, error)

NewIndexIvfHNSWSearchParam create index search param

func (*IndexIvfHNSWSearchParam) Params

func (i *IndexIvfHNSWSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexIvfPQ

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

IndexIvfPQ idx type for IVF_PQ

func NewIndexIvfPQ

func NewIndexIvfPQ(metricType MetricType,
	nlist int,

	m int,

	nbits int,
) (*IndexIvfPQ, error)

NewIndexIvfPQ create index with contruction parameters

func (*IndexIvfPQ) IndexType

func (i *IndexIvfPQ) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexIvfPQ) Name

func (i *IndexIvfPQ) Name() string

Name returns index type name, implementing Index interface

func (*IndexIvfPQ) Params

func (i *IndexIvfPQ) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexIvfPQ) SupportBinary

func (i *IndexIvfPQ) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexIvfPQSearchParam

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

IndexIvfPQSearchParam search param struct for index type IVF_PQ

func NewIndexIvfPQSearchParam

func NewIndexIvfPQSearchParam(
	nprobe int,
) (*IndexIvfPQSearchParam, error)

NewIndexIvfPQSearchParam create index search param

func (*IndexIvfPQSearchParam) Params

func (i *IndexIvfPQSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexIvfSQ8

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

IndexIvfSQ8 idx type for IVF_SQ8

func NewIndexIvfSQ8

func NewIndexIvfSQ8(metricType MetricType,
	nlist int,
) (*IndexIvfSQ8, error)

NewIndexIvfSQ8 create index with contruction parameters

func (*IndexIvfSQ8) IndexType

func (i *IndexIvfSQ8) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexIvfSQ8) Name

func (i *IndexIvfSQ8) Name() string

Name returns index type name, implementing Index interface

func (*IndexIvfSQ8) Params

func (i *IndexIvfSQ8) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexIvfSQ8) SupportBinary

func (i *IndexIvfSQ8) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexIvfSQ8H

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

IndexIvfSQ8H idx type for IVF_SQ8_HYBRID

func NewIndexIvfSQ8H

func NewIndexIvfSQ8H(metricType MetricType,
	nlist int,
) (*IndexIvfSQ8H, error)

NewIndexIvfSQ8H create index with contruction parameters

func (*IndexIvfSQ8H) IndexType

func (i *IndexIvfSQ8H) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexIvfSQ8H) Name

func (i *IndexIvfSQ8H) Name() string

Name returns index type name, implementing Index interface

func (*IndexIvfSQ8H) Params

func (i *IndexIvfSQ8H) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexIvfSQ8H) SupportBinary

func (i *IndexIvfSQ8H) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexIvfSQ8HSearchParam

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

IndexIvfSQ8HSearchParam search param struct for index type IVF_SQ8_HYBRID

func NewIndexIvfSQ8HSearchParam

func NewIndexIvfSQ8HSearchParam(
	nprobe int,
) (*IndexIvfSQ8HSearchParam, error)

NewIndexIvfSQ8HSearchParam create index search param

func (*IndexIvfSQ8HSearchParam) Params

func (i *IndexIvfSQ8HSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexIvfSQ8SearchParam

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

IndexIvfSQ8SearchParam search param struct for index type IVF_SQ8

func NewIndexIvfSQ8SearchParam

func NewIndexIvfSQ8SearchParam(
	nprobe int,
) (*IndexIvfSQ8SearchParam, error)

NewIndexIvfSQ8SearchParam create index search param

func (*IndexIvfSQ8SearchParam) Params

func (i *IndexIvfSQ8SearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexNGTONNG

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

IndexNGTONNG idx type for NGT_ONNG

func NewIndexNGTONNG

func NewIndexNGTONNG(metricType MetricType,
	edge_size int,

	outgoing_edge_size int,

	incoming_edge_size int,
) (*IndexNGTONNG, error)

NewIndexNGTONNG create index with contruction parameters

func (*IndexNGTONNG) IndexType

func (i *IndexNGTONNG) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexNGTONNG) Name

func (i *IndexNGTONNG) Name() string

Name returns index type name, implementing Index interface

func (*IndexNGTONNG) Params

func (i *IndexNGTONNG) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexNGTONNG) SupportBinary

func (i *IndexNGTONNG) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexNGTONNGSearchParam

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

IndexNGTONNGSearchParam search param struct for index type NGT_ONNG

func NewIndexNGTONNGSearchParam

func NewIndexNGTONNGSearchParam(
	max_search_edges int,

	epsilon float64,
) (*IndexNGTONNGSearchParam, error)

NewIndexNGTONNGSearchParam create index search param

func (*IndexNGTONNGSearchParam) Params

func (i *IndexNGTONNGSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexNGTPANNG

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

IndexNGTPANNG idx type for NGT_PANNG

func NewIndexNGTPANNG

func NewIndexNGTPANNG(metricType MetricType,
	edge_size int,

	forcedly_pruned_edge_size int,

	selectively_pruned_edge_size int,
) (*IndexNGTPANNG, error)

NewIndexNGTPANNG create index with contruction parameters

func (*IndexNGTPANNG) IndexType

func (i *IndexNGTPANNG) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexNGTPANNG) Name

func (i *IndexNGTPANNG) Name() string

Name returns index type name, implementing Index interface

func (*IndexNGTPANNG) Params

func (i *IndexNGTPANNG) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexNGTPANNG) SupportBinary

func (i *IndexNGTPANNG) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexNGTPANNGSearchParam

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

IndexNGTPANNGSearchParam search param struct for index type NGT_PANNG

func NewIndexNGTPANNGSearchParam

func NewIndexNGTPANNGSearchParam(
	max_search_edges int,

	epsilon float64,
) (*IndexNGTPANNGSearchParam, error)

NewIndexNGTPANNGSearchParam create index search param

func (*IndexNGTPANNGSearchParam) Params

func (i *IndexNGTPANNGSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexRHNSWFlat

type IndexRHNSWFlat struct {
	M int
	// contains filtered or unexported fields
}

IndexRHNSWFlat idx type for RHNSW_FLAT

func NewIndexRHNSWFlat

func NewIndexRHNSWFlat(metricType MetricType,
	M int,

	efConstruction int,
) (*IndexRHNSWFlat, error)

NewIndexRHNSWFlat create index with contruction parameters

func (*IndexRHNSWFlat) IndexType

func (i *IndexRHNSWFlat) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexRHNSWFlat) Name

func (i *IndexRHNSWFlat) Name() string

Name returns index type name, implementing Index interface

func (*IndexRHNSWFlat) Params

func (i *IndexRHNSWFlat) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexRHNSWFlat) SupportBinary

func (i *IndexRHNSWFlat) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexRHNSWFlatSearchParam

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

IndexRHNSWFlatSearchParam search param struct for index type RHNSW_FLAT

func NewIndexRHNSWFlatSearchParam

func NewIndexRHNSWFlatSearchParam(
	ef int,
) (*IndexRHNSWFlatSearchParam, error)

NewIndexRHNSWFlatSearchParam create index search param

func (*IndexRHNSWFlatSearchParam) Params

func (i *IndexRHNSWFlatSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexRHNSW_PQ

type IndexRHNSW_PQ struct {
	M int

	PQM int
	// contains filtered or unexported fields
}

IndexRHNSW_PQ idx type for RHNSW_PQ

func NewIndexRHNSW_PQ

func NewIndexRHNSW_PQ(metricType MetricType,
	M int,

	efConstruction int,

	PQM int,
) (*IndexRHNSW_PQ, error)

NewIndexRHNSW_PQ create index with contruction parameters

func (*IndexRHNSW_PQ) IndexType

func (i *IndexRHNSW_PQ) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexRHNSW_PQ) Name

func (i *IndexRHNSW_PQ) Name() string

Name returns index type name, implementing Index interface

func (*IndexRHNSW_PQ) Params

func (i *IndexRHNSW_PQ) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexRHNSW_PQ) SupportBinary

func (i *IndexRHNSW_PQ) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexRHNSW_PQSearchParam

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

IndexRHNSW_PQSearchParam search param struct for index type RHNSW_PQ

func NewIndexRHNSW_PQSearchParam

func NewIndexRHNSW_PQSearchParam(
	ef int,
) (*IndexRHNSW_PQSearchParam, error)

NewIndexRHNSW_PQSearchParam create index search param

func (*IndexRHNSW_PQSearchParam) Params

func (i *IndexRHNSW_PQSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexRHNSW_SQ

type IndexRHNSW_SQ struct {
	M int
	// contains filtered or unexported fields
}

IndexRHNSW_SQ idx type for RHNSW_SQ

func NewIndexRHNSW_SQ

func NewIndexRHNSW_SQ(metricType MetricType,
	M int,

	efConstruction int,
) (*IndexRHNSW_SQ, error)

NewIndexRHNSW_SQ create index with contruction parameters

func (*IndexRHNSW_SQ) IndexType

func (i *IndexRHNSW_SQ) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexRHNSW_SQ) Name

func (i *IndexRHNSW_SQ) Name() string

Name returns index type name, implementing Index interface

func (*IndexRHNSW_SQ) Params

func (i *IndexRHNSW_SQ) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexRHNSW_SQ) SupportBinary

func (i *IndexRHNSW_SQ) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexRHNSW_SQSearchParam

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

IndexRHNSW_SQSearchParam search param struct for index type RHNSW_SQ

func NewIndexRHNSW_SQSearchParam

func NewIndexRHNSW_SQSearchParam(
	ef int,
) (*IndexRHNSW_SQSearchParam, error)

NewIndexRHNSW_SQSearchParam create index search param

func (*IndexRHNSW_SQSearchParam) Params

func (i *IndexRHNSW_SQSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexRNSG

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

IndexRNSG idx type for NSG

func NewIndexRNSG

func NewIndexRNSG(metricType MetricType,
	out_degree int,

	candidate_pool_size int,

	search_length int,

	knng int,
) (*IndexRNSG, error)

NewIndexRNSG create index with contruction parameters

func (*IndexRNSG) IndexType

func (i *IndexRNSG) IndexType() IndexType

IndexType returns IndexType, implementing Index interface

func (*IndexRNSG) Name

func (i *IndexRNSG) Name() string

Name returns index type name, implementing Index interface

func (*IndexRNSG) Params

func (i *IndexRNSG) Params() map[string]string

Params returns index construction params, implementing Index interface

func (*IndexRNSG) SupportBinary

func (i *IndexRNSG) SupportBinary() bool

SupportBinary returns whether index type support binary vector

type IndexRNSGSearchParam

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

IndexRNSGSearchParam search param struct for index type NSG

func NewIndexRNSGSearchParam

func NewIndexRNSGSearchParam(
	search_length int,
) (*IndexRNSGSearchParam, error)

NewIndexRNSGSearchParam create index search param

func (*IndexRNSGSearchParam) Params

func (i *IndexRNSGSearchParam) Params() map[string]string

Params returns index construction params, implementing Index interface

type IndexState

type IndexState common.IndexState

IndexState export index state

type IndexType

type IndexType string

IndexType index type

const (
	Flat       IndexType = "FLAT" //faiss
	BinFlat    IndexType = "BIN_FLAT"
	IvfFlat    IndexType = "IVF_FLAT" //faiss
	BinIvfFlat IndexType = "BIN_IVF_FLAT"
	IvfPQ      IndexType = "IVF_PQ" //faiss
	IvfSQ8     IndexType = "IVF_SQ8"
	IvfSQ8H    IndexType = "IVF_SQ8_HYBRID"
	NSG        IndexType = "NSG"
	HNSW       IndexType = "HNSW"
	RHNSWFlat  IndexType = "RHNSW_FLAT"
	RHNSWPQ    IndexType = "RHNSW_PQ"
	RHNSWSQ    IndexType = "RHNSW_SQ"
	IvfHNSW    IndexType = "IVF_HNSW"
	ANNOY      IndexType = "ANNOY"
	NGTPANNG   IndexType = "NGT_PANNG"
	NGTONNG    IndexType = "NGT_ONNG"
)

Index Constants

type MetricType

type MetricType string

MetricType metric type

const (
	L2             MetricType = "L2"
	IP             MetricType = "IP"
	HAMMING        MetricType = "HAMMING"
	JACCARD        MetricType = "JACCARD"
	TANIMOTO       MetricType = "TANIMOTO"
	SUBSTRUCTURE   MetricType = "SUBSTRUCTURE"
	SUPERSTRUCTURE MetricType = "SUPERSTRUCTURE"
)

Metric Constants

type Partition

type Partition struct {
	ID   int64  // paritition id
	Name string // parition name
}

Partition represent partition meta in Milvus

type Schema

type Schema struct {
	CollectionName string
	Description    string
	AutoID         bool
	Fields         []*Field
}

Schema represents schema info of collection in milvus

func (*Schema) ProtoMessage

func (s *Schema) ProtoMessage() *schema.CollectionSchema

ProtoMessage returns corresponding server.CollectionSchema

func (*Schema) ReadProto

func (s *Schema) ReadProto(p *schema.CollectionSchema) *Schema

ReadProto parses proto Collection Schema

type SearchParam

type SearchParam interface {
	// returns parameters for search/query
	Params() map[string]string
}

SearchParam interface for index related search param

type Segment

type Segment struct {
	ID           int64
	CollectionID int64
	ParititionID int64
	IndexID      int64

	NumRows int64
	State   common.SegmentState
}

Segment represent segment in milvus

func (Segment) Flushed

func (s Segment) Flushed() bool

Flushed indicates segment is flushed

type Vector

type Vector interface {
	Dim() int
	Serialize() []byte
}

Vector interface vector used int search

Jump to

Keyboard shortcuts

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