Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doptime/q-milvus
use milvus in comfortable way, even if you know nothing about it.
https://github.com/doptime/q-milvus
Last synced: 2 days ago
JSON representation
use milvus in comfortable way, even if you know nothing about it.
- Host: GitHub
- URL: https://github.com/doptime/q-milvus
- Owner: doptime
- License: mit
- Created: 2022-04-03T07:26:55.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-12T07:04:31.000Z (over 1 year ago)
- Last Synced: 2024-11-02T16:02:35.969Z (14 days ago)
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# q-milvus
q-milvus provides the transparent way to use milvus.
## Feature: Auto build schema & Auto build index & Insert Search Remove easily## step1. define you schema like this:
```
package qmilvusimport (
"context"
"github.com/milvus-io/milvus-sdk-go/v2/entity"
milvus "github.com/yangkequn/q-milvus"
)type FooEntity struct {
Id int64 `schema:"in,out" primarykey:"true"`
Name string `schema:"in,out" max_length:"2048"`
Vector []float32 `dim:"384" schema:"in" index:"true"`
Score float32 `schema:"out"`
}//Index: define your index field name and type here. required
func (v FooEntity) Index() (indexFieldName string, index entity.Index) {
index, _ = entity.NewIndexIvfFlat(entity.IP, 256)
return "Vector", index
}var collection *milvus.Collection = milvus.NewCollection[FooEntity]("milvus.lan:19530", "").Create()
```
## step2. using collection, you can Insert Search or Remove
```
var models []*FooEntity
// insert operation
err:=collection.Insert(models)
// search operation
ids,scores,models,err:=collection.SearchVector(query []float32,10)
// remove operation. type of ids : []int64
err:=collection.RemoveByKey(ids)
```