lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject [3/8] lucene-solr:master: LUCENE-8430: TopDocs.totalHits may now be a lower bound of the hit count.
Date Mon, 30 Jul 2018 16:21:30 GMT
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
index e6d7062..2bb4f71 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
@@ -130,7 +130,7 @@ public class TestSuggestField extends LuceneTestCase {
     SuggestIndexSearcher suggestIndexSearcher = new SuggestIndexSearcher(reader);
     PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "ab"));
     TopSuggestDocs lookupDocs = suggestIndexSearcher.suggest(query, 3, false);
-    assertThat(lookupDocs.totalHits, equalTo(0L));
+    assertThat(lookupDocs.totalHits.value, equalTo(0L));
     reader.close();
     iw.close();
   }
@@ -474,7 +474,7 @@ public class TestSuggestField extends LuceneTestCase {
     // calling suggest with filter that does not match any documents should early terminate
     PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "abc_"), filter);
     TopSuggestDocs suggest = indexSearcher.suggest(query, num, false);
-    assertThat(suggest.totalHits, equalTo(0L));
+    assertThat(suggest.totalHits.value, equalTo(0L));
     reader.close();
     iw.close();
   }
@@ -502,7 +502,7 @@ public class TestSuggestField extends LuceneTestCase {
     SuggestIndexSearcher indexSearcher = new SuggestIndexSearcher(reader);
     PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "abc_"));
     TopSuggestDocs suggest = indexSearcher.suggest(query, num, false);
-    assertThat(suggest.totalHits, equalTo(0L));
+    assertThat(suggest.totalHits.value, equalTo(0L));
 
     reader.close();
     iw.close();
@@ -656,7 +656,7 @@ public class TestSuggestField extends LuceneTestCase {
     SuggestIndexSearcher indexSearcher = new SuggestIndexSearcher(reader);
     PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "abc_"));
     TopSuggestDocs suggest = indexSearcher.suggest(query, num, false);
-    assertEquals(num, suggest.totalHits);
+    assertEquals(num, suggest.totalHits.value);
     for (SuggestScoreDoc suggestScoreDoc : suggest.scoreLookupDocs()) {
       String key = suggestScoreDoc.key.toString();
       assertTrue(key.startsWith("abc_"));
@@ -696,7 +696,7 @@ public class TestSuggestField extends LuceneTestCase {
     for (String prefix : prefixes) {
       PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", prefix));
       TopSuggestDocs suggest = indexSearcher.suggest(query, num, false);
-      assertTrue(suggest.totalHits > 0);
+      assertTrue(suggest.totalHits.value > 0);
       float topScore = -1;
       for (SuggestScoreDoc scoreDoc : suggest.scoreLookupDocs()) {
         if (topScore != -1) {
@@ -747,7 +747,7 @@ public class TestSuggestField extends LuceneTestCase {
 
       PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", title));
       TopSuggestDocs suggest = indexSearcher.suggest(query, mappings.size(), false);
-      assertTrue(suggest.totalHits > 0);
+      assertTrue(suggest.totalHits.value > 0);
       boolean matched = false;
       for (ScoreDoc scoreDoc : suggest.scoreDocs) {
         matched = Float.compare(scoreDoc.score, (float) entry.getValue()) == 0;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/geo/BaseGeoPointTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/BaseGeoPointTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/geo/BaseGeoPointTestCase.java
index ea62178..3334344 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/BaseGeoPointTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/BaseGeoPointTestCase.java
@@ -1431,23 +1431,23 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
   
   public void testSmallSetRect() throws Exception {
     TopDocs td = searchSmallSet(newRectQuery("point", 32.778, 32.779, -96.778, -96.777), 5);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
   }
 
   public void testSmallSetDateline() throws Exception {
     TopDocs td = searchSmallSet(newRectQuery("point", -45.0, -44.0, 179.0, -179.0), 20);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
   }
 
   public void testSmallSetMultiValued() throws Exception {
     TopDocs td = searchSmallSet(newRectQuery("point", 32.755, 32.776, -96.454, -96.770), 20);
     // 3 single valued docs + 2 multi-valued docs
-    assertEquals(5, td.totalHits);
+    assertEquals(5, td.totalHits.value);
   }
   
   public void testSmallSetWholeMap() throws Exception {
     TopDocs td = searchSmallSet(newRectQuery("point", GeoUtils.MIN_LAT_INCL, GeoUtils.MAX_LAT_INCL, GeoUtils.MIN_LON_INCL, GeoUtils.MAX_LON_INCL), 20);
-    assertEquals(24, td.totalHits);
+    assertEquals(24, td.totalHits.value);
   }
   
   public void testSmallSetPoly() throws Exception {
@@ -1459,7 +1459,7 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
         new double[]{-96.7682647, -96.8280029, -96.6288757, -96.4929199,
                      -96.6041564, -96.7449188, -96.76826477, -96.7682647})),
         5);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
   }
 
   public void testSmallSetPolyWholeMap() throws Exception {
@@ -1469,23 +1469,23 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
                       new double[] {GeoUtils.MIN_LAT_INCL, GeoUtils.MAX_LAT_INCL, GeoUtils.MAX_LAT_INCL, GeoUtils.MIN_LAT_INCL, GeoUtils.MIN_LAT_INCL},
                       new double[] {GeoUtils.MIN_LON_INCL, GeoUtils.MIN_LON_INCL, GeoUtils.MAX_LON_INCL, GeoUtils.MAX_LON_INCL, GeoUtils.MIN_LON_INCL})),
                       20);    
-    assertEquals("testWholeMap failed", 24, td.totalHits);
+    assertEquals("testWholeMap failed", 24, td.totalHits.value);
   }
 
   public void testSmallSetDistance() throws Exception {
     TopDocs td = searchSmallSet(newDistanceQuery("point", 32.94823588839368, -96.4538113027811, 6000), 20);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
   }
   
   public void testSmallSetTinyDistance() throws Exception {
     TopDocs td = searchSmallSet(newDistanceQuery("point", 40.720611, -73.998776, 1), 20);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
   }
 
   /** see https://issues.apache.org/jira/browse/LUCENE-6905 */
   public void testSmallSetDistanceNotEmpty() throws Exception {
     TopDocs td = searchSmallSet(newDistanceQuery("point", -88.56029371730983, -177.23537676036358, 7757.999232959935), 20);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
   }
 
   /**
@@ -1493,11 +1493,11 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
    */
   public void testSmallSetHugeDistance() throws Exception {
     TopDocs td = searchSmallSet(newDistanceQuery("point", 32.94823588839368, -96.4538113027811, 6000000), 20);
-    assertEquals(16, td.totalHits);
+    assertEquals(16, td.totalHits.value);
   }
 
   public void testSmallSetDistanceDateline() throws Exception {
     TopDocs td = searchSmallSet(newDistanceQuery("point", 32.94823588839368, -179.9538113027811, 120000), 20);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
index 7b902e3..bd11b47 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
@@ -118,7 +118,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       Document hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
@@ -152,7 +152,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int docID = hits.scoreDocs[i].doc;
@@ -188,7 +188,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int docID = hits.scoreDocs[i].doc;
@@ -226,7 +226,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int hitDocID = hits.scoreDocs[i].doc;
@@ -266,7 +266,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int docID = hits.scoreDocs[i].doc;
@@ -305,7 +305,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int docID = hits.scoreDocs[i].doc;
@@ -349,7 +349,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     BytesRef scratch = new BytesRef();
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
@@ -521,7 +521,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
       int hitDocID = hits.scoreDocs[i].doc;
@@ -625,7 +625,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     assertEquals(1, isearcher.count(new TermQuery(new Term("fieldname", longTerm))));
     Query query = new TermQuery(new Term("fieldname", "text"));
     TopDocs hits = isearcher.search(query, 1);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     BytesRef scratch = new BytesRef();
     // Iterate through the results:
     for (int i = 0; i < hits.scoreDocs.length; i++) {
@@ -1119,7 +1119,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes
     query.add(new TermQuery(new Term("docId", "4")), BooleanClause.Occur.SHOULD);
 
     TopDocs search = searcher.search(query.build(), 10);
-    assertEquals(5, search.totalHits);
+    assertEquals(5, search.totalHits.value);
     ScoreDoc[] scoreDocs = search.scoreDocs;
     NumericDocValues docValues = getOnlyLeafReader(reader).getNumericDocValues("docId");
     for (int i = 0; i < scoreDocs.length; i++) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
index 82d8adb..242abf7 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
@@ -154,7 +154,7 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat
             System.out.println("TEST: test id=" + testID);
           }
           TopDocs hits = s.search(new TermQuery(new Term("id", testID)), 1);
-          assertEquals(1, hits.totalHits);
+          assertEquals(1, hits.totalHits.value);
           Document doc = r.document(hits.scoreDocs[0].doc);
           Document docExp = docs.get(testID);
           for(int i=0;i<fieldCount;i++) {
@@ -436,8 +436,8 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat
             final Query query = new TermQuery(new Term("fld", "" + q));
             try {
               final TopDocs topDocs = searcher.search(query, 1);
-              if (topDocs.totalHits != 1) {
-                throw new IllegalStateException("Expected 1 hit, got " + topDocs.totalHits);
+              if (topDocs.totalHits.value != 1) {
+                throw new IllegalStateException("Expected 1 hit, got " + topDocs.totalHits.value);
               }
               final Document sdoc = rd.document(topDocs.scoreDocs[0].doc);
               if (sdoc == null || sdoc.get("fld") == null) {
@@ -733,7 +733,7 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat
     for (int i = 0; i < numDocs; ++i) {
       final Query query = new TermQuery(new Term("id", "" + i));
       final TopDocs topDocs = searcher.search(query, 1);
-      assertEquals("" + i, 1, topDocs.totalHits);
+      assertEquals("" + i, 1, topDocs.totalHits.value);
       final Document doc = rd.document(topDocs.scoreDocs[0].doc);
       assertNotNull(doc);
       final IndexableField[] fieldValues = doc.getFields("fld");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
index 3850429..b9e452e 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
@@ -484,7 +484,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
       }
 
       IndexSearcher searcher = newSearcher(reader, false);
-      sum += searcher.search(new TermQuery(new Term("body", "united")), 10).totalHits;
+      sum += searcher.search(new TermQuery(new Term("body", "united")), 10).totalHits.value;
 
       if (VERBOSE) {
         System.out.println("TEST: warm visited " + sum + " fields");
@@ -554,8 +554,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
     // Verify: make sure delIDs are in fact deleted:
     for(String id : delIDs) {
       final TopDocs hits = s.search(new TermQuery(new Term("docid", id)), 1);
-      if (hits.totalHits != 0) {
-        System.out.println("doc id=" + id + " is supposed to be deleted, but got " + hits.totalHits + " hits; first docID=" + hits.scoreDocs[0].doc);
+      if (hits.totalHits.value != 0) {
+        System.out.println("doc id=" + id + " is supposed to be deleted, but got " + hits.totalHits.value + " hits; first docID=" + hits.scoreDocs[0].doc);
         doFail = true;
       }
     }
@@ -563,8 +563,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
     // Verify: make sure delPackIDs are in fact deleted:
     for(String id : delPackIDs) {
       final TopDocs hits = s.search(new TermQuery(new Term("packID", id)), 1);
-      if (hits.totalHits != 0) {
-        System.out.println("packID=" + id + " is supposed to be deleted, but got " + hits.totalHits + " matches");
+      if (hits.totalHits.value != 0) {
+        System.out.println("packID=" + id + " is supposed to be deleted, but got " + hits.totalHits.value + " matches");
         doFail = true;
       }
     }
@@ -574,8 +574,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
       TopDocs hits = s.search(new TermQuery(new Term("packID", subDocs.packID)), 20);
       if (!subDocs.deleted) {
         // We sort by relevance but the scores should be identical so sort falls back to by docID:
-        if (hits.totalHits != subDocs.subIDs.size()) {
-          System.out.println("packID=" + subDocs.packID + ": expected " + subDocs.subIDs.size() + " hits but got " + hits.totalHits);
+        if (hits.totalHits.value != subDocs.subIDs.size()) {
+          System.out.println("packID=" + subDocs.packID + ": expected " + subDocs.subIDs.size() + " hits but got " + hits.totalHits.value);
           doFail = true;
         } else {
           int lastDocID = -1;
@@ -595,7 +595,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
           lastDocID = startDocID - 1;
           for(String subID : subDocs.subIDs) {
             hits = s.search(new TermQuery(new Term("docid", subID)), 1);
-            assertEquals(1, hits.totalHits);
+            assertEquals(1, hits.totalHits.value);
             final int docID = hits.scoreDocs[0].doc;
             if (lastDocID != -1) {
               assertEquals(1+lastDocID, docID);
@@ -608,7 +608,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
         // deleted.  We can't verify packID is deleted
         // because we can re-use packID for update:
         for(String subID : subDocs.subIDs) {
-          assertEquals(0, s.search(new TermQuery(new Term("docid", subID)), 1).totalHits);
+          assertEquals(0, s.search(new TermQuery(new Term("docid", subID)), 1).totalHits.value);
         }
       }
     }
@@ -622,8 +622,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
       String stringID = ""+id;
       if (!delIDs.contains(stringID)) {
         final TopDocs hits = s.search(new TermQuery(new Term("docid", stringID)), 1);
-        if (hits.totalHits != 1) {
-          System.out.println("doc id=" + stringID + " is not supposed to be deleted, but got hitCount=" + hits.totalHits + "; delIDs=" + delIDs);
+        if (hits.totalHits.value != 1) {
+          System.out.println("doc id=" + stringID + " is not supposed to be deleted, but got hitCount=" + hits.totalHits.value + "; delIDs=" + delIDs);
           doFail = true;
         }
       }
@@ -663,9 +663,9 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
 
   private long runQuery(IndexSearcher s, Query q) throws Exception {
     s.search(q, 10);
-    long hitCount = s.search(q, 10, new Sort(new SortField("titleDV", SortField.Type.STRING))).totalHits;
+    long hitCount = s.search(q, 10, new Sort(new SortField("titleDV", SortField.Type.STRING))).totalHits.value;
     final Sort dvSort = new Sort(new SortField("titleDV", SortField.Type.STRING));
-    long hitCount2 = s.search(q, 10, dvSort).totalHits;
+    long hitCount2 = s.search(q, 10, dvSort).totalHits.value;
     assertEquals(hitCount, hitCount2);
     return hitCount;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java b/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
index fb5dc66..63d9788 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
@@ -204,7 +204,7 @@ public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
       // not efficient, but simple!
       TopDocs td1 = s1.search(q1, reader.maxDoc(), sort);
       TopDocs td2 = s2.search(q2, reader.maxDoc(), sort);
-      assertTrue("too many hits: " + td1.totalHits + " > " + td2.totalHits, td1.totalHits <= td2.totalHits);
+      assertTrue("too many hits: " + td1.totalHits.value + " > " + td2.totalHits.value, td1.totalHits.value <= td2.totalHits.value);
       
       // fill the superset into a bitset
       BitSet bitset = new BitSet();
@@ -250,7 +250,7 @@ public abstract class SearchEquivalenceTestBase extends LuceneTestCase {
     }
     TopDocs td1 = s1.search(q1, reader.maxDoc());
     TopDocs td2 = s2.search(q2, reader.maxDoc());
-    assertEquals(td1.totalHits, td2.totalHits);
+    assertEquals(td1.totalHits.value, td2.totalHits.value);
     for (int i = 0; i < td1.scoreDocs.length; ++i) {
       assertEquals(td1.scoreDocs[i].doc, td2.scoreDocs[i].doc);
       assertEquals(td1.scoreDocs[i].score, td2.scoreDocs[i].score, 10e-5);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
index 537731e..bc31b44 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
@@ -1041,7 +1041,8 @@ public final class TestUtil {
   }
 
   public static void assertEquals(TopDocs expected, TopDocs actual) {
-    Assert.assertEquals("wrong total hits", expected.totalHits, actual.totalHits);
+    Assert.assertEquals("wrong total hits", expected.totalHits.value, actual.totalHits.value);
+    Assert.assertEquals("wrong total hits", expected.totalHits.relation, actual.totalHits.relation);
     Assert.assertEquals("wrong hit count", expected.scoreDocs.length, actual.scoreDocs.length);
     for(int hitIDX=0;hitIDX<expected.scoreDocs.length;hitIDX++) {
       final ScoreDoc expectedSD = expected.scoreDocs[hitIDX];

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestHierarchicalDocBuilder.java
----------------------------------------------------------------------
diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestHierarchicalDocBuilder.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestHierarchicalDocBuilder.java
index 103d0dc..4a3ba72 100644
--- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestHierarchicalDocBuilder.java
+++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestHierarchicalDocBuilder.java
@@ -255,7 +255,7 @@ public class TestHierarchicalDocBuilder extends AbstractDataImportHandlerTestCas
     /* The limit of search queue is doubled to catch the error in case when for some reason there are more docs than expected  */
     SolrIndexSearcher searcher = req.getSearcher();
     TopDocs result = searcher.search(query, values.length * 2);
-    assertEquals(values.length, result.totalHits);
+    assertEquals(values.length, result.totalHits.value);
     List<String> actualValues = new ArrayList<String>();
     for (int index = 0; index < values.length; ++index) {
       Document doc = searcher.doc(result.scoreDocs[index].doc);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
index 8b8159e..5412715 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
@@ -29,6 +29,7 @@ import org.apache.lucene.search.Rescorer;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.ScoreMode;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.Weight;
 import org.apache.solr.search.SolrIndexSearcher;
 
@@ -100,7 +101,7 @@ public class LTRRescorer extends Rescorer {
   @Override
   public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs,
       int topN) throws IOException {
-    if ((topN == 0) || (firstPassTopDocs.totalHits == 0)) {
+    if ((topN == 0) || (firstPassTopDocs.scoreDocs.length == 0)) {
       return firstPassTopDocs;
     }
     final ScoreDoc[] hits = firstPassTopDocs.scoreDocs;
@@ -111,7 +112,8 @@ public class LTRRescorer extends Rescorer {
       }
     });
 
-    topN = Math.toIntExact(Math.min(topN, firstPassTopDocs.totalHits));
+    assert firstPassTopDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+    topN = Math.toIntExact(Math.min(topN, firstPassTopDocs.totalHits.value));
     final ScoreDoc[] reranked = new ScoreDoc[topN];
     final List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
     final LTRScoringQuery.ModelWeight modelWeight = (LTRScoringQuery.ModelWeight) searcher

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRReRankingPipeline.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRReRankingPipeline.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRReRankingPipeline.java
index 89067e9..a847fe7 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRReRankingPipeline.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRReRankingPipeline.java
@@ -137,7 +137,7 @@ public class TestLTRReRankingPipeline extends LuceneTestCase {
     final IndexSearcher searcher = getSearcher(r);
     // first run the standard query
     TopDocs hits = searcher.search(bqBuilder.build(), 10);
-    assertEquals(2, hits.totalHits);
+    assertEquals(2, hits.totalHits.value);
     assertEquals("0", searcher.doc(hits.scoreDocs[0].doc).get("id"));
     assertEquals("1", searcher.doc(hits.scoreDocs[1].doc).get("id"));
 
@@ -209,7 +209,7 @@ public class TestLTRReRankingPipeline extends LuceneTestCase {
 
     // first run the standard query
     TopDocs hits = searcher.search(bqBuilder.build(), 10);
-    assertEquals(5, hits.totalHits);
+    assertEquals(5, hits.totalHits.value);
 
     assertEquals("0", searcher.doc(hits.scoreDocs[0].doc).get("id"));
     assertEquals("1", searcher.doc(hits.scoreDocs[1].doc).get("id"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
index 2797894..e9e4411 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
@@ -201,7 +201,7 @@ public class TestLTRScoringQuery extends LuceneTestCase {
     final IndexSearcher searcher = getSearcher(r);
     // first run the standard query
     final TopDocs hits = searcher.search(bqBuilder.build(), 10);
-    assertEquals(2, hits.totalHits);
+    assertEquals(2, hits.totalHits.value);
     assertEquals("0", searcher.doc(hits.scoreDocs[0].doc).get("id"));
     assertEquals("1", searcher.doc(hits.scoreDocs[1].doc).get("id"));
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java
index 3591ce2..d98adda 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java
@@ -144,7 +144,7 @@ public class TestSelectiveWeightCreation extends TestRerankBase {
     final IndexSearcher searcher = getSearcher(r);
     // first run the standard query
     final TopDocs hits = searcher.search(bqBuilder.build(), 10);
-    assertEquals(2, hits.totalHits);
+    assertEquals(2, hits.totalHits.value);
     assertEquals("10", searcher.doc(hits.scoreDocs[0].doc).get("id"));
     assertEquals("11", searcher.doc(hits.scoreDocs[1].doc).get("id"));
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
index 5ee5bdd..8d7012a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
@@ -437,7 +437,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
             SolrIndexSearcher searcher = searchHolder.get();
             try {
               log.debug(core.getCoreContainer().getZkController().getNodeName() + " synched "
-                  + searcher.search(new MatchAllDocsQuery(), 1).totalHits);
+                  + searcher.count(new MatchAllDocsQuery()));
             } finally {
               searchHolder.decref();
             }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
index 30301c0..ee3adae 100644
--- a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
@@ -116,8 +116,8 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
         m.update(payload.array(), payload.position(), payload.limit());
         String md5 = new BigInteger(1, m.digest()).toString(16);
 
-        TopDocs duplicate = req.getSearcher().search(new TermQuery(new Term("md5", md5)), 1);
-        if (duplicate.totalHits > 0) {
+        int duplicateCount = req.getSearcher().count(new TermQuery(new Term("md5", md5)));
+        if (duplicateCount > 0) {
           rsp.add("error", "duplicate entry");
           forward(req, null,
               new MapSolrParams((Map) makeMap(
@@ -132,7 +132,7 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
             1, new Sort(new SortField("version", SortField.Type.LONG, true)));
 
         long version = 0;
-        if (docs.totalHits > 0) {
+        if (docs.totalHits.value > 0) {
           Document doc = req.getSearcher().doc(docs.scoreDocs[0].doc);
           Number n = doc.getField("version").numericValue();
           version = n.longValue();
@@ -175,7 +175,7 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
           if (version != -1) q = "id:{0}/{1}";
           QParser qparser = QParser.getParser(StrUtils.formatString(q, blobName, version), req);
           final TopDocs docs = req.getSearcher().search(qparser.parse(), 1, new Sort(new SortField("version", SortField.Type.LONG, true)));
-          if (docs.totalHits > 0) {
+          if (docs.totalHits.value > 0) {
             rsp.add(ReplicationHandler.FILE_STREAM, new SolrCore.RawWriter() {
 
               @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java b/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
index a421651..55eb70a 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/RequestSyncShardOp.java
@@ -74,7 +74,7 @@ class RequestSyncShardOp implements CoreAdminHandler.CoreAdminOp {
               log.debug(core.getCoreContainer()
                   .getZkController().getNodeName()
                   + " synched "
-                  + searcher.search(new MatchAllDocsQuery(), 1).totalHits);
+                  + searcher.count(new MatchAllDocsQuery()));
             } finally {
               searchHolder.decref();
             }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java b/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
index 1354ea8..5b5add9 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
@@ -59,6 +59,7 @@ import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopDocsCollector;
 import org.apache.lucene.search.TopFieldCollector;
 import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.BytesRefBuilder;
@@ -437,7 +438,8 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
           docs[i] = scoreDoc.doc;
           scores[i] = scoreDoc.score;
         }
-        DocSlice slice = new DocSlice(0, docs.length, docs, scores, topDocs.totalHits, Float.NaN);
+        assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+        DocSlice slice = new DocSlice(0, docs.length, docs, scores, topDocs.totalHits.value, Float.NaN);
 
         if(fieldType instanceof StrField) {
           final BytesRef bytesRef = ordBytes.get((int)groupValue);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
index ff3cdbf..6ca8ad1 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java
@@ -161,7 +161,7 @@ public class RealTimeGetComponent extends SearchComponent
             log.debug(req.getCore()
                 .getCoreContainer().getZkController().getNodeName()
                 + " min count to sync to (from most recent searcher view) "
-                + searcher.search(new MatchAllDocsQuery(), 1).totalHits);
+                + searcher.count(new MatchAllDocsQuery()));
           } finally {
             searchHolder.decref();
           }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java
index 64464d4..e52220d 100644
--- a/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java
@@ -30,6 +30,7 @@ import org.apache.lucene.search.ScoreMode;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopDocsCollector;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.solr.common.params.SolrParams;
@@ -180,7 +181,7 @@ public class ExportQParserPlugin extends QParserPlugin {
 
       ScoreDoc[] scoreDocs = getScoreDocs(howMany);
       assert scoreDocs.length <= totalHits;
-      return new TopDocs(totalHits, scoreDocs);
+      return new TopDocs(new TotalHits(totalHits, totalHitsRelation), scoreDocs);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/Grouping.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/Grouping.java b/solr/core/src/java/org/apache/solr/search/Grouping.java
index cb7dccd..6f40e72 100644
--- a/solr/core/src/java/org/apache/solr/search/Grouping.java
+++ b/solr/core/src/java/org/apache/solr/search/Grouping.java
@@ -46,6 +46,7 @@ import org.apache.lucene.search.TopDocsCollector;
 import org.apache.lucene.search.TopFieldCollector;
 import org.apache.lucene.search.TopScoreDocCollector;
 import org.apache.lucene.search.TotalHitCountCollector;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.grouping.AllGroupHeadsCollector;
 import org.apache.lucene.search.grouping.AllGroupsCollector;
 import org.apache.lucene.search.grouping.FirstPassGroupingCollector;
@@ -613,7 +614,8 @@ public class Grouping {
     }
 
     protected DocList getDocList(GroupDocs groups) {
-      int max = Math.toIntExact(groups.totalHits);
+      assert groups.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+      int max = Math.toIntExact(groups.totalHits.value);
       int off = groupOffset;
       int len = docsPerGroup;
       if (format == Format.simple) {
@@ -635,7 +637,7 @@ public class Grouping {
 
       float score = groups.maxScore;
       maxScore = maxAvoidNaN(score, maxScore);
-      DocSlice docs = new DocSlice(off, Math.max(0, ids.length - off), ids, scores, groups.totalHits, score);
+      DocSlice docs = new DocSlice(off, Math.max(0, ids.length - off), ids, scores, groups.totalHits.value, score);
 
       if (getDocList) {
         DocIterator iter = docs.iterator();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/ReRankCollector.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ReRankCollector.java b/solr/core/src/java/org/apache/solr/search/ReRankCollector.java
index 0888f79..ffadb6e 100644
--- a/solr/core/src/java/org/apache/solr/search/ReRankCollector.java
+++ b/solr/core/src/java/org/apache/solr/search/ReRankCollector.java
@@ -98,7 +98,7 @@ public class ReRankCollector extends TopDocsCollector {
 
       TopDocs mainDocs = mainCollector.topDocs(0,  Math.max(reRankDocs, length));
 
-      if(mainDocs.totalHits == 0 || mainDocs.scoreDocs.length == 0) {
+      if(mainDocs.totalHits.value == 0 || mainDocs.scoreDocs.length == 0) {
         return mainDocs;
       }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index 6cbcd0d..343d7c4 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -2064,7 +2064,8 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
       ids[i] = scoreDoc.doc;
     }
 
-    qr.getDocListAndSet().docList = new DocSlice(0, nDocsReturned, ids, null, topDocs.totalHits, 0.0f);
+    assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+    qr.getDocListAndSet().docList = new DocSlice(0, nDocsReturned, ids, null, topDocs.totalHits.value, 0.0f);
     populateNextCursorMarkFromTopDocs(qr, cmd, topDocs);
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java
index a5ce1ff..3327dd7 100644
--- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java
+++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/shardresultserializer/TopGroupsResultTransformer.java
@@ -30,6 +30,7 @@ import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopFieldDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.grouping.GroupDocs;
 import org.apache.lucene.search.grouping.TopGroups;
 import org.apache.lucene.util.BytesRef;
@@ -108,9 +109,9 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
         ScoreDoc[] scoreDocs = transformToNativeShardDoc(documents, groupSort, shard, schema);
         final TopDocs topDocs;
         if (withinGroupSort.equals(Sort.RELEVANCE)) {
-          topDocs = new TopDocs(totalHits.longValue(), scoreDocs);
+          topDocs = new TopDocs(new TotalHits(totalHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs);
         } else {
-          topDocs = new TopFieldDocs(totalHits.longValue(), scoreDocs, withinGroupSort.getSort());
+          topDocs = new TopFieldDocs(new TotalHits(totalHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs, withinGroupSort.getSort());
         }
         result.put(key, new QueryCommandResult(topDocs, matches, maxScore));
         continue;
@@ -134,7 +135,7 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
         ScoreDoc[] scoreDocs = transformToNativeShardDoc(documents, withinGroupSort, shard, schema);
 
         BytesRef groupValueRef = groupValue != null ? new BytesRef(groupValue) : null;
-        groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, totalGroupHits.longValue(), scoreDocs, groupValueRef, null));
+        groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, new TotalHits(totalGroupHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs, groupValueRef, null));
       }
 
       @SuppressWarnings("unchecked")
@@ -193,7 +194,8 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
     SchemaField uniqueField = schema.getUniqueKeyField();
     for (GroupDocs<BytesRef> searchGroup : data.groups) {
       NamedList<Object> groupResult = new NamedList<>();
-      groupResult.add("totalHits", searchGroup.totalHits);
+      assert searchGroup.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+      groupResult.add("totalHits", searchGroup.totalHits.value);
       if (!Float.isNaN(searchGroup.maxScore)) {
         groupResult.add("maxScore", searchGroup.maxScore);
       }
@@ -240,7 +242,9 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
   protected NamedList serializeTopDocs(QueryCommandResult result) throws IOException {
     NamedList<Object> queryResult = new NamedList<>();
     queryResult.add("matches", result.getMatches());
-    queryResult.add("totalHits", result.getTopDocs().totalHits);
+    TopDocs topDocs = result.getTopDocs();
+    assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+    queryResult.add("totalHits", topDocs.totalHits.value);
     // debug: assert !Float.isNaN(result.getTopDocs().getMaxScore()) == rb.getGroupingSpec().isNeedScore();
     if (!Float.isNaN(result.getMaxScore())) {
       queryResult.add("maxScore", result.getMaxScore());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/grouping/endresulttransformer/GroupedEndResultTransformer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/grouping/endresulttransformer/GroupedEndResultTransformer.java b/solr/core/src/java/org/apache/solr/search/grouping/endresulttransformer/GroupedEndResultTransformer.java
index 6c9372c..485f724 100644
--- a/solr/core/src/java/org/apache/solr/search/grouping/endresulttransformer/GroupedEndResultTransformer.java
+++ b/solr/core/src/java/org/apache/solr/search/grouping/endresulttransformer/GroupedEndResultTransformer.java
@@ -17,6 +17,8 @@
 package org.apache.solr.search.grouping.endresulttransformer;
 
 import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.grouping.GroupDocs;
 import org.apache.lucene.search.grouping.TopGroups;
 import org.apache.lucene.util.BytesRef;
@@ -72,7 +74,8 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
             groupResult.add("groupValue", null);
           }
           SolrDocumentList docList = new SolrDocumentList();
-          docList.setNumFound(group.totalHits);
+          assert group.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+          docList.setNumFound(group.totalHits.value);
           if (!Float.isNaN(group.maxScore)) {
             docList.setMaxScore(group.maxScore);
           }
@@ -90,7 +93,9 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
         NamedList<Object> command = new SimpleOrderedMap<>();
         command.add("matches", queryCommandResult.getMatches());
         SolrDocumentList docList = new SolrDocumentList();
-        docList.setNumFound(queryCommandResult.getTopDocs().totalHits);
+        TopDocs topDocs = queryCommandResult.getTopDocs();
+        assert topDocs.totalHits.relation == TotalHits.Relation.EQUAL_TO;
+        docList.setNumFound(topDocs.totalHits.value);
         if (!Float.isNaN(queryCommandResult.getMaxScore())) {
           docList.setMaxScore(queryCommandResult.getMaxScore());
         }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
index 4a3400b..451c621 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
@@ -63,8 +63,8 @@ public class SimpleMLTQParser extends QParser {
     Map<String,Float> boostFields = new HashMap<>();
 
     try {
-      TopDocs td = searcher.search(docIdQuery, 1);
-      if (td.totalHits != 1) throw new SolrException(
+      TopDocs td = searcher.search(docIdQuery, 2);
+      if (td.totalHits.value != 1) throw new SolrException(
           SolrException.ErrorCode.BAD_REQUEST, "Error completing MLT request. Could not fetch " +
           "document with id [" + uniqueValue + "]");
       ScoreDoc[] scoreDocs = td.scoreDocs;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
index a513606..11d35e7 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
@@ -146,7 +146,7 @@ public class TestReplicationHandlerBackup extends SolrJettyTestBase {
         IndexReader reader = DirectoryReader.open(dir)) {
       IndexSearcher searcher = new IndexSearcher(reader);
       TopDocs hits = searcher.search(new MatchAllDocsQuery(), 1);
-      assertEquals(nDocs, hits.totalHits);
+      assertEquals(nDocs, hits.totalHits.value);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java b/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
index 80b1524..5c6392d 100644
--- a/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
+++ b/solr/core/src/test/org/apache/solr/legacy/TestMultiValuedNumericRangeQuery.java
@@ -75,7 +75,7 @@ public class TestMultiValuedNumericRangeQuery extends LuceneTestCase {
       LegacyNumericRangeQuery<Integer> tq= LegacyNumericRangeQuery.newIntRange("trie", lower, upper, true, true);
       TopDocs trTopDocs = searcher.search(cq, 1);
       TopDocs nrTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count for LegacyNumericRangeQuery and TermRangeQuery must be equal", trTopDocs.totalHits, nrTopDocs.totalHits );
+      assertEquals("Returned count for LegacyNumericRangeQuery and TermRangeQuery must be equal", trTopDocs.totalHits.value, nrTopDocs.totalHits.value );
     }
     reader.close();
     directory.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery32.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery32.java b/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery32.java
index 5c02913..74ce2fe 100644
--- a/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery32.java
+++ b/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery32.java
@@ -361,19 +361,19 @@ public class TestNumericRangeQuery32 extends LuceneTestCase {
       // test inclusive range
       Query tq= LegacyNumericRangeQuery.newIntRange(field, precisionStep, lower, upper, true, true);
       TopDocs tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
       // test exclusive range
       tq= LegacyNumericRangeQuery.newIntRange(field, precisionStep, lower, upper, false, false);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to exclusive range length", Math.max(upper-lower-1, 0), tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to exclusive range length", Math.max(upper-lower-1, 0), tTopDocs.totalHits.value );
       // test left exclusive range
       tq= LegacyNumericRangeQuery.newIntRange(field, precisionStep, lower, upper, false, true);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
       // test right exclusive range
       tq= LegacyNumericRangeQuery.newIntRange(field, precisionStep, lower, upper, true, false);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
     }
   }
 
@@ -400,7 +400,7 @@ public class TestNumericRangeQuery32 extends LuceneTestCase {
     Query tq= LegacyNumericRangeQuery.newFloatRange(field, precisionStep,
         NumericUtils.sortableIntToFloat(lower), NumericUtils.sortableIntToFloat(upper), true, true);
     TopDocs tTopDocs = searcher.search(tq, 1);
-    assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits );
+    assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery64.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery64.java b/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery64.java
index 99d4261..59db2eb 100644
--- a/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery64.java
+++ b/solr/core/src/test/org/apache/solr/legacy/TestNumericRangeQuery64.java
@@ -385,19 +385,19 @@ public class TestNumericRangeQuery64 extends LuceneTestCase {
       // test inclusive range
       Query tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, true);
       TopDocs tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
       // test exclusive range
       tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, false, false);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to exclusive range length", Math.max(upper-lower-1, 0), tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to exclusive range length", Math.max(upper-lower-1, 0), tTopDocs.totalHits.value );
       // test left exclusive range
       tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, false, true);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
       // test right exclusive range
       tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, false);
       tTopDocs = searcher.search(tq, 1);
-      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits );
+      assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
     }
   }
 
@@ -429,7 +429,7 @@ public class TestNumericRangeQuery64 extends LuceneTestCase {
     Query tq= LegacyNumericRangeQuery.newDoubleRange(field, precisionStep,
         NumericUtils.sortableLongToDouble(lower), NumericUtils.sortableLongToDouble(upper), true, true);
     TopDocs tTopDocs = searcher.search(tq, 1);
-    assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits );
+    assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/search/TestFilteredDocIdSet.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestFilteredDocIdSet.java b/solr/core/src/test/org/apache/solr/search/TestFilteredDocIdSet.java
index 88b16ae..4a5c805 100644
--- a/solr/core/src/test/org/apache/solr/search/TestFilteredDocIdSet.java
+++ b/solr/core/src/test/org/apache/solr/search/TestFilteredDocIdSet.java
@@ -125,7 +125,7 @@ public class TestFilteredDocIdSet extends LuceneTestCase {
     
     // First verify the document is searchable.
     IndexSearcher searcher = newSearcher(reader);
-    Assert.assertEquals(1, searcher.search(new MatchAllDocsQuery(), 10).totalHits);
+    Assert.assertEquals(1, searcher.search(new MatchAllDocsQuery(), 10).totalHits.value);
     
     // Now search w/ a Filter which returns a null DocIdSet
     Filter f = new Filter() {
@@ -169,7 +169,7 @@ public class TestFilteredDocIdSet extends LuceneTestCase {
     
     // First verify the document is searchable.
     IndexSearcher searcher = newSearcher(reader);
-    Assert.assertEquals(1, searcher.search(new MatchAllDocsQuery(), 10).totalHits);
+    Assert.assertEquals(1, searcher.search(new MatchAllDocsQuery(), 10).totalHits.value);
     
       // Now search w/ a Filter which returns a null DocIdSet
     Filter f = new Filter() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java b/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java
index f72fd56..b2c396e 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java
@@ -45,6 +45,7 @@ import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.TopDocsCollector;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.util.InPlaceMergeSorter;
 import org.apache.lucene.util.PriorityQueue;
@@ -723,7 +724,7 @@ public class TestRankQueryPlugin extends QParserPlugin {
         }
       });
       ScoreDoc[] scoreDocs = list.toArray(new ScoreDoc[list.size()]);
-      return new TopDocs(list.size(), scoreDocs);
+      return new TopDocs(new TotalHits(list.size(), TotalHits.Relation.EQUAL_TO), scoreDocs);
     }
 
     public TopDocs topDocs(int start, int len) {
@@ -785,7 +786,7 @@ public class TestRankQueryPlugin extends QParserPlugin {
         }
       });
       ScoreDoc[] scoreDocs = list.toArray(new ScoreDoc[list.size()]);
-      return new TopDocs(list.size(), scoreDocs);
+      return new TopDocs(new TotalHits(list.size(), TotalHits.Relation.EQUAL_TO), scoreDocs);
     }
 
     public TopDocs topDocs(int start, int len) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java b/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java
index f7918d7..6b68bf3 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java
@@ -145,7 +145,7 @@ public class TestOrdValues extends LuceneTestCase {
     }
     Query q = new FunctionQuery(vs);
     TopDocs td = s.search(q, 1000);
-    assertEquals("All docs should be matched!", N_DOCS, td.totalHits);
+    assertEquals("All docs should be matched!", N_DOCS, td.totalHits.value);
     ScoreDoc sd[] = td.scoreDocs;
     for (int i = 0; i < sd.length; i++) {
       float score = sd[i].score;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java b/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java
index a2f625c..48d64d6 100644
--- a/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java
+++ b/solr/core/src/test/org/apache/solr/search/join/BJQParserTest.java
@@ -459,7 +459,7 @@ public class BJQParserTest extends SolrTestCaseJ4 {
       QParser parser = QParser.getParser(req.getParams().get("q"), null, req);
       query = parser.getQuery();
       final TopDocs topDocs = req.getSearcher().search(query, 10);
-      assertEquals(1, topDocs.totalHits);
+      assertEquals(1, topDocs.totalHits.value);
     }
     assertU(adoc("id", "12275", 
         "child_s", "l", "childparent_s", "e"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
index ddf4cc3..ac7bd7f 100644
--- a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
+++ b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
@@ -88,7 +88,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", sortType));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // 'bar' comes before 'foo'
     assertEquals("bar", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("foo", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -127,7 +127,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", sortType));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null comes first
     assertNull(searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("bar", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -164,7 +164,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", sortType, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // 'foo' comes after 'bar' in reverse order
     assertEquals("foo", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("bar", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -204,7 +204,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sf);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null comes first
     assertNull(searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("bar", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -245,7 +245,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sf);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     assertEquals("foo", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("bar", searcher.doc(td.scoreDocs[1].doc).get("value"));
     // null comes last
@@ -287,7 +287,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sf);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     assertEquals("bar", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("foo", searcher.doc(td.scoreDocs[1].doc).get("value"));
     // null comes last
@@ -329,7 +329,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sf);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null comes first
     assertNull(searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("foo", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -356,7 +356,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(SortField.FIELD_DOC);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // docid 0, then docid 1
     assertEquals(0, td.scoreDocs[0].doc);
     assertEquals(1, td.scoreDocs[1].doc);
@@ -382,7 +382,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField(null, SortField.Type.DOC, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // docid 1, then docid 0
     assertEquals(1, td.scoreDocs[0].doc);
     assertEquals(0, td.scoreDocs[1].doc);
@@ -408,11 +408,11 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort();
 
     TopDocs actual = searcher.search(new TermQuery(new Term("value", "foo")), 10, sort);
-    assertEquals(2, actual.totalHits);
+    assertEquals(2, actual.totalHits.value);
 
     TopDocs expected = searcher.search(new TermQuery(new Term("value", "foo")), 10);
     // the two topdocs should be the same
-    assertEquals(expected.totalHits, actual.totalHits);
+    assertEquals(expected.totalHits.value, actual.totalHits.value);
     for (int i = 0; i < actual.scoreDocs.length; i++) {
       assertEquals(actual.scoreDocs[i].doc, expected.scoreDocs[i].doc);
     }
@@ -440,11 +440,11 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField(null, SortField.Type.SCORE, true));
 
     TopDocs actual = searcher.search(new TermQuery(new Term("value", "foo")), 10, sort);
-    assertEquals(2, actual.totalHits);
+    assertEquals(2, actual.totalHits.value);
 
     TopDocs expected = searcher.search(new TermQuery(new Term("value", "foo")), 10);
     // the two topdocs should be the reverse of each other
-    assertEquals(expected.totalHits, actual.totalHits);
+    assertEquals(expected.totalHits.value, actual.totalHits.value);
     assertEquals(actual.scoreDocs[0].doc, expected.scoreDocs[1].doc);
     assertEquals(actual.scoreDocs[1].doc, expected.scoreDocs[0].doc);
     TestUtil.checkReader(ir);
@@ -476,7 +476,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -508,7 +508,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as a 0
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -542,7 +542,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as a Integer.MAX_VALUE
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -576,7 +576,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("300000", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -607,7 +607,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -637,7 +637,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as a 0
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -669,7 +669,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as a Integer.MAX_VALUE
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -700,7 +700,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.INT, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("300000", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -734,7 +734,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -766,7 +766,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as 0
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -800,7 +800,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as Long.MAX_VALUE
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -834,7 +834,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("3000000000", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -865,7 +865,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -895,7 +895,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as 0
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -927,7 +927,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as Long.MAX_VALUE
     assertEquals("-1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -958,7 +958,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.LONG, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("3000000000", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -992,7 +992,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1024,7 +1024,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as 0
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1058,7 +1058,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as Float.MAX_VALUE
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1092,7 +1092,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("30.1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1123,7 +1123,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // numeric order
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1153,7 +1153,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as 0
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1185,7 +1185,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // null is treated as Float.MAX_VALUE
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1216,7 +1216,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.FLOAT, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(3, td.totalHits);
+    assertEquals(3, td.totalHits.value);
     // reverse numeric order
     assertEquals("30.1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1254,7 +1254,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // numeric order
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333332", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1286,7 +1286,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // numeric order
     double v0 = searcher.doc(td.scoreDocs[0].doc).getField("value").numericValue().doubleValue();
     double v1 = searcher.doc(td.scoreDocs[1].doc).getField("value").numericValue().doubleValue();
@@ -1326,7 +1326,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // null treated as a 0
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1365,7 +1365,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // null treated as Double.MAX_VALUE
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333332", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1404,7 +1404,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // numeric order
     assertEquals("30.1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333333", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1439,7 +1439,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // numeric order
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333332", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1469,7 +1469,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // numeric order
     double v0 = searcher.doc(td.scoreDocs[0].doc).getField("value").numericValue().doubleValue();
     double v1 = searcher.doc(td.scoreDocs[1].doc).getField("value").numericValue().doubleValue();
@@ -1506,7 +1506,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // null treated as a 0
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertNull(searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1542,7 +1542,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(sortField);
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // null treated as Double.MAX_VALUE
     assertEquals("-1.3", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333332", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1577,7 +1577,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.DOUBLE, true));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(4, td.totalHits);
+    assertEquals(4, td.totalHits.value);
     // numeric order
     assertEquals("30.1", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("4.2333333333333", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1605,7 +1605,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     w.close();
     IndexSearcher s = newSearcher(r);
     TopDocs hits = s.search(new TermQuery(new Term("t", "1")), 10, new Sort(new SortField("f", SortField.Type.STRING)));
-    assertEquals(2, hits.totalHits);
+    assertEquals(2, hits.totalHits.value);
     // null sorts first
     assertEquals(1, hits.scoreDocs[0].doc);
     assertEquals(0, hits.scoreDocs[1].doc);
@@ -1676,27 +1676,27 @@ public class TestFieldCacheSort extends LuceneTestCase {
   
     Sort sort = new Sort();
     TopDocs td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
 
     sort.setSort(SortField.FIELD_DOC);
     td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
 
     sort.setSort(new SortField("int", SortField.Type.INT), SortField.FIELD_DOC);
     td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
     
     sort.setSort(new SortField("string", SortField.Type.STRING, true), SortField.FIELD_DOC);
     td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
     
     sort.setSort(new SortField("string_val", SortField.Type.STRING_VAL, true), SortField.FIELD_DOC);
     td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
 
     sort.setSort(new SortField("float", SortField.Type.FLOAT), new SortField("string", SortField.Type.STRING));
     td = empty.search(query, 10, sort, true);
-    assertEquals(0, td.totalHits);
+    assertEquals(0, td.totalHits.value);
   }
   
   /** Tests sorting a single document */
@@ -1714,7 +1714,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.STRING));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(1, td.totalHits);
+    assertEquals(1, td.totalHits.value);
     assertEquals("foo", searcher.doc(td.scoreDocs[0].doc).get("value"));
     TestUtil.checkReader(ir);
     ir.close();
@@ -1736,10 +1736,10 @@ public class TestFieldCacheSort extends LuceneTestCase {
     Sort sort = new Sort(new SortField("value", SortField.Type.STRING));
 
     TopDocs expected = searcher.search(new TermQuery(new Term("value", "foo")), 10);
-    assertEquals(1, expected.totalHits);
+    assertEquals(1, expected.totalHits.value);
     TopDocs actual = searcher.search(new TermQuery(new Term("value", "foo")), 10, sort, true);
     
-    assertEquals(expected.totalHits, actual.totalHits);
+    assertEquals(expected.totalHits.value, actual.totalHits.value);
     assertEquals(expected.scoreDocs[0].score, actual.scoreDocs[0].score, 0F);
     TestUtil.checkReader(ir);
     ir.close();
@@ -1771,7 +1771,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
                          new SortField("value", SortField.Type.STRING));
 
     TopDocs td = searcher.search(new MatchAllDocsQuery(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     // 'bar' comes before 'foo'
     assertEquals("bar", searcher.doc(td.scoreDocs[0].doc).get("value"));
     assertEquals("foo", searcher.doc(td.scoreDocs[1].doc).get("value"));
@@ -1799,7 +1799,7 @@ public class TestFieldCacheSort extends LuceneTestCase {
     bq.add(new TermQuery(new Term("value", "foo")), Occur.SHOULD);
     bq.add(new MatchAllDocsQuery(), Occur.SHOULD);
     TopDocs td = searcher.search(bq.build(), 10, sort);
-    assertEquals(2, td.totalHits);
+    assertEquals(2, td.totalHits.value);
     if (Float.isNaN(td.scoreDocs[0].score) == false && Float.isNaN(td.scoreDocs[1].score) == false) {
       assertEquals(1, td.scoreDocs[0].doc);
       assertEquals(0, td.scoreDocs[1].doc);


Mime
View raw message