diff --git a/cmd/genji/dbutil/dump_test.go b/cmd/genji/dbutil/dump_test.go index e43eebf7d..a9e0184f9 100644 --- a/cmd/genji/dbutil/dump_test.go +++ b/cmd/genji/dbutil/dump_test.go @@ -63,7 +63,7 @@ func TestDump(t *testing.T) { require.NoError(t, err) writeToBuf(q + "\n") - q = fmt.Sprintf(`CREATE INDEX idx_%s_b_c ON %s (a);`, table, table) + q = fmt.Sprintf(`CREATE INDEX idx_%s_b_c ON %s (b, c);`, table, table) err = db.Exec(q) require.NoError(t, err) writeToBuf(q + "\n") diff --git a/database/catalog.go b/database/catalog.go index 7b020e48e..a21299534 100644 --- a/database/catalog.go +++ b/database/catalog.go @@ -502,7 +502,7 @@ OUTER: for _, path := range info.Paths { for _, fc := range ti.FieldConstraints { if fc.Path.IsEqual(path) { - // a constraint may or may enforce a type + // a constraint may or may not enforce a type if fc.Type != 0 { info.Types = append(info.Types, document.ValueType(fc.Type)) } diff --git a/database/config.go b/database/config.go index e12966770..c97e5917b 100644 --- a/database/config.go +++ b/database/config.go @@ -235,7 +235,7 @@ type IndexInfo struct { // If set to true, values will be associated with at most one key. False by default. Unique bool - // If set, the index is typed and only accepts values of those types . + // If set, the index is typed and only accepts values of those types. Types []document.ValueType } diff --git a/database/index.go b/database/index.go index 8331eb72c..7af517195 100644 --- a/database/index.go +++ b/database/index.go @@ -120,7 +120,7 @@ func (idx *Index) IsComposite() bool { return len(idx.Info.Types) > 1 } -// Arity returns how many values the indexed is operating on. +// Arity returns how many values the index is operating on. // For example, an index created with `CREATE INDEX idx_a_b ON foo (a, b)` has an arity of 2. func (idx *Index) Arity() int { return len(idx.Info.Types) diff --git a/planner/optimizer.go b/planner/optimizer.go index 4a478c25a..8312df3e7 100644 --- a/planner/optimizer.go +++ b/planner/optimizer.go @@ -527,7 +527,8 @@ outer: // - given a query SELECT ... WHERE a = 1 AND b > 2 // - the paths a and b are contiguous in the index definition, this index can be used // - given a query SELECT ... WHERE a = 1 AND c > 2 - // - the paths a and c are not contiguous in the index definition, this index cannot be used + // - the paths a and c are not contiguous in the index definition, this index cannot be used for both values + // but it will be used with a and c with a normal filter node. var fops []*stream.FilterOperator var usableFilterNodes []*filterNode contiguous := true diff --git a/query/reindex_test.go b/query/reindex_test.go index 5fbe38103..a4a0721ed 100644 --- a/query/reindex_test.go +++ b/query/reindex_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/genjidb/genji" - "github.com/genjidb/genji/document" "github.com/stretchr/testify/require" ) @@ -82,7 +81,7 @@ func TestReIndex(t *testing.T) { } i := 0 - err = idx.AscendGreaterOrEqual([]document.Value{document.Value{}}, func(val []byte, key []byte) error { + err = idx.AscendGreaterOrEqual(nil, func(val []byte, key []byte) error { i++ return nil })