func(i *IndexHNSW) SupportBinary() bool {
	return 0 & 2 > 0
}
SupportBinary returns whether index type support binary vector
package entity
import (
	"errors"
	"encoding/json"
	"fmt"
)
var _ Index = &IndexFlat{}
type IndexFlat struct {  
	nlist int
	metricType MetricType
}
func(i *IndexFlat) Name() string {
	return "Flat"
}
func(i *IndexFlat) IndexType() IndexType {
	return IndexType("FLAT")
}
func(i *IndexFlat) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexFlat) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexFlat(metricType MetricType, 
	nlist int,
) (*IndexFlat, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexFlat{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexBinFlat{}
type IndexBinFlat struct {  
	nlist int
	metricType MetricType
}
func(i *IndexBinFlat) Name() string {
	return "BinFlat"
}
func(i *IndexBinFlat) IndexType() IndexType {
	return IndexType("BIN_FLAT")
}
func(i *IndexBinFlat) SupportBinary() bool {
	return 2 & 2 > 0
}
func(i *IndexBinFlat) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexBinFlat(metricType MetricType, 
	nlist int,
) (*IndexBinFlat, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexBinFlat{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexIvfFlat{}
type IndexIvfFlat struct {  
	nlist int
	metricType MetricType
}
func(i *IndexIvfFlat) Name() string {
	return "IvfFlat"
}
func(i *IndexIvfFlat) IndexType() IndexType {
	return IndexType("IVF_FLAT")
}
func(i *IndexIvfFlat) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexIvfFlat) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexIvfFlat(metricType MetricType, 
	nlist int,
) (*IndexIvfFlat, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexIvfFlat{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexBinIvfFlat{}
type IndexBinIvfFlat struct {  
	nlist int
	metricType MetricType
}
func(i *IndexBinIvfFlat) Name() string {
	return "BinIvfFlat"
}
func(i *IndexBinIvfFlat) IndexType() IndexType {
	return IndexType("BIN_IVF_FLAT")
}
func(i *IndexBinIvfFlat) SupportBinary() bool {
	return 2 & 2 > 0
}
func(i *IndexBinIvfFlat) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexBinIvfFlat(metricType MetricType, 
	nlist int,
) (*IndexBinIvfFlat, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexBinIvfFlat{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexIvfSQ8{}
type IndexIvfSQ8 struct {  
	nlist int
	metricType MetricType
}
func(i *IndexIvfSQ8) Name() string {
	return "IvfSQ8"
}
func(i *IndexIvfSQ8) IndexType() IndexType {
	return IndexType("IVF_SQ8")
}
func(i *IndexIvfSQ8) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexIvfSQ8) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexIvfSQ8(metricType MetricType, 
	nlist int,
) (*IndexIvfSQ8, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexIvfSQ8{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexIvfSQ8H{}
type IndexIvfSQ8H struct {  
	nlist int
	metricType MetricType
}
func(i *IndexIvfSQ8H) Name() string {
	return "IvfSQ8H"
}
func(i *IndexIvfSQ8H) IndexType() IndexType {
	return IndexType("IVF_SQ8_HYBRID")
}
func(i *IndexIvfSQ8H) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexIvfSQ8H) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexIvfSQ8H(metricType MetricType, 
	nlist int,
) (*IndexIvfSQ8H, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	return &IndexIvfSQ8H{ 
	nlist: nlist,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexIvfPQ{}
type IndexIvfPQ struct {  
	nlist int
	m int
	nbits int
	metricType MetricType
}
func(i *IndexIvfPQ) Name() string {
	return "IvfPQ"
}
func(i *IndexIvfPQ) IndexType() IndexType {
	return IndexType("IVF_PQ")
}
func(i *IndexIvfPQ) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexIvfPQ) Params() map[string]string {
	params := map[string]string { 
		"nlist": fmt.Sprintf("%v",i.nlist),
		"m": fmt.Sprintf("%v",i.m),
		"nbits": fmt.Sprintf("%v",i.nbits),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexIvfPQ(metricType MetricType, 
	nlist int,
	m int,
	nbits int,
) (*IndexIvfPQ, error) {
	if nlist < 1 {
		return nil, errors.New("nlist not valid")
	}
	if nlist > 65536 {
		return nil, errors.New("nlist not valid")
	}
	if nbits < 1 {
		return nil, errors.New("nbits not valid")
	}
	if nbits > 16 {
		return nil, errors.New("nbits not valid")
	}
	return &IndexIvfPQ{ 
	nlist: nlist,
	m: m,
	nbits: nbits,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexRNSG{}
type IndexRNSG struct {  
	out_degree int
	candidate_pool_size int
	search_length int
	knng int
	metricType MetricType
}
func(i *IndexRNSG) Name() string {
	return "RNSG"
}
func(i *IndexRNSG) IndexType() IndexType {
	return IndexType("NSG")
}
func(i *IndexRNSG) SupportBinary() bool {
	return 0 & 2 > 0
}
func(i *IndexRNSG) Params() map[string]string {
	params := map[string]string { 
		"out_degree": fmt.Sprintf("%v",i.out_degree),
		"candidate_pool_size": fmt.Sprintf("%v",i.candidate_pool_size),
		"search_length": fmt.Sprintf("%v",i.search_length),
		"knng": fmt.Sprintf("%v",i.knng),
	}
	bs, _ := json.Marshal(params)
	return map[string]string {
		"params": string(bs),
		"index_type": string(i.IndexType()),
		"metric_type": string(i.metricType),
	}
}
func NewIndexRNSG(metricType MetricType, 
	out_degree int,
	candidate_pool_size int,
	search_length int,
	knng int,
) (*IndexRNSG, error) {
	if out_degree < 5 {
		return nil, errors.New("out_degree not valid")
	}
	if out_degree > 300 {
		return nil, errors.New("out_degree not valid")
	}
	if candidate_pool_size < 50 {
		return nil, errors.New("candidate_pool_size not valid")
	}
	if candidate_pool_size > 1000 {
		return nil, errors.New("candidate_pool_size not valid")
	}
	if search_length < 10 {
		return nil, errors.New("search_length not valid")
	}
	if search_length > 300 {
		return nil, errors.New("search_length not valid")
	}
	if knng < 5 {
		return nil, errors.New("knng not valid")
	}
	if knng > 300 {
		return nil, errors.New("knng not valid")
	}
	return &IndexRNSG{ 
	out_degree: out_degree,
	candidate_pool_size: candidate_pool_size,
	search_length: search_length,
	knng: knng,
	metricType: metricType,
	}, nil
}
var _ Index = &IndexHNSW{}
type IndexHNSW struct {  
	M int
	efConstruction int
	metricType MetricType
}
func(i *IndexHNSW) Name() string {
	return "HNSW"
}
func(i *IndexHNSW) IndexType() IndexType {
	return IndexType("HNSW")
}