当前位置: 首页>>代码示例>>C#>>正文


C# DocumentDatabase.PutIndex方法代码示例

本文整理汇总了C#中Raven.Database.DocumentDatabase.PutIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentDatabase.PutIndex方法的具体用法?C# DocumentDatabase.PutIndex怎么用?C# DocumentDatabase.PutIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Database.DocumentDatabase的用法示例。


在下文中一共展示了DocumentDatabase.PutIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryingOnStaleIndexes

		public QueryingOnStaleIndexes()
		{
			db = new DocumentDatabase(new RavenConfiguration { DataDirectory = "raven.db.test.esent", RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true });
			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		

		}
开发者ID:philiphoy,项目名称:ravendb,代码行数:7,代码来源:QueryingOnStaleIndexes.cs

示例2: Execute

		public void Execute(DocumentDatabase database)
		{
			Database = database;


			var indexDefinition = database.GetIndexDefinition(RavenDocumentsByExpirationDate);
			if (indexDefinition == null)
			{
				database.PutIndex(RavenDocumentsByExpirationDate,
								  new IndexDefinition
								  {
									  Map =
										  @"
	from doc in docs
	let expiry = doc[""@metadata""][""Raven-Expiration-Date""]
	where expiry != null
	select new { Expiry = expiry }
"
								  });
			}

			var deleteFrequencyInSeconds = database.Configuration.GetConfigurationValue<int>("Raven/Expiration/DeleteFrequencySeconds") ?? 300;
			logger.Info("Initialized expired document cleaner, will check for expired documents every {0} seconds",
						deleteFrequencyInSeconds);
			timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(deleteFrequencyInSeconds), TimeSpan.FromSeconds(deleteFrequencyInSeconds));

		}
开发者ID:fschwiet,项目名称:ravendb,代码行数:27,代码来源:ExpiredDocumentsCleaner.cs

示例3: Execute

        public void Execute(DocumentDatabase database)
        {
            if (!database.IsBundleActive("IndexedAttachments"))
                return;

            var index = new IndexDefinition
                        {
                            Map = @"from doc in docs
            where doc[""@metadata""][""Raven-Attachment-Key""] != null
            select new
            {
            AttachmentKey = doc[""@metadata""][""Raven-Attachment-Key""],
            Filename = doc[""@metadata""][""Raven-Attachment-Filename""],
            Text = doc.Text
            }",
                            TransformResults = @"from result in results
            select new
            {
            AttachmentKey = result[""@metadata""][""Raven-Attachment-Key""],
            Filename = result[""@metadata""][""Raven-Attachment-Filename""]
            }"
                        };

            // NOTE: The transform above is specifically there to keep the Text property
            //       from being returned.  The results could get very large otherwise.

            index.Indexes.Add("Text", FieldIndexing.Analyzed);
            index.Stores.Add("Text", FieldStorage.Yes);
            index.TermVectors.Add("Text", FieldTermVector.WithPositionsAndOffsets);

            database.PutIndex("Raven/Attachments", index);
        }
开发者ID:tzarger,项目名称:contrib,代码行数:32,代码来源:Startup.cs

示例4: MapReduce_IndependentSteps

		public MapReduce_IndependentSteps()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
			});
			db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.NotAnalyzed}}});
		}
开发者ID:jtmueller,项目名称:ravendb,代码行数:9,代码来源:MapReduce_IndependentSteps.cs

示例5: BackupRestore

		public BackupRestore()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false
			});
			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		}
开发者ID:neiz,项目名称:ravendb,代码行数:9,代码来源:BackupRestore.cs

示例6: MapReduce

 public MapReduce()
 {
     db = new DocumentDatabase(new RavenConfiguration
     {
         DataDirectory = "raven.db.test.esent",
         RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
     });
     db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.NotAnalyzed}}});
     db.SpinBackgroundWorkers();
 }
开发者ID:vinone,项目名称:ravendb,代码行数:10,代码来源:MapReduce.cs

示例7: MapReduce

        public MapReduce()
        {
            db = new DocumentDatabase(new RavenConfiguration {DataDirectory = "raven.db.test.esent"});
            db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.Untokenized}}});
            db.SpinBackgroundWorkers();

            BasicConfigurator.Configure(
                new OutputDebugStringAppender
                {
                    Layout = new SimpleLayout()
                });
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:12,代码来源:MapReduce.cs

示例8: IncrementalBackupRestore

		public IncrementalBackupRestore()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = "raven.db.test.esent",
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false,
				Settings =
					{
						{"Raven/Esent/CircularLog", "false"}
					}
			});
			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		}
开发者ID:runesoerensen,项目名称:ravendb,代码行数:13,代码来源:IncrementalBackupRestore.cs

示例9: IncrementalBackupWithCircularLogThrows

		public void IncrementalBackupWithCircularLogThrows()
		{
			db.Dispose();
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false,
			});

			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		
			db.Put("ayende", null, RavenJObject.Parse("{'email':'[email protected]'}"), new RavenJObject(), null);

			Assert.Throws<InvalidOperationException>(() => db.StartBackup(BackupDir, true, new DatabaseDocument()));
		}
开发者ID:925coder,项目名称:ravendb,代码行数:15,代码来源:IncrementalBackupRestore.cs

示例10: RavenDB_1007_incremental_backup

		public RavenDB_1007_incremental_backup()
		{
			IOExtensions.DeleteDirectory(BackupDir);

			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false,
				Settings =
					{
						{"Raven/Esent/CircularLog", "false"}
					}
			});
			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		}
开发者ID:nberardi,项目名称:ravendb,代码行数:15,代码来源:RavenDB_1007.cs

示例11: Statistics

        public Statistics()
        {
            db = new DocumentDatabase(new RavenConfiguration {DataDirectory = "raven.db.test.esent"});
            db.SpinBackgroundWorkers();

            db.PutIndex("pagesByTitle2",
                        new IndexDefinition
                        {
                            Map = @"
                    from doc in docs
                    where doc.type == ""page""
                    select new {  f = 2 / doc.size };
                "
                        });
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:15,代码来源:Statistics.cs

示例12: Statistics

		public Statistics()
		{
			store = NewDocumentStore();
			db = store.DocumentDatabase;

			db.PutIndex("pagesByTitle2",
						new IndexDefinition
						{
							Map = @"
					from doc in docs
					where doc.type == ""page""
					select new {  f = 2 / doc.size };
				"
						});
		}
开发者ID:robashton,项目名称:ravendb,代码行数:15,代码来源:Statistics.cs

示例13: Statistics

        public Statistics()
        {
            db = new DocumentDatabase(new RavenConfiguration {DataDirectory = "raven.db.test.esent", RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true});
            db.SpinBackgroundWorkers();

            db.PutIndex("pagesByTitle2",
                        new IndexDefinition
                        {
                            Map = @"
                    from doc in docs
                    where doc.type == ""page""
                    select new {  f = 2 / doc.size };
                "
                        });
        }
开发者ID:kenegozi,项目名称:ravendb,代码行数:15,代码来源:Statistics.cs

示例14: ReadTriggers

		public ReadTriggers()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				RunInMemory = true,
				Container = new CompositionContainer(new TypeCatalog(
					typeof(VetoReadsOnCapitalNamesTrigger),
					typeof(HiddenDocumentsTrigger),
					typeof(UpperCaseNamesTrigger)))
			});
			db.PutIndex("ByName",
						new IndexDefinition
						{
							Map = "from doc in docs select new{ doc.name}"
						});
		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:16,代码来源:ReadTriggers.cs

示例15: ReadTriggers

		public ReadTriggers()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = "raven.db.test.esent",
				Container = new CompositionContainer(new TypeCatalog(
					typeof(VetoReadsOnCapitalNamesTrigger),
					typeof(HiddenDocumentsTrigger),
					typeof(UpperCaseNamesTrigger)))
			});
			db.SpinBackgroundWorkers();
			db.PutIndex("ByName",
			            new IndexDefinition
			            {
			            	Map = "from doc in docs select new{ doc.name}"
			            });
		}
开发者ID:dplaskon,项目名称:ravendb,代码行数:17,代码来源:ReadTriggers.cs


注:本文中的Raven.Database.DocumentDatabase.PutIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。