Index: src/java/org/apache/lucene/search/FieldSortedHitQueue.java
===================================================================
--- src/java/org/apache/lucene/search/FieldSortedHitQueue.java	(revision 332055)
+++ src/java/org/apache/lucene/search/FieldSortedHitQueue.java	(working copy)
@@ -68,11 +68,19 @@
   /** Stores the sort criteria being used. */
   protected SortField[] fields;
 
-  /** Stores the maximum score value encountered, for normalizing.
-   *  we only care about scores greater than 1.0 - if all the scores
-   *  are less than 1.0, we don't have to normalize. */
-  protected float maxscore = 1.0f;
+  /** Stores the maximum score value encountered, needed for normalizing. */
+  protected float maxscore = Float.NEGATIVE_INFINITY;
 
+  /** returns the maximum score encountered by elements inserted via insert()
+   */
+  public float getMaxScore() {
+    return maxscore;
+  }
+
+  public boolean insert(FieldDoc fdoc) {
+    maxscore = Math.max(maxscore,fdoc.score);
+    return super.insert(fdoc);
+  }
 
   /**
    * Returns whether <code>a</code> is less relevant than <code>b</code>.
@@ -84,10 +92,6 @@
     final ScoreDoc docA = (ScoreDoc) a;
     final ScoreDoc docB = (ScoreDoc) b;
 
-    // keep track of maximum score
-    if (docA.score > maxscore) maxscore = docA.score;
-    if (docB.score > maxscore) maxscore = docB.score;
-
     // run comparators
     final int n = comparators.length;
     int c = 0;
Index: src/test/org/apache/lucene/search/TestSort.java
===================================================================
--- src/test/org/apache/lucene/search/TestSort.java	(revision 332135)
+++ src/test/org/apache/lucene/search/TestSort.java	(working copy)
@@ -449,6 +449,9 @@
 	}
 
   public void testTopDocsScores() throws Exception {
+
+    // There was previously a bug in FieldSortedHitQueue.maxscore when only a single
+    // doc was added.  That is what the following tests for.
     Sort sort = new Sort();
     int nDocs=10;
 
@@ -467,10 +470,7 @@
 
     TopDocs docs2 = full.search(queryE, filt, nDocs, sort);
 
-    // This test currently fails because of a bug in FieldSortedHitQueue
-    // with a single document matching.
-    // TODO: uncomment when fixed.
-    // assertEquals(docs1.scoreDocs[0].score, docs2.scoreDocs[0].score, 1e-6);
+    assertEquals(docs1.scoreDocs[0].score, docs2.scoreDocs[0].score, 1e-6);
   }
 
 
