本文整理汇总了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());
}
示例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));
}
示例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);
}
示例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}}});
}
示例5: BackupRestore
public BackupRestore()
{
db = new DocumentDatabase(new RavenConfiguration
{
DataDirectory = DataDir,
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false
});
db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
}
示例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();
}
示例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()
});
}
示例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());
}
示例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()));
}
示例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());
}
示例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 };
"
});
}
示例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 };
"
});
}
示例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 };
"
});
}
示例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}"
});
}
示例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}"
});
}