Skip to content

Commit

Permalink
Check GetV len
Browse files Browse the repository at this point in the history
  • Loading branch information
crumbjp committed Feb 7, 2024
1 parent 220596e commit 83f6225
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ func (self *RpcFeatureServer) Set(ctx context.Context, in *pb.SetRequest) (*pb.S
for _, data := range in.GetData() {
v := make([]float32, config.Db.Faiss.Dimension)
if(data.GetV() != nil) {
for i, double := range data.GetV() {
dataV := data.GetV()
if (len(dataV) != config.Db.Faiss.Dimension) {
faissdb.logger.Error("RpcFeatureServer.Set() GetV() length missmatch %v != %v", len(dataV), config.Db.Faiss.Dimension)
nError++
continue
}
for i, double := range dataV {
v[i] = float32(double)
}
} else {
Expand Down

0 comments on commit 83f6225

Please sign in to comment.