//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testShouldReturnIndexSearcherFromLRUCache() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestShouldReturnIndexSearcherFromLRUCache() { Config config = Config.defaults(); _dataSource = _life.add(GetLuceneDataSource(config)); IndexIdentifier identifier = identifier("foo"); IndexReference searcher = _dataSource.getIndexSearcher(identifier); assertSame(searcher, _dataSource.getIndexSearcher(identifier)); searcher.Close(); }
private void EnsureInstantiated(IndexIdentifier identifier) { try { IndexReference indexSearcher = GetIndexSearcher(identifier); indexSearcher.Close(); } catch (ExplicitIndexNotFoundKernelException) { // Ignore supposedly concurrently dropped indexes. } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testClosesOldestIndexSearcherWhenCacheSizeIsExceeded() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestClosesOldestIndexSearcherWhenCacheSizeIsExceeded() { AddIndex("bar"); AddIndex("baz"); Config config = Config.defaults(CacheSizeConfig()); _dataSource = _life.add(GetLuceneDataSource(config)); IndexIdentifier fooIdentifier = Identifier("foo"); IndexIdentifier barIdentifier = Identifier("bar"); IndexIdentifier bazIdentifier = Identifier("baz"); IndexReference fooSearcher = _dataSource.getIndexSearcher(fooIdentifier); IndexReference barSearcher = _dataSource.getIndexSearcher(barIdentifier); assertFalse(fooSearcher.Closed); IndexReference bazSearcher = _dataSource.getIndexSearcher(bazIdentifier); assertTrue(fooSearcher.Closed); barSearcher.Close(); bazSearcher.Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testRecreatesSearcherWhenRequestedAgain() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestRecreatesSearcherWhenRequestedAgain() { AddIndex("bar"); AddIndex("baz"); Config config = Config.defaults(CacheSizeConfig()); _dataSource = _life.add(GetLuceneDataSource(config)); IndexIdentifier fooIdentifier = Identifier("foo"); IndexIdentifier barIdentifier = Identifier("bar"); IndexIdentifier bazIdentifier = Identifier("baz"); IndexReference oldFooSearcher = _dataSource.getIndexSearcher(fooIdentifier); IndexReference barSearcher = _dataSource.getIndexSearcher(barIdentifier); IndexReference bazSearcher = _dataSource.getIndexSearcher(bazIdentifier); IndexReference newFooSearcher = _dataSource.getIndexSearcher(bazIdentifier); assertNotSame(oldFooSearcher, newFooSearcher); assertFalse(newFooSearcher.Closed); oldFooSearcher.Close(); barSearcher.Close(); bazSearcher.Close(); newFooSearcher.Close(); }