Skip to content

Apache Lucene open-source search software

Fix test failure because of wrong cast. Hard stuff :( Could be implemented better, the hq is used for 2 different types

Uwe Schindlerbede45aaa313
diff --git a/src/java/org/apache/lucene/search/ParallelMultiSearcher.java b/src/java/org/apache/lucene/search/ParallelMultiSearcher.java
index 1d78087f5a0..3225849f6e4 100644
--- a/src/java/org/apache/lucene/search/ParallelMultiSearcher.java
+++ b/src/java/org/apache/lucene/search/ParallelMultiSearcher.java
@@ -199,7 +199,7 @@ class MultiSearcherThread extends Thread {
private int nDocs;
private TopDocs docs;
private int i;
- private PriorityQueue<?> hq;
+ private PriorityQueue<? extends ScoreDoc> hq;
private int[] starts;
private IOException ioe;
private Sort sort;
@@ -230,6 +230,7 @@ class MultiSearcherThread extends Thread {
this.sort = sort;
}
+ @SuppressWarnings ("unchecked")
public void run() {
try {
docs = (sort == null) ? searchable.search (weight, filter, nDocs)
@@ -266,7 +267,7 @@ class MultiSearcherThread extends Thread {
scoreDoc.doc += starts[i]; // convert doc
//it would be so nice if we had a thread-safe insert
synchronized (hq) {
- if (scoreDoc == ((HitQueue) hq).insertWithOverflow(scoreDoc))
+ if (scoreDoc == ((PriorityQueue<ScoreDoc>) hq).insertWithOverflow(scoreDoc))
break;
} // no more scores > minScore
}