//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testHeavyPreTokenization() throws java.io.IOException public virtual void testHeavyPreTokenization() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int minGram = org.apache.lucene.util.TestUtil.nextInt(random(), 1, 100); int minGram = TestUtil.Next(random(), 1, 100); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int maxGram = org.apache.lucene.util.TestUtil.nextInt(random(), minGram, 100); int maxGram = TestUtil.Next(random(), minGram, 100); testNGrams(minGram, maxGram, TestUtil.Next(random(), 0, 4 * 1024), "abcdef"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testLargeMaxGram() throws java.io.IOException public virtual void testLargeMaxGram() { // test sliding with maxGram > 1024 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int minGram = org.apache.lucene.util.TestUtil.nextInt(random(), 1290, 1300); int minGram = TestUtil.Next(random(), 1290, 1300); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int maxGram = org.apache.lucene.util.TestUtil.nextInt(random(), minGram, 1300); int maxGram = TestUtil.Next(random(), minGram, 1300); testNGrams(minGram, maxGram, TestUtil.Next(random(), 3 * 1024, 4 * 1024), ""); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testFullUTF8Range() throws java.io.IOException public virtual void testFullUTF8Range() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int minGram = org.apache.lucene.util.TestUtil.nextInt(random(), 1, 100); int minGram = TestUtil.Next(random(), 1, 100); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int maxGram = org.apache.lucene.util.TestUtil.nextInt(random(), minGram, 100); int maxGram = TestUtil.Next(random(), minGram, 100); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String s = org.apache.lucene.util.TestUtil.randomUnicodeString(random(), 4 * 1024); string s = TestUtil.randomUnicodeString(random(), 4 * 1024); testNGrams(minGram, maxGram, s, ""); testNGrams(minGram, maxGram, s, "abcdef"); }
/// <summary> /// blast some random strings through the analyzer </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testRandomStrings() throws Exception public virtual void testRandomStrings() { for (int i = 0; i < 10; i++) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int min = org.apache.lucene.util.TestUtil.nextInt(random(), 2, 10); int min = TestUtil.Next(random(), 2, 10); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int max = org.apache.lucene.util.TestUtil.nextInt(random(), min, 20); int max = TestUtil.Next(random(), min, 20); Analyzer a = new AnalyzerAnonymousInnerClassHelper(this, min, max); checkRandomData(random(), a, 200 * RANDOM_MULTIPLIER, 20); checkRandomData(random(), a, 10 * RANDOM_MULTIPLIER, 1027); } }
/* * public void testPerFieldAnalyzer() throws Exception { * PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new SimpleAnalyzer(TEST_VERSION_CURRENT)); * analyzer.addAnalyzer("partnum", new KeywordAnalyzer()); * * QueryParser queryParser = new QueryParser(TEST_VERSION_CURRENT, "description", analyzer); * Query query = queryParser.parse("partnum:Q36 AND SPACE"); * * ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs; * assertEquals("Q36 kept as-is", * "+partnum:Q36 +space", query.toString("description")); * assertEquals("doc found!", 1, hits.length); * } */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testMutipleDocument() throws Exception public virtual void testMutipleDocument() { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new KeywordAnalyzer())); Document doc = new Document(); doc.add(new TextField("partnum", "Q36", Field.Store.YES)); writer.addDocument(doc); doc = new Document(); doc.add(new TextField("partnum", "Q37", Field.Store.YES)); writer.addDocument(doc); writer.close(); IndexReader reader = DirectoryReader.open(dir); DocsEnum td = TestUtil.docs(random(), reader, "partnum", new BytesRef("Q36"), MultiFields.getLiveDocs(reader), null, 0); assertTrue(td.nextDoc() != DocIdSetIterator.NO_MORE_DOCS); td = TestUtil.docs(random(), reader, "partnum", new BytesRef("Q37"), MultiFields.getLiveDocs(reader), null, 0); assertTrue(td.nextDoc() != DocIdSetIterator.NO_MORE_DOCS); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testFewTokenChars() throws java.io.IOException public virtual void testFewTokenChars() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final char[] chrs = new char[org.apache.lucene.util.TestUtil.nextInt(random(), 4000, 5000)]; char[] chrs = new char[TestUtil.Next(random(), 4000, 5000)]; Arrays.fill(chrs, ' '); for (int i = 0; i < chrs.Length; ++i) { if (random().nextFloat() < 0.1) { chrs[i] = 'a'; } } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int minGram = org.apache.lucene.util.TestUtil.nextInt(random(), 1, 2); int minGram = TestUtil.Next(random(), 1, 2); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int maxGram = org.apache.lucene.util.TestUtil.nextInt(random(), minGram, 2); int maxGram = TestUtil.Next(random(), minGram, 2); testNGrams(minGram, maxGram, new string(chrs), " "); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testRandomStrings() throws java.io.IOException public virtual void testRandomStrings() { for (int i = 0; i < 10000; i++) { string text = TestUtil.randomUnicodeString(random(), 100); int min = TestUtil.Next(random(), 0, 100); int max = TestUtil.Next(random(), 0, 100); int count = text.codePointCount(0, text.Length); if (min > max) { int temp = min; min = max; max = temp; } bool expected = count >= min && count <= max; TokenStream stream = new KeywordTokenizer(new StringReader(text)); stream = new CodepointCountFilter(TEST_VERSION_CURRENT, stream, min, max); stream.reset(); assertEquals(expected, stream.incrementToken()); stream.end(); stream.close(); } }