indexparamcheck

package
v0.0.0-...-1593278 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// L2 represents Euclidean distance
	L2 = "L2"

	// IP represents inner product distance
	IP = "IP"

	// COSINE represents cosine distance
	COSINE = "COSINE"

	// HAMMING represents hamming distance
	HAMMING = "HAMMING"

	// JACCARD represents jaccard distance
	JACCARD = "JACCARD"

	// TANIMOTO represents tanimoto distance
	TANIMOTO = "TANIMOTO"

	// SUBSTRUCTURE represents substructure distance
	SUBSTRUCTURE = "SUBSTRUCTURE"

	// SUPERSTRUCTURE represents superstructure distance
	SUPERSTRUCTURE = "SUPERSTRUCTURE"

	MinNBits     = 1
	MaxNBits     = 16
	DefaultNBits = 8

	// MinNList is the lower limit of nlist that used in Index IVFxxx
	MinNList = 1
	// MaxNList is the upper limit of nlist that used in Index IVFxxx
	MaxNList = 65536

	// DefaultMinDim is the smallest dimension supported in Milvus
	DefaultMinDim = 1
	// DefaultMaxDim is the largest dimension supported in Milvus
	DefaultMaxDim = 32768

	// If Dim = 32 and raw vector data = 2G, query node need 24G disk space When loading the vectors' disk index
	// If Dim = 2, and raw vector data = 2G, query node need 240G disk space When loading the vectors' disk index
	// So DiskAnnMinDim should be greater than or equal to 32 to avoid running out of disk space
	DiskAnnMinDim = 32

	HNSWMinEfConstruction = 8
	HNSWMaxEfConstruction = 512
	HNSWMinM              = 4
	HNSWMaxM              = 64

	// DIM is a constant used to represent dimension
	DIM = common.DimKey
	// Metric is a constant used to metric type
	Metric = common.MetricTypeKey
	// NLIST is a constant used to nlist in Index IVFxxx
	NLIST = "nlist"
	NBITS = "nbits"
	IVFM  = "m"

	EFConstruction = "efConstruction"
	HNSWM          = "M"
)
View Source
const (
	FloatVectorDefaultMetricType  = IP
	BinaryVectorDefaultMetricType = JACCARD
)

Variables

View Source
var BinIDMapMetrics = []string{HAMMING, JACCARD, TANIMOTO, SUBSTRUCTURE, SUPERSTRUCTURE} // const

BinIDMapMetrics is a set of all metric types supported for binary vector.

View Source
var BinIvfMetrics = []string{HAMMING, JACCARD, TANIMOTO} // const
View Source
var METRICS = []string{L2, IP, COSINE} // const

METRICS is a set of all metrics types supported for float vector.

Functions

func CheckIndexValid

func CheckIndexValid(dType schemapb.DataType, indexType IndexType, indexParams map[string]string) error

TODO: check index parameters according to the index type & data type.

func CheckIntByRange

func CheckIntByRange(params map[string]string, key string, min, max int) bool

CheckIntByRange check if the data corresponding to the key is in the range of [min, max]. Return false if:

  1. the key does not exist, or
  2. the data cannot be converted to an integer, or
  3. the number is not in the range [min, max]

Return true otherwise

func CheckStrByValues

func CheckStrByValues(params map[string]string, key string, container []string) bool

CheckStrByValues check whether the data corresponding to the key appears in the string slice of container. Return false if:

  1. the key does not exist, or
  2. the data does not appear in the container

Return true otherwise

Types

type IndexChecker

type IndexChecker interface {
	CheckTrain(map[string]string) error
	CheckValidDataType(dType schemapb.DataType) error
	SetDefaultMetricTypeIfNotExist(map[string]string)
	StaticCheck(map[string]string) error
}

type IndexCheckerMgr

type IndexCheckerMgr interface {
	GetChecker(indexType string) (IndexChecker, error)
}

func GetIndexCheckerMgrInstance

func GetIndexCheckerMgrInstance() IndexCheckerMgr

GetIndexCheckerMgrInstance gets the instance of IndexCheckerMgr.

type IndexType

type IndexType = string

IndexType string.

const (
	IndexRaftIvfFlat     IndexType = "GPU_IVF_FLAT"
	IndexRaftIvfPQ       IndexType = "GPU_IVF_PQ"
	IndexFaissIDMap      IndexType = "FLAT" // no index is built.
	IndexFaissIvfFlat    IndexType = "IVF_FLAT"
	IndexFaissIvfPQ      IndexType = "IVF_PQ"
	IndexFaissIvfSQ8     IndexType = "IVF_SQ8"
	IndexFaissBinIDMap   IndexType = "BIN_FLAT"
	IndexFaissBinIvfFlat IndexType = "BIN_IVF_FLAT"
	IndexHNSW            IndexType = "HNSW"
	IndexDISKANN         IndexType = "DISKANN"
)

IndexType definitions

Jump to

Keyboard shortcuts

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