//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testCharFilters() throws Exception public virtual void testCharFilters() { Analyzer a = new AnalyzerAnonymousInnerClassHelper(this); assertAnalyzesTo(a, "ab", new string[] {"aab"}, new int[] {0}, new int[] {2}); // now wrap in PFAW PerFieldAnalyzerWrapper p = new PerFieldAnalyzerWrapper(a, System.Linq.Enumerable.Empty<string, Analyzer>()); assertAnalyzesTo(p, "ab", new string[] {"aab"}, new int[] {0}, new int[] {2}); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testCharFilters() throws Exception public virtual void testCharFilters() { Analyzer a = new AnalyzerAnonymousInnerClassHelper(this); assertAnalyzesTo(a, "ab", new string[] { "aab" }, new int[] { 0 }, new int[] { 2 }); // now wrap in PFAW PerFieldAnalyzerWrapper p = new PerFieldAnalyzerWrapper(a, System.Linq.Enumerable.Empty <string, Analyzer>()); assertAnalyzesTo(p, "ab", new string[] { "aab" }, new int[] { 0 }, new int[] { 2 }); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testPerField() throws Exception public virtual void testPerField() { string text = "Qwerty"; IDictionary <string, Analyzer> analyzerPerField = new Dictionary <string, Analyzer>(); analyzerPerField["special"] = new SimpleAnalyzer(TEST_VERSION_CURRENT); PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer(TEST_VERSION_CURRENT), analyzerPerField); TokenStream tokenStream = analyzer.tokenStream("field", text); try { CharTermAttribute termAtt = tokenStream.getAttribute(typeof(CharTermAttribute)); tokenStream.reset(); assertTrue(tokenStream.incrementToken()); assertEquals("WhitespaceAnalyzer does not lowercase", "Qwerty", termAtt.ToString()); assertFalse(tokenStream.incrementToken()); tokenStream.end(); } finally { IOUtils.closeWhileHandlingException(tokenStream); } tokenStream = analyzer.tokenStream("special", text); try { CharTermAttribute termAtt = tokenStream.getAttribute(typeof(CharTermAttribute)); tokenStream.reset(); assertTrue(tokenStream.incrementToken()); assertEquals("SimpleAnalyzer lowercases", "qwerty", termAtt.ToString()); assertFalse(tokenStream.incrementToken()); tokenStream.end(); } finally { IOUtils.closeWhileHandlingException(tokenStream); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testPerField() throws Exception public virtual void testPerField() { string text = "Qwerty"; IDictionary<string, Analyzer> analyzerPerField = new Dictionary<string, Analyzer>(); analyzerPerField["special"] = new SimpleAnalyzer(TEST_VERSION_CURRENT); PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer(TEST_VERSION_CURRENT), analyzerPerField); TokenStream tokenStream = analyzer.tokenStream("field", text); try { CharTermAttribute termAtt = tokenStream.getAttribute(typeof(CharTermAttribute)); tokenStream.reset(); assertTrue(tokenStream.incrementToken()); assertEquals("WhitespaceAnalyzer does not lowercase", "Qwerty", termAtt.ToString()); assertFalse(tokenStream.incrementToken()); tokenStream.end(); } finally { IOUtils.closeWhileHandlingException(tokenStream); } tokenStream = analyzer.tokenStream("special", text); try { CharTermAttribute termAtt = tokenStream.getAttribute(typeof(CharTermAttribute)); tokenStream.reset(); assertTrue(tokenStream.incrementToken()); assertEquals("SimpleAnalyzer lowercases", "qwerty", termAtt.ToString()); assertFalse(tokenStream.incrementToken()); tokenStream.end(); } finally { IOUtils.closeWhileHandlingException(tokenStream); } }