mirror of
https://github.com/apache/lucene.git
synced 2025-02-10 20:15:18 +00:00
LUCENE-7247: TestCoreParser.dumpResults verbose and test-fail logging tweaks
This commit is contained in:
parent
4ea4adc210
commit
fe1ad19af3
@ -221,13 +221,15 @@ public class TestCoreParser extends LuceneTestCase {
|
||||
|
||||
protected void dumpResults(String qType, Query q, int numDocs) throws IOException {
|
||||
if (VERBOSE) {
|
||||
System.out.println("TEST: qType=" + qType + " query=" + q + " numDocs=" + numDocs);
|
||||
System.out.println("TEST: qType=" + qType + " numDocs=" + numDocs + " " + q.getClass().getCanonicalName() + " query=" + q);
|
||||
}
|
||||
final IndexSearcher searcher = searcher();
|
||||
TopDocs hits = searcher.search(q, numDocs);
|
||||
assertTrue(qType + " should produce results ", hits.totalHits > 0);
|
||||
final boolean producedResults = (hits.totalHits > 0);
|
||||
if (!producedResults) {
|
||||
System.out.println("TEST: qType=" + qType + " numDocs=" + numDocs + " " + q.getClass().getCanonicalName() + " query=" + q);
|
||||
}
|
||||
if (VERBOSE) {
|
||||
System.out.println("=========" + qType + "============");
|
||||
ScoreDoc[] scoreDocs = hits.scoreDocs;
|
||||
for (int i = 0; i < Math.min(numDocs, hits.totalHits); i++) {
|
||||
Document ldoc = searcher.doc(scoreDocs[i].doc);
|
||||
@ -235,5 +237,6 @@ public class TestCoreParser extends LuceneTestCase {
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
assertTrue(qType + " produced no results", producedResults);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user