From 386545c67cb57aacdc4160aa9e0f543b4642cc50 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Tue, 5 Jun 2018 14:33:26 -0500 Subject: [PATCH] rename TopN field/filters to attrName/attrValues --- executor.go | 8 ++++---- executor_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/executor.go b/executor.go index 87e07c63e..413be36b4 100644 --- a/executor.go +++ b/executor.go @@ -552,7 +552,7 @@ func (e *Executor) executeTopNSlice(ctx context.Context, index string, c *pql.Ca if err != nil { return nil, fmt.Errorf("executeTopNSlice: %v", err) } - field, _ := c.Args["field"].(string) // TODO: rename this to something other than field + attrName, _ := c.Args["attrName"].(string) rowIDs, _, err := c.UintSliceArg("ids") if err != nil { return nil, fmt.Errorf("executeTopNSlice: %v", err) @@ -561,7 +561,7 @@ func (e *Executor) executeTopNSlice(ctx context.Context, index string, c *pql.Ca if err != nil { return nil, fmt.Errorf("executeTopNSlice: %v", err) } - filters, _ := c.Args["filters"].([]interface{}) + attrValues, _ := c.Args["attrValues"].([]interface{}) tanimotoThreshold, _, err := c.UintArg("tanimotoThreshold") if err != nil { return nil, fmt.Errorf("executeTopNSlice: %v", err) @@ -600,8 +600,8 @@ func (e *Executor) executeTopNSlice(ctx context.Context, index string, c *pql.Ca N: int(n), Src: src, RowIDs: rowIDs, - FilterName: field, - FilterValues: filters, + FilterName: attrName, + FilterValues: attrValues, MinThreshold: minThreshold, TanimotoThreshold: tanimotoThreshold, }) diff --git a/executor_test.go b/executor_test.go index 606646a92..d06a5027c 100644 --- a/executor_test.go +++ b/executor_test.go @@ -529,7 +529,7 @@ func TestExecutor_Execute_TopN_Attr(t *testing.T) { t.Fatal(err) } e := test.NewExecutor(hldr.Holder, test.NewCluster(1)) - if result, err := e.Execute(context.Background(), "i", test.MustParse(`TopN(frame="f", n=1, field="category", filters=[123])`), nil, nil); err != nil { + if result, err := e.Execute(context.Background(), "i", test.MustParse(`TopN(frame="f", n=1, attrName="category", attrValues=[123])`), nil, nil); err != nil { t.Fatal(err) } else if !reflect.DeepEqual(result, []interface{}{[]pilosa.Pair{ {ID: 10, Count: 1}, @@ -552,7 +552,7 @@ func TestExecutor_Execute_TopN_Attr_Src(t *testing.T) { t.Fatal(err) } e := test.NewExecutor(hldr.Holder, test.NewCluster(1)) - if result, err := e.Execute(context.Background(), "i", test.MustParse(`TopN(Bitmap(row=10,frame=f),frame="f", n=1, field="category", filters=[123])`), nil, nil); err != nil { + if result, err := e.Execute(context.Background(), "i", test.MustParse(`TopN(Bitmap(row=10,frame=f),frame="f", n=1, attrName="category", attrValues=[123])`), nil, nil); err != nil { t.Fatal(err) } else if !reflect.DeepEqual(result, []interface{}{[]pilosa.Pair{ {ID: 10, Count: 1},