You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by eh...@apache.org on 2003/10/23 04:20:04 UTC
cvs commit: jakarta-lucene/src/test/org/apache/lucene TestSearch.java TestSearchForDuplicates.java
ehatcher 2003/10/22 19:20:04
Modified: src/test/org/apache/lucene TestSearch.java
TestSearchForDuplicates.java
Log:
remove System.out.printlns from tests
Revision Changes Path
1.2 +12 -12 jakarta-lucene/src/test/org/apache/lucene/TestSearch.java
Index: TestSearch.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/TestSearch.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSearch.java 25 Sep 2003 22:01:51 -0000 1.1
+++ TestSearch.java 23 Oct 2003 02:20:04 -0000 1.2
@@ -82,13 +82,13 @@
/** This test performs a number of searches. It also compares output
* of searches using multi-file index segments with single-file
- * index segments.
- *
+ * index segments.
+ *
* TODO: someone should check that the results of the searches are
* still correct by adding assert statements. Right now, the test
* passes if the results are the same between multi-file and
* single-file formats, even if the results are wrong.
- */
+ */
public void testSearch() throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
@@ -96,28 +96,28 @@
pw.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
- System.out.println(multiFileOutput);
-
+ //System.out.println(multiFileOutput);
+
sw = new StringWriter();
pw = new PrintWriter(sw, true);
doTestSearch(pw, true);
pw.close();
sw.close();
String singleFileOutput = sw.getBuffer().toString();
-
+
assertEquals(multiFileOutput, singleFileOutput);
}
-
-
+
+
private void doTestSearch(PrintWriter out, boolean useCompoundFile)
throws Exception
{
- Directory directory = new RAMDirectory();
+ Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true);
writer.setUseCompoundFile(useCompoundFile);
-
+
String[] docs = {
"a b c d e",
"a b c d e a b c d e",
@@ -135,7 +135,7 @@
writer.close();
Searcher searcher = new IndexSearcher(directory);
-
+
String[] queries = {
"a b",
"\"a b\"",
1.2 +13 -13 jakarta-lucene/src/test/org/apache/lucene/TestSearchForDuplicates.java
Index: TestSearchForDuplicates.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/TestSearchForDuplicates.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSearchForDuplicates.java 25 Sep 2003 22:01:51 -0000 1.1
+++ TestSearchForDuplicates.java 23 Oct 2003 02:20:04 -0000 1.2
@@ -80,7 +80,7 @@
public static void main(String args[]) {
TestRunner.run (new TestSuite(TestSearchForDuplicates.class));
}
-
+
static final String PRIORITY_FIELD ="priority";
@@ -89,10 +89,10 @@
static final String MED_PRIORITY ="medium";
static final String LOW_PRIORITY ="low";
-
+
/** This test compares search results when using and not using compound
- * files.
- *
+ * files.
+ *
* TODO: There is rudimentary search result validation as well, but it is
* simply based on asserting the output observed in the old test case,
* without really knowing if the output is correct. Someone needs to
@@ -105,26 +105,26 @@
pw.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
- System.out.println(multiFileOutput);
-
+ //System.out.println(multiFileOutput);
+
sw = new StringWriter();
pw = new PrintWriter(sw, true);
doTest(pw, true);
pw.close();
sw.close();
String singleFileOutput = sw.getBuffer().toString();
-
+
assertEquals(multiFileOutput, singleFileOutput);
}
-
-
+
+
private void doTest(PrintWriter out, boolean useCompoundFiles) throws Exception {
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true);
writer.setUseCompoundFile(useCompoundFiles);
-
+
final int MAX_DOCS = 225;
for (int j = 0; j < MAX_DOCS; j++) {
@@ -166,7 +166,7 @@
searcher.close();
}
-
+
private void printHits(PrintWriter out, Hits hits ) throws IOException {
out.println(hits.length() + " total results\n");
for (int i = 0 ; i < hits.length(); i++) {
@@ -176,7 +176,7 @@
}
}
}
-
+
private void checkHits(Hits hits, int expectedCount) throws IOException {
assertEquals("total results", expectedCount, hits.length());
for (int i = 0 ; i < hits.length(); i++) {
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org