Ejemplo n.º 1
0
        public void CanSpecifyMaxNumberOfOutputsForMapIndexByUsingIndexCreationTask()
        {
            using (var store = NewDocumentStore())
            {
                var index = new MaxNumberOfOutputs_MapIndex();
                store.ExecuteIndex(index);

                var indexDefinition = store.DatabaseCommands.GetIndex(index.IndexName);

                Assert.Equal(20, indexDefinition.MaxIndexOutputsPerDocument);
            }
        }
Ejemplo n.º 2
0
        public void MaxIndexOutputsPerDocumentSpecifiedForIndexTakesPriorityDuringIndexing()
        {
            using (var store = NewDocumentStore())
            {
                var index = new MaxNumberOfOutputs_MapIndex();
                store.ExecuteIndex(index);

                var item = new Item()
                {
                    Foo   = "foo",
                    Bazes = new List <string>()
                };

                var globalLimit = store.DocumentDatabase.Configuration.MaxIndexOutputsPerDocument;

                Assert.True(index.MaxIndexOutputsPerDocument > globalLimit);                 // index limit should be greater than a global one

                var moreThanGlobalLimit = globalLimit + 1;

                Assert.True(moreThanGlobalLimit <= index.MaxIndexOutputsPerDocument);                 // we are going to produce fewer number of entries than the index limit

                for (int i = 0; i < moreThanGlobalLimit; i++)
                {
                    item.Bazes.Add("baz/" + i.ToString());
                }

                using (var session = store.OpenSession())
                {
                    session.Store(item);
                    session.SaveChanges();
                }

                WaitForIndexing(store);

                var stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.PublicName == index.IndexName);

                Assert.Equal(IndexingPriority.Normal, stats.Priority);                 // should not mark index as errored
            }
        }