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


C# IndexReader.Dispose方法代码示例

本文整理汇总了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();
 }
开发者ID:anukat2015,项目名称:sones,代码行数:5,代码来源:LuceneIndex.cs

示例2: CloseQuietly

 private static void CloseQuietly(IndexReader reader)
 {
     try
     {
         if (reader != null)
             reader.Dispose();
     }
     catch (Exception e)
     {
         // do nothing
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:12,代码来源:DataSplitterTest.cs

示例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(); }
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:16,代码来源:TestLuceneDictionary.cs

示例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();
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:16,代码来源:TestLuceneDictionary.cs

示例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(); }
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:18,代码来源:TestLuceneDictionary.cs

示例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(); }
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:19,代码来源:TestLuceneDictionary.cs

示例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(); }
            }
        }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:31,代码来源:TestLuceneDictionary.cs


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