diff --git a/cache.go b/cache.go index d3e2b6710..f0cd98603 100644 --- a/cache.go +++ b/cache.go @@ -271,7 +271,7 @@ func encodePair(p Pair) *internal.Pair { func decodePair(pb *internal.Pair) Pair { return Pair{ - ID: pb.Key, + ID: pb.Key, Count: pb.Count, } } diff --git a/executor.go b/executor.go index 6e95346e1..3c7a16f04 100644 --- a/executor.go +++ b/executor.go @@ -772,21 +772,27 @@ func (e *Executor) executeBulkSetBitmapAttrs(ctx context.Context, db string, cal // executeSetProfileAttrs executes a SetProfileAttrs() call. func (e *Executor) executeSetProfileAttrs(ctx context.Context, db string, c *pql.Call, opt *ExecOptions) error { - id, ok := c.Args["id"].(uint64) - if !ok { - return errors.New("SetProfileAttrs() id required") - } - - // Copy args and remove reserved fields. - attrs := pql.CopyArgs(c.Args) - delete(attrs, "id") - // Retrieve database. d := e.Index.DB(db) if d == nil { return ErrDatabaseNotFound } + id, ok := c.Args["id"].(uint64) + if !ok { + // Retrieve columnLabel + columnLabel := d.columnLabel + col, ok := c.Args[columnLabel].(uint64) + if !ok { + return errors.New("SetProfileAttrs() id required") + } + id = col + } + + // Copy args and remove reserved fields. + attrs := pql.CopyArgs(c.Args) + delete(attrs, "id") + // Set attributes. if err := d.ProfileAttrStore().SetAttrs(id, attrs); err != nil { return err