How to create an index with Distinct operation. RavenDB
===

What I need is to simply retrieve a list of categories stored in products:

`Products.Select(x => x.Category).Distinct().OrderBy(x => x);`

When invoking this `RavenDB` says that I should use indexes instead cause computations aren't allowed during queries.

I have read a bit about indexes but still can't figure it out howcome I create an index?

What I have tried so far is:

**Initialization**

    public class DataAccessModule : NinjectModule {
        public override void Load() {
            Bind<IDocumentStore>().ToMethod(
                context => {
                   var documentStore = new EmbeddableDocumentStore {
                       DataDirectory = @"~/App_Data/database",
                       UseEmbeddedHttpServer = true,
                       DefaultDatabase = "SampleStore"
                   };
                   var store = documentStore.Initialize();
                   IndexCreation.CreateIndexes(typeof(CategoriesIndex).Assembly, store);
                   return store;
               }
           ).InSingletonScope();

            Bind<IDocumentSession>().ToMethod(context => 
                context.Kernel.Get<IDocumentStore>().OpenSession()
            ).InRequestScope();
        }
    }

**Index definition**

    public class CategoriesIndex : AbstractIndexCreationTask<Product> {
        public CategoriesIndex() {
            Map = ct => ct.Select(x => x.Categories).Distinct().OrderBy(x => x);
        }
    }

But this doesn't work.
Howcome I define it the right way?

Thanks!
