diff --git a/index.go b/index.go index a5cdd1911..04903cad5 100644 --- a/index.go +++ b/index.go @@ -394,10 +394,9 @@ func (i *Index) createFrame(name string, opt FrameOptions) (*Frame, error) { if opt.RangeEnabled { if opt.InverseEnabled { return nil, ErrInverseRangeNotAllowed - } else if opt.CacheType != "" && opt.CacheType != CacheTypeLRU { + } else if opt.CacheType != "" && opt.CacheType != CacheTypeNone { return nil, ErrRangeCacheNotAllowed } - opt.CacheSize = 0 } else { if len(opt.Fields) > 0 { return nil, ErrFrameFieldsNotAllowed diff --git a/index_test.go b/index_test.go index 2c23f7a40..d3e03ebc7 100644 --- a/index_test.go +++ b/index_test.go @@ -149,6 +149,18 @@ func TestIndex_CreateFrame(t *testing.T) { } }) + t.Run("RangeEnabledWithCacheTypeNone", func(t *testing.T) { + index := test.MustOpenIndex() + defer index.Close() + if _, err := index.CreateFrame("f", pilosa.FrameOptions{ + RangeEnabled: true, + CacheType: pilosa.CacheTypeNone, + CacheSize: uint32(5), + }); err != nil { + t.Fatal(err) + } + }) + t.Run("ErrFrameFieldsNotAllowed", func(t *testing.T) { index := test.MustOpenIndex() defer index.Close()