本文整理汇总了C#中Lucene.OpenInput方法的典型用法代码示例。如果您正苦于以下问题:C# Lucene.OpenInput方法的具体用法?C# Lucene.OpenInput怎么用?C# Lucene.OpenInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene
的用法示例。
在下文中一共展示了Lucene.OpenInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureIndexVersionMatches
private static void EnsureIndexVersionMatches(Lucene.Net.Store.Directory directory, IndexDefinition indexDefinition)
{
var versionToCheck = IndexVersion;
if (indexDefinition.IsMapReduce)
{
versionToCheck = MapReduceIndexVersion;
}
var indexVersion = IndexVersionFileName(indexDefinition);
if (directory.FileExists(indexVersion) == false)
{
throw new InvalidOperationException("Could not find " + indexVersion + " " + indexDefinition.IndexId + ", resetting index");
}
using (var indexInput = directory.OpenInput(indexVersion))
{
var versionFromDisk = indexInput.ReadString();
if (versionFromDisk != versionToCheck)
throw new InvalidOperationException("Index " + indexDefinition.IndexId + " is of version " + versionFromDisk +
" which is not compatible with " + versionToCheck + ", resetting index");
}
}
示例2: EnsureIndexVersionMatches
private static void EnsureIndexVersionMatches(string indexName, Lucene.Net.Store.Directory directory)
{
if (directory.FileExists("index.version") == false)
{
throw new InvalidOperationException("Could not find index.version " + indexName + ", resetting index");
}
using(var indexInput = directory.OpenInput("index.version"))
{
var versionFromDisk = indexInput.ReadString();
if (versionFromDisk != IndexVersion)
throw new InvalidOperationException("Index " + indexName + " is of version " + versionFromDisk +
" which is not compatible with " + IndexVersion + ", resetting index");
}
}