github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/entity/indexes_gen.go (about)

     1  // Code generated by go generate; DO NOT EDIT
     2  // This file is generated by go generate 
     3  
     4  package entity
     5  
     6  import (
     7  	"errors"
     8  	"encoding/json"
     9  	"fmt"
    10  )
    11  
    12  
    13  
    14  var _ Index = &IndexFlat{}
    15  
    16  // IndexFlat idx type for FLAT
    17  type IndexFlat struct { //auto generated fields
    18  	metricType MetricType
    19  }
    20  
    21  // Name returns index type name, implementing Index interface
    22  func(i *IndexFlat) Name() string {
    23  	return "Flat"
    24  }
    25  
    26  // IndexType returns IndexType, implementing Index interface
    27  func(i *IndexFlat) IndexType() IndexType {
    28  	return IndexType("FLAT")
    29  }
    30  
    31  // SupportBinary returns whether index type support binary vector
    32  func(i *IndexFlat) SupportBinary() bool {
    33  	return 0 & 2 > 0
    34  }
    35  
    36  // Params returns index construction params, implementing Index interface
    37  func(i *IndexFlat) Params() map[string]string {
    38  	params := map[string]string {//auto generated mapping 
    39  	}
    40  	bs, _ := json.Marshal(params)
    41  	return map[string]string {
    42  		"params": string(bs),
    43  		"index_type": string(i.IndexType()),
    44  		"metric_type": string(i.metricType),
    45  	}
    46  }
    47  
    48  // NewIndexFlat create index with construction parameters
    49  func NewIndexFlat(metricType MetricType, ) (*IndexFlat, error) {
    50  	// auto generate parameters validation code, if any
    51  	return &IndexFlat{ 
    52  	metricType: metricType,
    53  	}, nil
    54  }
    55  
    56  
    57  var _ Index = &IndexBinFlat{}
    58  
    59  // IndexBinFlat idx type for BIN_FLAT
    60  type IndexBinFlat struct { //auto generated fields
    61  	nlist int
    62  	metricType MetricType
    63  }
    64  
    65  // Name returns index type name, implementing Index interface
    66  func(i *IndexBinFlat) Name() string {
    67  	return "BinFlat"
    68  }
    69  
    70  // IndexType returns IndexType, implementing Index interface
    71  func(i *IndexBinFlat) IndexType() IndexType {
    72  	return IndexType("BIN_FLAT")
    73  }
    74  
    75  // SupportBinary returns whether index type support binary vector
    76  func(i *IndexBinFlat) SupportBinary() bool {
    77  	return 2 & 2 > 0
    78  }
    79  
    80  // Params returns index construction params, implementing Index interface
    81  func(i *IndexBinFlat) Params() map[string]string {
    82  	params := map[string]string {//auto generated mapping 
    83  		"nlist": fmt.Sprintf("%v",i.nlist),
    84  	}
    85  	bs, _ := json.Marshal(params)
    86  	return map[string]string {
    87  		"params": string(bs),
    88  		"index_type": string(i.IndexType()),
    89  		"metric_type": string(i.metricType),
    90  	}
    91  }
    92  
    93  // NewIndexBinFlat create index with construction parameters
    94  func NewIndexBinFlat(metricType MetricType, 
    95  	nlist int,
    96  ) (*IndexBinFlat, error) {
    97  	// auto generate parameters validation code, if any
    98  	if nlist < 1 {
    99  		return nil, errors.New("nlist has to be in range [1, 65536]")
   100  	}
   101  	if nlist > 65536 {
   102  		return nil, errors.New("nlist has to be in range [1, 65536]")
   103  	}
   104  	
   105  	return &IndexBinFlat{ 
   106  	//auto generated setting
   107  	nlist: nlist,
   108  	metricType: metricType,
   109  	}, nil
   110  }
   111  
   112  
   113  var _ Index = &IndexIvfFlat{}
   114  
   115  // IndexIvfFlat idx type for IVF_FLAT
   116  type IndexIvfFlat struct { //auto generated fields
   117  	nlist int
   118  	metricType MetricType
   119  }
   120  
   121  // Name returns index type name, implementing Index interface
   122  func(i *IndexIvfFlat) Name() string {
   123  	return "IvfFlat"
   124  }
   125  
   126  // IndexType returns IndexType, implementing Index interface
   127  func(i *IndexIvfFlat) IndexType() IndexType {
   128  	return IndexType("IVF_FLAT")
   129  }
   130  
   131  // SupportBinary returns whether index type support binary vector
   132  func(i *IndexIvfFlat) SupportBinary() bool {
   133  	return 0 & 2 > 0
   134  }
   135  
   136  // Params returns index construction params, implementing Index interface
   137  func(i *IndexIvfFlat) Params() map[string]string {
   138  	params := map[string]string {//auto generated mapping 
   139  		"nlist": fmt.Sprintf("%v",i.nlist),
   140  	}
   141  	bs, _ := json.Marshal(params)
   142  	return map[string]string {
   143  		"params": string(bs),
   144  		"index_type": string(i.IndexType()),
   145  		"metric_type": string(i.metricType),
   146  	}
   147  }
   148  
   149  // NewIndexIvfFlat create index with construction parameters
   150  func NewIndexIvfFlat(metricType MetricType, 
   151  	nlist int,
   152  ) (*IndexIvfFlat, error) {
   153  	// auto generate parameters validation code, if any
   154  	if nlist < 1 {
   155  		return nil, errors.New("nlist has to be in range [1, 65536]")
   156  	}
   157  	if nlist > 65536 {
   158  		return nil, errors.New("nlist has to be in range [1, 65536]")
   159  	}
   160  	
   161  	return &IndexIvfFlat{ 
   162  	//auto generated setting
   163  	nlist: nlist,
   164  	metricType: metricType,
   165  	}, nil
   166  }
   167  
   168  
   169  var _ Index = &IndexBinIvfFlat{}
   170  
   171  // IndexBinIvfFlat idx type for BIN_IVF_FLAT
   172  type IndexBinIvfFlat struct { //auto generated fields
   173  	nlist int
   174  	metricType MetricType
   175  }
   176  
   177  // Name returns index type name, implementing Index interface
   178  func(i *IndexBinIvfFlat) Name() string {
   179  	return "BinIvfFlat"
   180  }
   181  
   182  // IndexType returns IndexType, implementing Index interface
   183  func(i *IndexBinIvfFlat) IndexType() IndexType {
   184  	return IndexType("BIN_IVF_FLAT")
   185  }
   186  
   187  // SupportBinary returns whether index type support binary vector
   188  func(i *IndexBinIvfFlat) SupportBinary() bool {
   189  	return 2 & 2 > 0
   190  }
   191  
   192  // Params returns index construction params, implementing Index interface
   193  func(i *IndexBinIvfFlat) Params() map[string]string {
   194  	params := map[string]string {//auto generated mapping 
   195  		"nlist": fmt.Sprintf("%v",i.nlist),
   196  	}
   197  	bs, _ := json.Marshal(params)
   198  	return map[string]string {
   199  		"params": string(bs),
   200  		"index_type": string(i.IndexType()),
   201  		"metric_type": string(i.metricType),
   202  	}
   203  }
   204  
   205  // NewIndexBinIvfFlat create index with construction parameters
   206  func NewIndexBinIvfFlat(metricType MetricType, 
   207  	nlist int,
   208  ) (*IndexBinIvfFlat, error) {
   209  	// auto generate parameters validation code, if any
   210  	if nlist < 1 {
   211  		return nil, errors.New("nlist has to be in range [1, 65536]")
   212  	}
   213  	if nlist > 65536 {
   214  		return nil, errors.New("nlist has to be in range [1, 65536]")
   215  	}
   216  	
   217  	return &IndexBinIvfFlat{ 
   218  	//auto generated setting
   219  	nlist: nlist,
   220  	metricType: metricType,
   221  	}, nil
   222  }
   223  
   224  
   225  var _ Index = &IndexIvfSQ8{}
   226  
   227  // IndexIvfSQ8 idx type for IVF_SQ8
   228  type IndexIvfSQ8 struct { //auto generated fields
   229  	nlist int
   230  	metricType MetricType
   231  }
   232  
   233  // Name returns index type name, implementing Index interface
   234  func(i *IndexIvfSQ8) Name() string {
   235  	return "IvfSQ8"
   236  }
   237  
   238  // IndexType returns IndexType, implementing Index interface
   239  func(i *IndexIvfSQ8) IndexType() IndexType {
   240  	return IndexType("IVF_SQ8")
   241  }
   242  
   243  // SupportBinary returns whether index type support binary vector
   244  func(i *IndexIvfSQ8) SupportBinary() bool {
   245  	return 0 & 2 > 0
   246  }
   247  
   248  // Params returns index construction params, implementing Index interface
   249  func(i *IndexIvfSQ8) Params() map[string]string {
   250  	params := map[string]string {//auto generated mapping 
   251  		"nlist": fmt.Sprintf("%v",i.nlist),
   252  	}
   253  	bs, _ := json.Marshal(params)
   254  	return map[string]string {
   255  		"params": string(bs),
   256  		"index_type": string(i.IndexType()),
   257  		"metric_type": string(i.metricType),
   258  	}
   259  }
   260  
   261  // NewIndexIvfSQ8 create index with construction parameters
   262  func NewIndexIvfSQ8(metricType MetricType, 
   263  	nlist int,
   264  ) (*IndexIvfSQ8, error) {
   265  	// auto generate parameters validation code, if any
   266  	if nlist < 1 {
   267  		return nil, errors.New("nlist has to be in range [1, 65536]")
   268  	}
   269  	if nlist > 65536 {
   270  		return nil, errors.New("nlist has to be in range [1, 65536]")
   271  	}
   272  	
   273  	return &IndexIvfSQ8{ 
   274  	//auto generated setting
   275  	nlist: nlist,
   276  	metricType: metricType,
   277  	}, nil
   278  }
   279  
   280  
   281  var _ Index = &IndexIvfPQ{}
   282  
   283  // IndexIvfPQ idx type for IVF_PQ
   284  type IndexIvfPQ struct { //auto generated fields
   285  	nlist int
   286  	m int
   287  	nbits int
   288  	metricType MetricType
   289  }
   290  
   291  // Name returns index type name, implementing Index interface
   292  func(i *IndexIvfPQ) Name() string {
   293  	return "IvfPQ"
   294  }
   295  
   296  // IndexType returns IndexType, implementing Index interface
   297  func(i *IndexIvfPQ) IndexType() IndexType {
   298  	return IndexType("IVF_PQ")
   299  }
   300  
   301  // SupportBinary returns whether index type support binary vector
   302  func(i *IndexIvfPQ) SupportBinary() bool {
   303  	return 0 & 2 > 0
   304  }
   305  
   306  // Params returns index construction params, implementing Index interface
   307  func(i *IndexIvfPQ) Params() map[string]string {
   308  	params := map[string]string {//auto generated mapping 
   309  		"nlist": fmt.Sprintf("%v",i.nlist),
   310  		"m": fmt.Sprintf("%v",i.m),
   311  		"nbits": fmt.Sprintf("%v",i.nbits),
   312  	}
   313  	bs, _ := json.Marshal(params)
   314  	return map[string]string {
   315  		"params": string(bs),
   316  		"index_type": string(i.IndexType()),
   317  		"metric_type": string(i.metricType),
   318  	}
   319  }
   320  
   321  // NewIndexIvfPQ create index with construction parameters
   322  func NewIndexIvfPQ(metricType MetricType, 
   323  	nlist int,
   324  
   325  	m int,
   326  
   327  	nbits int,
   328  ) (*IndexIvfPQ, error) {
   329  	// auto generate parameters validation code, if any
   330  	if nlist < 1 {
   331  		return nil, errors.New("nlist has to be in range [1, 65536]")
   332  	}
   333  	if nlist > 65536 {
   334  		return nil, errors.New("nlist has to be in range [1, 65536]")
   335  	}
   336  	
   337  	
   338  	
   339  	if nbits < 1 {
   340  		return nil, errors.New("nbits has to be in range [1, 16]")
   341  	}
   342  	if nbits > 16 {
   343  		return nil, errors.New("nbits has to be in range [1, 16]")
   344  	}
   345  	
   346  	return &IndexIvfPQ{ 
   347  	//auto generated setting
   348  	nlist: nlist,
   349  	//auto generated setting
   350  	m: m,
   351  	//auto generated setting
   352  	nbits: nbits,
   353  	metricType: metricType,
   354  	}, nil
   355  }
   356  
   357  
   358  var _ Index = &IndexHNSW{}
   359  
   360  // IndexHNSW idx type for HNSW
   361  type IndexHNSW struct { //auto generated fields
   362  	M int
   363  	efConstruction int
   364  	metricType MetricType
   365  }
   366  
   367  // Name returns index type name, implementing Index interface
   368  func(i *IndexHNSW) Name() string {
   369  	return "HNSW"
   370  }
   371  
   372  // IndexType returns IndexType, implementing Index interface
   373  func(i *IndexHNSW) IndexType() IndexType {
   374  	return IndexType("HNSW")
   375  }
   376  
   377  // SupportBinary returns whether index type support binary vector
   378  func(i *IndexHNSW) SupportBinary() bool {
   379  	return 0 & 2 > 0
   380  }
   381  
   382  // Params returns index construction params, implementing Index interface
   383  func(i *IndexHNSW) Params() map[string]string {
   384  	params := map[string]string {//auto generated mapping 
   385  		"M": fmt.Sprintf("%v",i.M),
   386  		"efConstruction": fmt.Sprintf("%v",i.efConstruction),
   387  	}
   388  	bs, _ := json.Marshal(params)
   389  	return map[string]string {
   390  		"params": string(bs),
   391  		"index_type": string(i.IndexType()),
   392  		"metric_type": string(i.metricType),
   393  	}
   394  }
   395  
   396  // NewIndexHNSW create index with construction parameters
   397  func NewIndexHNSW(metricType MetricType, 
   398  	M int,
   399  
   400  	efConstruction int,
   401  ) (*IndexHNSW, error) {
   402  	// auto generate parameters validation code, if any
   403  	if M < 4 {
   404  		return nil, errors.New("M has to be in range [4, 64]")
   405  	}
   406  	if M > 64 {
   407  		return nil, errors.New("M has to be in range [4, 64]")
   408  	}
   409  	
   410  	if efConstruction < 8 {
   411  		return nil, errors.New("efConstruction has to be in range [8, 512]")
   412  	}
   413  	if efConstruction > 512 {
   414  		return nil, errors.New("efConstruction has to be in range [8, 512]")
   415  	}
   416  	
   417  	return &IndexHNSW{ 
   418  	//auto generated setting
   419  	M: M,
   420  	//auto generated setting
   421  	efConstruction: efConstruction,
   422  	metricType: metricType,
   423  	}, nil
   424  }
   425  
   426  
   427  var _ Index = &IndexIvfHNSW{}
   428  
   429  // IndexIvfHNSW idx type for IVF_HNSW
   430  type IndexIvfHNSW struct { //auto generated fields
   431  	nlist int
   432  	M int
   433  	efConstruction int
   434  	metricType MetricType
   435  }
   436  
   437  // Name returns index type name, implementing Index interface
   438  func(i *IndexIvfHNSW) Name() string {
   439  	return "IvfHNSW"
   440  }
   441  
   442  // IndexType returns IndexType, implementing Index interface
   443  func(i *IndexIvfHNSW) IndexType() IndexType {
   444  	return IndexType("IVF_HNSW")
   445  }
   446  
   447  // SupportBinary returns whether index type support binary vector
   448  func(i *IndexIvfHNSW) SupportBinary() bool {
   449  	return 0 & 2 > 0
   450  }
   451  
   452  // Params returns index construction params, implementing Index interface
   453  func(i *IndexIvfHNSW) Params() map[string]string {
   454  	params := map[string]string {//auto generated mapping 
   455  		"nlist": fmt.Sprintf("%v",i.nlist),
   456  		"M": fmt.Sprintf("%v",i.M),
   457  		"efConstruction": fmt.Sprintf("%v",i.efConstruction),
   458  	}
   459  	bs, _ := json.Marshal(params)
   460  	return map[string]string {
   461  		"params": string(bs),
   462  		"index_type": string(i.IndexType()),
   463  		"metric_type": string(i.metricType),
   464  	}
   465  }
   466  
   467  // NewIndexIvfHNSW create index with construction parameters
   468  func NewIndexIvfHNSW(metricType MetricType, 
   469  	nlist int,
   470  
   471  	M int,
   472  
   473  	efConstruction int,
   474  ) (*IndexIvfHNSW, error) {
   475  	// auto generate parameters validation code, if any
   476  	if nlist < 1 {
   477  		return nil, errors.New("nlist has to be in range [1, 65536]")
   478  	}
   479  	if nlist > 65536 {
   480  		return nil, errors.New("nlist has to be in range [1, 65536]")
   481  	}
   482  	
   483  	if M < 4 {
   484  		return nil, errors.New("M has to be in range [4, 64]")
   485  	}
   486  	if M > 64 {
   487  		return nil, errors.New("M has to be in range [4, 64]")
   488  	}
   489  	
   490  	if efConstruction < 8 {
   491  		return nil, errors.New("efConstruction has to be in range [8, 512]")
   492  	}
   493  	if efConstruction > 512 {
   494  		return nil, errors.New("efConstruction has to be in range [8, 512]")
   495  	}
   496  	
   497  	return &IndexIvfHNSW{ 
   498  	//auto generated setting
   499  	nlist: nlist,
   500  	//auto generated setting
   501  	M: M,
   502  	//auto generated setting
   503  	efConstruction: efConstruction,
   504  	metricType: metricType,
   505  	}, nil
   506  }
   507  
   508  
   509  var _ Index = &IndexDISKANN{}
   510  
   511  // IndexDISKANN idx type for DISKANN
   512  type IndexDISKANN struct { //auto generated fields
   513  	metricType MetricType
   514  }
   515  
   516  // Name returns index type name, implementing Index interface
   517  func(i *IndexDISKANN) Name() string {
   518  	return "DISKANN"
   519  }
   520  
   521  // IndexType returns IndexType, implementing Index interface
   522  func(i *IndexDISKANN) IndexType() IndexType {
   523  	return IndexType("DISKANN")
   524  }
   525  
   526  // SupportBinary returns whether index type support binary vector
   527  func(i *IndexDISKANN) SupportBinary() bool {
   528  	return 0 & 2 > 0
   529  }
   530  
   531  // Params returns index construction params, implementing Index interface
   532  func(i *IndexDISKANN) Params() map[string]string {
   533  	params := map[string]string {//auto generated mapping 
   534  	}
   535  	bs, _ := json.Marshal(params)
   536  	return map[string]string {
   537  		"params": string(bs),
   538  		"index_type": string(i.IndexType()),
   539  		"metric_type": string(i.metricType),
   540  	}
   541  }
   542  
   543  // NewIndexDISKANN create index with construction parameters
   544  func NewIndexDISKANN(metricType MetricType, ) (*IndexDISKANN, error) {
   545  	// auto generate parameters validation code, if any
   546  	return &IndexDISKANN{ 
   547  	metricType: metricType,
   548  	}, nil
   549  }
   550  
   551  
   552  var _ Index = &IndexAUTOINDEX{}
   553  
   554  // IndexAUTOINDEX idx type for AUTOINDEX
   555  type IndexAUTOINDEX struct { //auto generated fields
   556  	metricType MetricType
   557  }
   558  
   559  // Name returns index type name, implementing Index interface
   560  func(i *IndexAUTOINDEX) Name() string {
   561  	return "AUTOINDEX"
   562  }
   563  
   564  // IndexType returns IndexType, implementing Index interface
   565  func(i *IndexAUTOINDEX) IndexType() IndexType {
   566  	return IndexType("AUTOINDEX")
   567  }
   568  
   569  // SupportBinary returns whether index type support binary vector
   570  func(i *IndexAUTOINDEX) SupportBinary() bool {
   571  	return 0 & 2 > 0
   572  }
   573  
   574  // Params returns index construction params, implementing Index interface
   575  func(i *IndexAUTOINDEX) Params() map[string]string {
   576  	params := map[string]string {//auto generated mapping 
   577  	}
   578  	bs, _ := json.Marshal(params)
   579  	return map[string]string {
   580  		"params": string(bs),
   581  		"index_type": string(i.IndexType()),
   582  		"metric_type": string(i.metricType),
   583  	}
   584  }
   585  
   586  // NewIndexAUTOINDEX create index with construction parameters
   587  func NewIndexAUTOINDEX(metricType MetricType, ) (*IndexAUTOINDEX, error) {
   588  	// auto generate parameters validation code, if any
   589  	return &IndexAUTOINDEX{ 
   590  	metricType: metricType,
   591  	}, nil
   592  }
   593  
   594  
   595  var _ Index = &IndexGPUIvfFlat{}
   596  
   597  // IndexGPUIvfFlat idx type for GPU_IVF_FLAT
   598  type IndexGPUIvfFlat struct { //auto generated fields
   599  	nlist int
   600  	metricType MetricType
   601  }
   602  
   603  // Name returns index type name, implementing Index interface
   604  func(i *IndexGPUIvfFlat) Name() string {
   605  	return "GPUIvfFlat"
   606  }
   607  
   608  // IndexType returns IndexType, implementing Index interface
   609  func(i *IndexGPUIvfFlat) IndexType() IndexType {
   610  	return IndexType("GPU_IVF_FLAT")
   611  }
   612  
   613  // SupportBinary returns whether index type support binary vector
   614  func(i *IndexGPUIvfFlat) SupportBinary() bool {
   615  	return 0 & 2 > 0
   616  }
   617  
   618  // Params returns index construction params, implementing Index interface
   619  func(i *IndexGPUIvfFlat) Params() map[string]string {
   620  	params := map[string]string {//auto generated mapping 
   621  		"nlist": fmt.Sprintf("%v",i.nlist),
   622  	}
   623  	bs, _ := json.Marshal(params)
   624  	return map[string]string {
   625  		"params": string(bs),
   626  		"index_type": string(i.IndexType()),
   627  		"metric_type": string(i.metricType),
   628  	}
   629  }
   630  
   631  // NewIndexGPUIvfFlat create index with construction parameters
   632  func NewIndexGPUIvfFlat(metricType MetricType, 
   633  	nlist int,
   634  ) (*IndexGPUIvfFlat, error) {
   635  	// auto generate parameters validation code, if any
   636  	if nlist < 1 {
   637  		return nil, errors.New("nlist has to be in range [1, 65536]")
   638  	}
   639  	if nlist > 65536 {
   640  		return nil, errors.New("nlist has to be in range [1, 65536]")
   641  	}
   642  	
   643  	return &IndexGPUIvfFlat{ 
   644  	//auto generated setting
   645  	nlist: nlist,
   646  	metricType: metricType,
   647  	}, nil
   648  }
   649  
   650  
   651  var _ Index = &IndexGPUIvfPQ{}
   652  
   653  // IndexGPUIvfPQ idx type for GPU_IVF_PQ
   654  type IndexGPUIvfPQ struct { //auto generated fields
   655  	nlist int
   656  	m int
   657  	nbits int
   658  	metricType MetricType
   659  }
   660  
   661  // Name returns index type name, implementing Index interface
   662  func(i *IndexGPUIvfPQ) Name() string {
   663  	return "GPUIvfPQ"
   664  }
   665  
   666  // IndexType returns IndexType, implementing Index interface
   667  func(i *IndexGPUIvfPQ) IndexType() IndexType {
   668  	return IndexType("GPU_IVF_PQ")
   669  }
   670  
   671  // SupportBinary returns whether index type support binary vector
   672  func(i *IndexGPUIvfPQ) SupportBinary() bool {
   673  	return 0 & 2 > 0
   674  }
   675  
   676  // Params returns index construction params, implementing Index interface
   677  func(i *IndexGPUIvfPQ) Params() map[string]string {
   678  	params := map[string]string {//auto generated mapping 
   679  		"nlist": fmt.Sprintf("%v",i.nlist),
   680  		"m": fmt.Sprintf("%v",i.m),
   681  		"nbits": fmt.Sprintf("%v",i.nbits),
   682  	}
   683  	bs, _ := json.Marshal(params)
   684  	return map[string]string {
   685  		"params": string(bs),
   686  		"index_type": string(i.IndexType()),
   687  		"metric_type": string(i.metricType),
   688  	}
   689  }
   690  
   691  // NewIndexGPUIvfPQ create index with construction parameters
   692  func NewIndexGPUIvfPQ(metricType MetricType, 
   693  	nlist int,
   694  
   695  	m int,
   696  
   697  	nbits int,
   698  ) (*IndexGPUIvfPQ, error) {
   699  	// auto generate parameters validation code, if any
   700  	if nlist < 1 {
   701  		return nil, errors.New("nlist has to be in range [1, 65536]")
   702  	}
   703  	if nlist > 65536 {
   704  		return nil, errors.New("nlist has to be in range [1, 65536]")
   705  	}
   706  	
   707  	
   708  	
   709  	if nbits < 1 {
   710  		return nil, errors.New("nbits has to be in range [1, 64]")
   711  	}
   712  	if nbits > 64 {
   713  		return nil, errors.New("nbits has to be in range [1, 64]")
   714  	}
   715  	
   716  	return &IndexGPUIvfPQ{ 
   717  	//auto generated setting
   718  	nlist: nlist,
   719  	//auto generated setting
   720  	m: m,
   721  	//auto generated setting
   722  	nbits: nbits,
   723  	metricType: metricType,
   724  	}, nil
   725  }
   726  
   727  
   728  var _ Index = &IndexSCANN{}
   729  
   730  // IndexSCANN idx type for SCANN
   731  type IndexSCANN struct { //auto generated fields
   732  	nlist int
   733  	with_raw_data bool
   734  	metricType MetricType
   735  }
   736  
   737  // Name returns index type name, implementing Index interface
   738  func(i *IndexSCANN) Name() string {
   739  	return "SCANN"
   740  }
   741  
   742  // IndexType returns IndexType, implementing Index interface
   743  func(i *IndexSCANN) IndexType() IndexType {
   744  	return IndexType("SCANN")
   745  }
   746  
   747  // SupportBinary returns whether index type support binary vector
   748  func(i *IndexSCANN) SupportBinary() bool {
   749  	return 0 & 2 > 0
   750  }
   751  
   752  // Params returns index construction params, implementing Index interface
   753  func(i *IndexSCANN) Params() map[string]string {
   754  	params := map[string]string {//auto generated mapping 
   755  		"nlist": fmt.Sprintf("%v",i.nlist),
   756  		"with_raw_data": fmt.Sprintf("%v",i.with_raw_data),
   757  	}
   758  	bs, _ := json.Marshal(params)
   759  	return map[string]string {
   760  		"params": string(bs),
   761  		"index_type": string(i.IndexType()),
   762  		"metric_type": string(i.metricType),
   763  	}
   764  }
   765  
   766  // NewIndexSCANN create index with construction parameters
   767  func NewIndexSCANN(metricType MetricType, 
   768  	nlist int,
   769  
   770  	with_raw_data bool,
   771  ) (*IndexSCANN, error) {
   772  	// auto generate parameters validation code, if any
   773  	if nlist < 1 {
   774  		return nil, errors.New("nlist has to be in range [1, 65536]")
   775  	}
   776  	if nlist > 65536 {
   777  		return nil, errors.New("nlist has to be in range [1, 65536]")
   778  	}
   779  	
   780  	validRange := []bool{false, true}
   781  	with_raw_dataOk := false
   782  	for _, v := range validRange {
   783  		if v == with_raw_data {
   784  			with_raw_dataOk = true
   785  			break
   786  		}
   787  	}
   788  	if !with_raw_dataOk {
   789  		return nil, errors.New("with_raw_data not valid")
   790  	}
   791  	
   792  	return &IndexSCANN{ 
   793  	//auto generated setting
   794  	nlist: nlist,
   795  	//auto generated setting
   796  	with_raw_data: with_raw_data,
   797  	metricType: metricType,
   798  	}, nil
   799  }
   800