Documentation ¶
Overview ¶
Package gongt provides implementation of Go API for https://github.com/yahoojapan/NGT
Index ¶
- Constants
- Variables
- func BulkInsert(vecs [][]float64) ([]int, []error)
- func BulkInsertCommit(vecs [][]float64, poolSize int) ([]int, []error)
- func Close()
- func CreateAndSaveIndex(poolSize int) error
- func CreateIndex(poolSize int) error
- func GetDim() int
- func GetErrors() []error
- func GetPath() string
- func GetStrictVector(id uint) ([]float32, error)
- func GetVector(id int) ([]float64, error)
- func Insert(vec []float64) (int, error)
- func InsertCommit(vec []float64, poolSize int) (int, error)
- func Remove(id int) error
- func SaveIndex() error
- func StrictInsert(vec []float64) (uint, error)
- func StrictRemove(id uint) error
- type DistanceType
- type NGT
- func Get() *NGT
- func New(indexPath string) *NGT
- func Open() *NGT
- func SetBulkInsertChunkSize(size int) *NGT
- func SetCreationEdgeSize(size int) *NGT
- func SetDimension(dimension int) *NGT
- func SetDistanceType(dt DistanceType) *NGT
- func SetIndexPath(path string) *NGT
- func SetObjectType(ot ObjectType) *NGT
- func SetSearchEdgeSize(size int) *NGT
- func (n *NGT) BulkInsert(vecs [][]float64) ([]int, []error)
- func (n *NGT) BulkInsertCommit(vecs [][]float64, poolSize int) ([]int, []error)
- func (n *NGT) Close()
- func (n *NGT) CreateAndSaveIndex(poolSize int) error
- func (n *NGT) CreateIndex(poolSize int) error
- func (n NGT) GetDim() int
- func (n *NGT) GetErrors() []error
- func (n NGT) GetPath() string
- func (n *NGT) GetStrictVector(id uint) ([]float32, error)
- func (n *NGT) GetVector(id int) ([]float64, error)
- func (n *NGT) Insert(vec []float64) (int, error)
- func (n *NGT) InsertCommit(vec []float64, poolSize int) (int, error)
- func (n *NGT) Open() *NGT
- func (n *NGT) Remove(id int) error
- func (n *NGT) SaveIndex() error
- func (n *NGT) Search(vec []float64, size int, epsilon float64) ([]SearchResult, error)
- func (n *NGT) SetBulkInsertChunkSize(size int) *NGT
- func (n *NGT) SetCreationEdgeSize(size int) *NGT
- func (n *NGT) SetDimension(dimension int) *NGT
- func (n *NGT) SetDistanceType(dt DistanceType) *NGT
- func (n *NGT) SetIndexPath(path string) *NGT
- func (n *NGT) SetObjectType(ot ObjectType) *NGT
- func (n *NGT) SetSearchEdgeSize(size int) *NGT
- func (n *NGT) StrictInsert(vec []float64) (uint, error)
- func (n *NGT) StrictRemove(id uint) error
- func (n *NGT) StrictSearch(vec []float64, size int, epsilon, radius float32) ([]StrictSearchResult, error)
- type ObjectType
- type Property
- type SearchResult
- type StrictSearchResult
Examples ¶
- BulkInsert
- BulkInsertCommit
- Close
- CreateAndSaveIndex
- CreateIndex
- Get
- GetDim
- GetErrors
- GetPath
- GetStrictVector
- GetVector
- Insert
- InsertCommit
- NGT.BulkInsert
- NGT.BulkInsertCommit
- NGT.Close
- NGT.CreateAndSaveIndex
- NGT.CreateIndex
- NGT.GetDim
- NGT.GetErrors
- NGT.GetPath
- NGT.GetStrictVector
- NGT.GetVector
- NGT.Insert
- NGT.InsertCommit
- NGT.Open
- NGT.Remove
- NGT.SaveIndex
- NGT.Search
- NGT.SetBulkInsertChunkSize
- NGT.SetCreationEdgeSize
- NGT.SetDimension
- NGT.SetDistanceType
- NGT.SetIndexPath
- NGT.SetObjectType
- NGT.SetSearchEdgeSize
- NGT.StrictInsert
- NGT.StrictRemove
- NGT.StrictSearch
- New
- Open
- Remove
- SaveIndex
- Search
- SetBulkInsertChunkSize
- SetCreationEdgeSize
- SetDimension
- SetDistanceType
- SetIndexPath
- SetObjectType
- SetSearchEdgeSize
- StrictInsert
- StrictRemove
- StrictSearch
Constants ¶
const ( // ObjectNone is unknown object type ObjectNone ObjectType = iota // Uint8 is 8bit unsigned integer Uint8 // Float is 32bit floating point number Float // DistanceNone is unknown distance type DistanceNone DistanceType = iota - 1 // L1 is l1 norm L1 // L2 is l2 norm L2 // Angle is angle distance Angle // Hamming is hamming distance Hamming // Cosine is cosine distance Cosine // NormalizedAngle is angle distance with normalization NormalizedAngle // NormalizedCosine is cosine distance with normalization NormalizedCosine // DefaultDimension is 0 DefaultDimension = 0 // DefaultCreationEdgeSize is 10 DefaultCreationEdgeSize = 10 // DefaultSearchEdgeSize is 10 DefaultSearchEdgeSize = 40 // DefaultObjectType is Float DefaultObjectType = Float // DefaultDistanceType is L2 DefaultDistanceType = L2 // DefaultEpsilon is 0.01 DefaultEpsilon = 0.01 // DefaultBulkInsertChunkSize is 100 DefaultBulkInsertChunkSize = 100 // DefaultPoolSize is 1 DefaultPoolSize = 1 // ErrorCode is false ErrorCode = C._Bool(false) )
Variables ¶
var ( // ErrCAPINotImplemented raises using not implemented function in C API ErrCAPINotImplemented = errors.New("Not implemented in C API") )
Functions ¶
func BulkInsert ¶
BulkInsert returns NGT object ids. This only stores not indexing, you must call CreateIndex and SaveIndex.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Bulk Insert vectors := [][]float64{ {1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 0}, } ids, errs := gongt.BulkInsert(vectors) _, _ = ids, errs }
Output:
func BulkInsertCommit ¶
BulkInsertCommit returns NGT object ids. This stores and indexes at the same time.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Bulk Insert And Commit vectors := [][]float64{ {1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 0}, } ids, errs := gongt.BulkInsertCommit(vectors, gongt.DefaultPoolSize) _, _ = ids, errs }
Output:
func Close ¶
func Close()
Close NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Close NGT gongt.Close() }
Output:
func CreateAndSaveIndex ¶
CreateAndSaveIndex call CreateIndex and SaveIndex in a row.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Create And Save Index gongt.CreateAndSaveIndex(10) }
Output:
func CreateIndex ¶
CreateIndex creates NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Create Index gongt.CreateIndex(10) }
Output:
func GetDim ¶
func GetDim() int
GetDim returns NGT dimension
dimension := gongt.GetDim()
Example ¶
package main import ( "fmt" "github.com/yahoojapan/gongt" ) func main() { // Fetch Dimension Size gongt.SetIndexPath("assets/example").Open() dim := gongt.GetDim() fmt.Println(dim) }
Output: 128
func GetErrors ¶
func GetErrors() []error
GetErrors returns errors
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Close NGT errs := gongt.GetErrors() _ = errs }
Output:
func GetPath ¶
func GetPath() string
GetPath returns path to index directory
indexPath := gongt.GetPath()
Example ¶
package main import ( "fmt" "github.com/yahoojapan/gongt" ) func main() { // Fetch Path Location gongt.SetIndexPath("assets/example").Open() path := gongt.GetPath() fmt.Println(path) }
Output: assets/example
func GetStrictVector ¶
GetStrictVector is C type stricted GetVector function.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Get Vector vec, err := gongt.GetStrictVector(1) _, _ = vec, err }
Output:
func GetVector ¶
GetVector returns vector stored in NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Get Vector vec, err := gongt.GetVector(1) _, _ = vec, err }
Output:
func Insert ¶
Insert returns NGT object id. This only stores not indexing, must execute CreateIndex and SaveIndex.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.Insert(vector) _, _ = id, err }
Output:
func InsertCommit ¶
InsertCommit returns NGT object id. This stores and indexes at the same time.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.InsertCommit(vector, 10) _, _ = id, err }
Output:
func Remove ¶
Remove removes from NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Remove Vector gongt.Remove(8) }
Output:
func SaveIndex ¶
func SaveIndex() error
SaveIndex stores NGT index to storage.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Save Index gongt.SaveIndex() }
Output:
func StrictInsert ¶
StrictInsert is C type stricted insert function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Strict Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.StrictInsert(vector) _, _ = id, err }
Output:
func StrictRemove ¶
StrictRemove is C type stricted remove function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Remove Vector gongt.StrictRemove(8) }
Output:
Types ¶
type NGT ¶
type NGT struct {
// contains filtered or unexported fields
}
NGT is gongt base struct
func Get ¶
func Get() *NGT
Get returns singleton instance NGT
ngt := gongt.Get()
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Fetch Singleton GoNGT instance ngt := gongt.Get() _ = ngt }
Output:
func New ¶
New returns NGT instance
ngt := gongt.New("index Path")
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Instantiate GoNGT ngt := gongt.New("assets/example") _ = ngt }
Output:
func Open ¶
func Open() *NGT
Open configures using Property and returns NGT instance
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Bulk Insert Chunk Size ngt := gongt.Open() _ = ngt }
Output:
func SetBulkInsertChunkSize ¶
SetBulkInsertChunkSize sets insert chunk size
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Bulk Insert Chunk Size gongt.SetBulkInsertChunkSize(5) }
Output:
func SetCreationEdgeSize ¶
SetCreationEdgeSize sets creation edge size
gongt.SetCreationEdgeSize(10) // CreationEdgeSize Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Creation Edge Size gongt.SetCreationEdgeSize(30) }
Output:
func SetDimension ¶
SetDimension sets NGT feature dimension
gongt.SetDimension(10) // Dimension Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Dimension gongt.SetDimension(128) }
Output:
func SetDistanceType ¶
func SetDistanceType(dt DistanceType) *NGT
SetDistanceType sets distanc
gongt.SetDistanceType(gongt.L1) // DistanceType Setting gongt.SetDistanceType(gongt.L2) // DistanceType Setting gongt.SetDistanceType(gongt.Hamming) // DistanceType Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Distance Type gongt.SetDistanceType(gongt.L2) }
Output:
func SetIndexPath ¶
SetIndexPath sets path to index directory
gongt.SetIndexPath("index Path")
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Fetch Path Location gongt.SetIndexPath("/tmp/index-path") }
Output:
func SetObjectType ¶
func SetObjectType(ot ObjectType) *NGT
SetObjectType sets object type
gongt.SetObjectType(gongt.Float) // ObjectType Setting gongt.SetObjectType(gongt.Uint8) // ObjectType Setting gongt.SetObjectType(gongt.ObjectNone) // ObjectType Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Object Type // gongt.SetObjectType(gongt.Uint8) // ObjectType Setting // gongt.SetObjectType(gongt.ObjectNone) // ObjectType Setting gongt.SetObjectType(gongt.Float) }
Output:
func SetSearchEdgeSize ¶
SetSearchEdgeSize sets search edge size
gongt.SetSearchEdgeSize(10) // SearchEdgeSize Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Search Edge Size gongt.SetSearchEdgeSize(10) }
Output:
func (*NGT) BulkInsert ¶
BulkInsert returns NGT object ids. This only stores not indexing, you must call CreateIndex and SaveIndex.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Bulk Insert vectors := [][]float64{ {1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 0}, } ids, errs := gongt.Get().BulkInsert(vectors) _, _ = ids, errs }
Output:
func (*NGT) BulkInsertCommit ¶
BulkInsertCommit returns NGT object ids. This stores and indexes at the same time.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Bulk Insert And Commit vectors := [][]float64{ {1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 0}, } ids, errs := gongt.Get().BulkInsertCommit(vectors, gongt.DefaultPoolSize) _, _ = ids, errs }
Output:
func (*NGT) Close ¶
func (n *NGT) Close()
Close NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Close NGT gongt.Get().Close() }
Output:
func (*NGT) CreateAndSaveIndex ¶
CreateAndSaveIndex call CreateIndex and SaveIndex in a row.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Create And Save Index gongt.Get().CreateAndSaveIndex(10) }
Output:
func (*NGT) CreateIndex ¶
CreateIndex creates NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Create Index gongt.Get().CreateIndex(10) }
Output:
func (NGT) GetDim ¶
GetDim returns NGT dimension
dimension := gongt.Get().GetDim() dimension := gongt.New("Index Path").GetDim()
Example ¶
package main import ( "fmt" "github.com/yahoojapan/gongt" ) func main() { // Fetch Dimension Size gongt.SetIndexPath("assets/example").Open() dim := gongt.Get().GetDim() fmt.Println(dim) }
Output: 128
func (*NGT) GetErrors ¶
GetErrors returns errors
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Close NGT errs := gongt.Get().GetErrors() _ = errs }
Output:
func (NGT) GetPath ¶
GetPath returns path to index directory
indexPath := gongt.Get().GetPath() indexPath := gongt.New("index path").GetPath()
Example ¶
package main import ( "fmt" "github.com/yahoojapan/gongt" ) func main() { // Fetch Path Location gongt.SetIndexPath("assets/example").Open() path := gongt.Get().GetPath() fmt.Println(path) }
Output: assets/example
func (*NGT) GetStrictVector ¶
GetStrictVector is C type stricted GetVector function.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Get Vector vec, err := gongt.Get().GetStrictVector(1) _, _ = vec, err }
Output:
func (*NGT) GetVector ¶
GetVector returns vector stored in NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Get Vector vec, err := gongt.Get().GetVector(1) _, _ = vec, err }
Output:
func (*NGT) Insert ¶
Insert returns NGT object id. This only stores not indexing, you must call CreateIndex and SaveIndex.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.Get().Insert(vector) _, _ = id, err }
Output:
func (*NGT) InsertCommit ¶
InsertCommit returns NGT object id. This stores and indexes at the same time.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.Get().InsertCommit(vector, 10) _, _ = id, err }
Output:
func (*NGT) Open ¶
Open configures using Property and returns NGT instance
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Bulk Insert Chunk Size ngt := gongt.Get().Open() _ = ngt }
Output:
func (*NGT) Remove ¶
Remove removes from NGT index.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Remove Vector gongt.Get().Remove(8) }
Output:
func (*NGT) SaveIndex ¶
SaveIndex stores NGT index to storage.
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Save Index gongt.Get().SaveIndex() }
Output:
func (*NGT) Search ¶
Search returns search result as []SearchResult
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Search vector := []float64{1, 0, 0, 0, 0, 0} res, err := gongt.Get().Search(vector, 1, gongt.DefaultEpsilon) _, _ = res, err }
Output:
func (*NGT) SetBulkInsertChunkSize ¶
SetBulkInsertChunkSize sets insert chunk size
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Bulk Insert Chunk Size gongt.Get().SetBulkInsertChunkSize(5) }
Output:
func (*NGT) SetCreationEdgeSize ¶
SetCreationEdgeSize sets creation edge size
gongt.Get().SetCreationEdgeSize(10) // CreationEdgeSize Setting gongt.New("").SetCreationEdgeSize(10) // CreationEdgeSize Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Creation Edge Size gongt.Get().SetCreationEdgeSize(30) }
Output:
func (*NGT) SetDimension ¶
SetDimension sets NGT feature dimension
gongt.Get().SetDimension(10) // Dimension Setting gongt.New("Index Path").SetDimension(10) // Dimension Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Dimension gongt.Get().SetDimension(128) }
Output:
func (*NGT) SetDistanceType ¶
func (n *NGT) SetDistanceType(dt DistanceType) *NGT
SetDistanceType sets distance type
gongt.Get().SetDistanceType(gongt.L1) // DistanceType Setting gongt.Get().SetDistanceType(gongt.L2) // DistanceType Setting gongt.Get().SetDistanceType(gongt.Hamming) // DistanceType Setting gongt.New("").SetDistanceType(gongt.L1) // DistanceType Setting gongt.New("").SetDistanceType(gongt.L2) // DistanceType Setting gongt.New("").SetDistanceType(gongt.Hamming) // DistanceType Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Distance Type gongt.Get().SetDistanceType(gongt.Hamming) }
Output:
func (*NGT) SetIndexPath ¶
SetIndexPath sets path to index directory
gongt.Get().SetIndexPath("index Path") gongt.New("").SetIndexPath("index Path")
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Fetch Path Location gongt.Get().SetIndexPath("/tmp/index-path") }
Output:
func (*NGT) SetObjectType ¶
func (n *NGT) SetObjectType(ot ObjectType) *NGT
SetObjectType sets object type
gongt.Get().SetObjectType(gongt.Float) // ObjectType Setting gongt.Get().SetObjectType(gongt.Uint8) // ObjectType Setting gongt.Get().SetObjectType(gongt.ObjectNone) // ObjectType Setting gongt.New("").SetObjectType(gongt.Float) // ObjectType Setting gongt.New("").SetObjectType(gongt.Uint8) // ObjectType Setting gongt.New("").SetObjectType(gongt.ObjectNone) // ObjectType Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Object Type // gongt.Get().SetObjectType(gongt.Uint8) // ObjectType Setting // gongt.Get().SetObjectType(gongt.ObjectNone) // ObjectType Setting gongt.Get().SetObjectType(gongt.Float) // ObjectType Setting }
Output:
func (*NGT) SetSearchEdgeSize ¶
SetSearchEdgeSize sets search edge size
gongt.Get().SetSearchEdgeSize(10) // SearchEdgeSize Setting gongt.New("").SetSearchEdgeSize(10) // SearchEdgeSize Setting
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Set Search Edge Size gongt.Get().SetSearchEdgeSize(10) }
Output:
func (*NGT) StrictInsert ¶
StrictInsert is C type stricted insert function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Strict Vector Insert vector := []float64{1, 0, 0, 0, 0, 0} id, err := gongt.Get().StrictInsert(vector) _, _ = id, err }
Output:
func (*NGT) StrictRemove ¶
StrictRemove is C type stricted remove function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Remove Vector gongt.Get().StrictRemove(8) }
Output:
func (*NGT) StrictSearch ¶
func (n *NGT) StrictSearch(vec []float64, size int, epsilon, radius float32) ([]StrictSearchResult, error)
StrictSearch is C type stricted search function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Strict Vector Search vector := []float64{1, 0, 0, 0, 0, 0} res, err := gongt.Get().StrictSearch(vector, 1, gongt.DefaultEpsilon, 0.9) _, _ = res, err }
Output:
type Property ¶
type Property struct { Dimension int CreationEdgeSize int SearchEdgeSize int ObjectType ObjectType DistanceType DistanceType IndexPath string BulkInsertChunkSize int }
Property includes parameters for NGT
type SearchResult ¶
SearchResult is struct for comfortable use in Go
func Search ¶
func Search(vec []float64, size int, epsilon float64) ([]SearchResult, error)
Search returns search result as []SearchResult
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Vector Search vector := []float64{1, 0, 0, 0, 0, 0} res, err := gongt.Search(vector, 1, gongt.DefaultEpsilon) _, _ = res, err }
Output:
type StrictSearchResult ¶
StrictSearchResult is struct with same type in NGT core
func StrictSearch ¶
func StrictSearch(vec []float64, size int, epsilon, radius float32) ([]StrictSearchResult, error)
StrictSearch is C type stricted search function
Example ¶
package main import ( "github.com/yahoojapan/gongt" ) func main() { // Strict Vector Search vector := []float64{1, 0, 0, 0, 0, 0} res, err := gongt.StrictSearch(vector, 1, gongt.DefaultEpsilon, 1.1) _, _ = res, err }
Output: