本文整理汇总了C#中Lucene.Net.Index.IndexReader.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IndexReader.Dispose方法的具体用法?C# IndexReader.Dispose怎么用?C# IndexReader.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.IndexReader
的用法示例。
在下文中一共展示了IndexReader.Dispose方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloseIndexReader
private void CloseIndexReader(IndexReader myReader)
{
myReader.Close();
myReader.Dispose();
}
示例2: CloseQuietly
private static void CloseQuietly(IndexReader reader)
{
try
{
if (reader != null)
reader.Dispose();
}
catch (Exception e)
{
// do nothing
}
}
示例3: TestFieldNonExistent
public void TestFieldNonExistent()
{
try
{
indexReader = DirectoryReader.Open(store);
ld = new LuceneDictionary(indexReader, "nonexistent_field");
it = ld.EntryIterator;
assertNull("More elements than expected", spare = it.Next());
}
finally
{
if (indexReader != null) { indexReader.Dispose(); }
}
}
示例4: TestSpellchecker
public void TestSpellchecker()
{
Directory dir = NewDirectory();
SpellChecker sc = new SpellChecker(dir);
indexReader = DirectoryReader.Open(store);
sc.IndexDictionary(new LuceneDictionary(indexReader, "contents"), NewIndexWriterConfig(TEST_VERSION_CURRENT, null), false);
string[] suggestions = sc.SuggestSimilar("Tam", 1);
assertEquals(1, suggestions.Length);
assertEquals("Tom", suggestions[0]);
suggestions = sc.SuggestSimilar("Jarry", 1);
assertEquals(1, suggestions.Length);
assertEquals("Jerry", suggestions[0]);
indexReader.Dispose();
sc.Dispose();
dir.Dispose();
}
示例5: TestFieldZzz
public void TestFieldZzz()
{
try
{
indexReader = DirectoryReader.Open(store);
ld = new LuceneDictionary(indexReader, "zzz");
it = ld.EntryIterator;
assertNotNull("First element doesn't exist.", spare = it.Next());
assertEquals("First element isn't correct", "bar", spare.Utf8ToString());
assertNull("More elements than expected", it.Next());
}
finally
{
if (indexReader != null) { indexReader.Dispose(); }
}
}
示例6: TestFieldContents_2
public void TestFieldContents_2()
{
try
{
indexReader = DirectoryReader.Open(store);
ld = new LuceneDictionary(indexReader, "contents");
it = ld.EntryIterator;
// just iterate through words
assertEquals("First element isn't correct", "Jerry", it.Next().Utf8ToString());
assertEquals("Second element isn't correct", "Tom", it.Next().Utf8ToString());
assertNull("Nonexistent element is really null", it.Next());
}
finally
{
if (indexReader != null) { indexReader.Dispose(); }
}
}
示例7: TestFieldContents_1
public void TestFieldContents_1()
{
try
{
indexReader = DirectoryReader.Open(store);
ld = new LuceneDictionary(indexReader, "contents");
it = ld.EntryIterator;
assertNotNull("First element doesn't exist.", spare = it.Next());
assertTrue("First element isn't correct", spare.Utf8ToString().equals("Jerry"));
assertNotNull("Second element doesn't exist.", spare = it.Next());
assertTrue("Second element isn't correct", spare.Utf8ToString().equals("Tom"));
assertNull("More elements than expected", it.Next());
ld = new LuceneDictionary(indexReader, "contents");
it = ld.EntryIterator;
int counter = 2;
while (it.Next() != null)
{
counter--;
}
assertTrue("Number of words incorrect", counter == 0);
}
finally
{
if (indexReader != null) { indexReader.Dispose(); }
}
}