From 9d697a8891d835e1566fd4f69df331f38d7048f2 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Tue, 26 Jan 2016 08:58:03 +0000 Subject: [PATCH] internal/charmstore: add more indexes --- internal/charmstore/store.go | 10 ++++++++++ internal/charmstore/store_test.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/charmstore/store.go b/internal/charmstore/store.go index 7caf5ed73..7c3d3fc13 100644 --- a/internal/charmstore/store.go +++ b/internal/charmstore/store.go @@ -390,9 +390,19 @@ func (s *Store) ensureIndexes() error { }, { s.DB.Entities(), mgo.Index{Key: []string{"bundlecharms"}}, + }, { + s.DB.Entities(), + mgo.Index{Key: []string{"name", "development", "-promulgated-revision", "-supportedseries"}}, + }, { + s.DB.Entities(), + mgo.Index{Key: []string{"name", "development", "user", "-revision", "-supportedseries"}}, }, { s.DB.BaseEntities(), mgo.Index{Key: []string{"name"}}, + }, { + // TODO this index should be created by the mgo gridfs code. + s.DB.C("entitystore.files"), + mgo.Index{Key: []string{"filename"}}, }} for _, idx := range indexes { err := idx.c.EnsureIndex(idx.i) diff --git a/internal/charmstore/store_test.go b/internal/charmstore/store_test.go index 9ff109857..65e49c56d 100644 --- a/internal/charmstore/store_test.go +++ b/internal/charmstore/store_test.go @@ -1542,7 +1542,7 @@ func (s *StoreSuite) TestCollections(c *gc.C) { } // Check that all created collections are mentioned in Collections. for _, name := range names { - if name == "system.indexes" || name == "managedStoredResources" { + if name == "system.indexes" || name == "managedStoredResources" || name == "entitystore.files" { continue } found := false