indexparamcheck

package
v0.0.0-...-572c485 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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

	HNSWMinEfConstruction = 1
	HNSWMaxEfConstruction = 2147483647
	HNSWMinM              = 1
	HNSWMaxM              = 2048

	// 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"

	RaftCacheDatasetOnDevice = "cache_dataset_on_device"

	// Cagra Train Param
	CagraInterDegree = "intermediate_graph_degree"
	CagraGraphDegree = "graph_degree"
	CagraBuildAlgo   = "build_algo"

	CargaBuildAlgoIVFPQ     = "IVF_PQ"
	CargaBuildAlgoNNDESCENT = "NN_DESCENT"

	// Sparse Index Param
	SparseDropRatioBuild = "drop_ratio_build"

	MaxBitmapCardinalityLimit = 1000
)
View Source
const (
	FloatVectorDefaultMetricType       = metric.COSINE
	SparseFloatVectorDefaultMetricType = metric.IP
	BinaryVectorDefaultMetricType      = metric.HAMMING
)

Variables

View Source
var (
	FloatVectorMetrics  = []string{metric.L2, metric.IP, metric.COSINE}                                        // const
	BinaryVectorMetrics = []string{metric.HAMMING, metric.JACCARD, metric.SUBSTRUCTURE, metric.SUPERSTRUCTURE} // const
)
View Source
var (
	BinIDMapMetrics     = []string{metric.HAMMING, metric.JACCARD, metric.SUBSTRUCTURE, metric.SUPERSTRUCTURE} // const
	BinIvfMetrics       = []string{metric.HAMMING, metric.JACCARD}                                             // const
	HnswMetrics         = []string{metric.L2, metric.IP, metric.COSINE, metric.HAMMING, metric.JACCARD}        // const
	RaftMetrics         = []string{metric.L2, metric.IP}
	CagraBuildAlgoTypes = []string{CargaBuildAlgoIVFPQ, CargaBuildAlgoNNDESCENT}

	SparseMetrics = []string{metric.IP} // const
)

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

Functions

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

func IsDiskIndex

func IsDiskIndex(indexType IndexType) bool

func IsGpuIndex

func IsGpuIndex(indexType IndexType) bool

func IsHYBRIDChecker

func IsHYBRIDChecker(checker interface{}) bool

func IsMmapSupported

func IsMmapSupported(indexType IndexType) bool

Types

type AUTOINDEXChecker

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

AUTOINDEXChecker checks if a TRIE index can be built.

func (*AUTOINDEXChecker) CheckTrain

func (c *AUTOINDEXChecker) CheckTrain(params map[string]string) error

func (*AUTOINDEXChecker) CheckValidDataType

func (c *AUTOINDEXChecker) CheckValidDataType(field *schemapb.FieldSchema) error

func (AUTOINDEXChecker) SetDefaultMetricTypeIfNotExist

func (c AUTOINDEXChecker) SetDefaultMetricTypeIfNotExist(m map[string]string, dType schemapb.DataType)

func (AUTOINDEXChecker) StaticCheck

func (c AUTOINDEXChecker) StaticCheck(params map[string]string) error

type BITMAPChecker

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

func (*BITMAPChecker) CheckTrain

func (c *BITMAPChecker) CheckTrain(params map[string]string) error

func (*BITMAPChecker) CheckValidDataType

func (c *BITMAPChecker) CheckValidDataType(field *schemapb.FieldSchema) error

type HYBRIDChecker

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

func (*HYBRIDChecker) CheckTrain

func (c *HYBRIDChecker) CheckTrain(params map[string]string) error

func (*HYBRIDChecker) CheckValidDataType

func (c *HYBRIDChecker) CheckValidDataType(field *schemapb.FieldSchema) error

type INVERTEDChecker

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

INVERTEDChecker checks if a INVERTED index can be built.

func (*INVERTEDChecker) CheckTrain

func (c *INVERTEDChecker) CheckTrain(params map[string]string) error

func (*INVERTEDChecker) CheckValidDataType

func (c *INVERTEDChecker) CheckValidDataType(field *schemapb.FieldSchema) error

type IndexChecker

type IndexChecker interface {
	CheckTrain(map[string]string) error
	CheckValidDataType(field *schemapb.FieldSchema) error
	SetDefaultMetricTypeIfNotExist(map[string]string, schemapb.DataType)
	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 (
	IndexGpuBF           IndexType = "GPU_BRUTE_FORCE"
	IndexRaftIvfFlat     IndexType = "GPU_IVF_FLAT"
	IndexRaftIvfPQ       IndexType = "GPU_IVF_PQ"
	IndexRaftCagra       IndexType = "GPU_CAGRA"
	IndexRaftBruteForce  IndexType = "GPU_BRUTE_FORCE"
	IndexFaissIDMap      IndexType = "FLAT" // no index is built.
	IndexFaissIvfFlat    IndexType = "IVF_FLAT"
	IndexFaissIvfPQ      IndexType = "IVF_PQ"
	IndexScaNN           IndexType = "SCANN"
	IndexFaissIvfSQ8     IndexType = "IVF_SQ8"
	IndexFaissBinIDMap   IndexType = "BIN_FLAT"
	IndexFaissBinIvfFlat IndexType = "BIN_IVF_FLAT"
	IndexHNSW            IndexType = "HNSW"
	IndexDISKANN         IndexType = "DISKANN"
	IndexSparseInverted  IndexType = "SPARSE_INVERTED_INDEX"
	IndexSparseWand      IndexType = "SPARSE_WAND"
	IndexINVERTED        IndexType = "INVERTED"

	IndexSTLSORT IndexType = "STL_SORT"
	IndexTRIE    IndexType = "TRIE"
	IndexTrie    IndexType = "Trie"
	IndexBitmap  IndexType = "BITMAP"
	IndexHybrid  IndexType = "HYBRID"

	AutoIndex IndexType = "AUTOINDEX"
)

IndexType definitions

type STLSORTChecker

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

STLSORTChecker checks if a STL_SORT index can be built.

func (*STLSORTChecker) CheckTrain

func (c *STLSORTChecker) CheckTrain(params map[string]string) error

func (*STLSORTChecker) CheckValidDataType

func (c *STLSORTChecker) CheckValidDataType(field *schemapb.FieldSchema) error

type TRIEChecker

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

TRIEChecker checks if a TRIE index can be built.

func (*TRIEChecker) CheckTrain

func (c *TRIEChecker) CheckTrain(params map[string]string) error

func (*TRIEChecker) CheckValidDataType

func (c *TRIEChecker) CheckValidDataType(field *schemapb.FieldSchema) error

Jump to

Keyboard shortcuts

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