lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject [28/36] lucene-solr:jira/http2: LUCENE-8430: TopDocs.totalHits may now be a lower bound of the hit count.
Date Tue, 31 Jul 2018 02:32:44 GMT
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterMTQ.java
----------------------------------------------------------------------
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterMTQ.java b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterMTQ.java
index a9fadc0..2f97ad4 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterMTQ.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterMTQ.java
@@ -123,7 +123,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     UnifiedHighlighter highlighter = new UnifiedHighlighter(searcher, indexAnalyzer);
     Query query = new WildcardQuery(new Term("body", "te*"));
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -143,7 +143,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new WildcardQuery(new Term("bogus", "te*")), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -177,7 +177,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // wrap in a BoostQuery to also show we see inside it
     Query query = new BoostQuery(new PrefixQuery(new Term("body", "te")), 2.0f);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -190,7 +190,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new PrefixQuery(new Term("bogus", "te")), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -218,7 +218,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     UnifiedHighlighter highlighter = randomUnifiedHighlighter(searcher, indexAnalyzer);
     Query query = new RegexpQuery(new Term("body", "te.*"));
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -231,7 +231,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new RegexpQuery(new Term("bogus", "te.*")), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -259,7 +259,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     UnifiedHighlighter highlighter = randomUnifiedHighlighter(searcher, indexAnalyzer);
     Query query = new FuzzyQuery(new Term("body", "tets"), 1);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -268,7 +268,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // with prefix
     query = new FuzzyQuery(new Term("body", "tets"), 1, 2);
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -281,7 +281,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new FuzzyQuery(new Term("bogus", "tets"), 1), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -309,7 +309,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     UnifiedHighlighter highlighter = randomUnifiedHighlighter(searcher, indexAnalyzer);
     Query query = TermRangeQuery.newStringRange("body", "ta", "tf", true, true);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -318,7 +318,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // null start
     query = TermRangeQuery.newStringRange("body", null, "tf", true, true);
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This <b>is</b> <b>a</b> <b>test</b>.", snippets[0]);
@@ -327,7 +327,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // null end
     query = TermRangeQuery.newStringRange("body", "ta", null, true, true);
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("<b>This</b> is a <b>test</b>.", snippets[0]);
@@ -336,7 +336,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // exact start inclusive
     query = TermRangeQuery.newStringRange("body", "test", "tf", true, true);
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -345,7 +345,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     // exact end inclusive
     query = TermRangeQuery.newStringRange("body", "ta", "test", true, true);
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -357,7 +357,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(TermRangeQuery.newStringRange("body", "test", "tf", false, true), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -369,7 +369,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(TermRangeQuery.newStringRange("body", "ta", "test", true, false), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -382,7 +382,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(TermRangeQuery.newStringRange("bogus", "ta", "tf", true, true), BooleanClause.Occur.SHOULD)
         .build();
     topDocs = searcher.search(bq, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", bq, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -412,7 +412,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new WildcardQuery(new Term("body", "te*")), BooleanClause.Occur.SHOULD)
         .build();
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -424,7 +424,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new WildcardQuery(new Term("bogus", "te*")), BooleanClause.Occur.MUST_NOT)
         .build();
     topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a test.", snippets[0]);
@@ -455,7 +455,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new TermQuery(new Term("body", "test")), BooleanClause.Occur.FILTER)
         .build();
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -483,7 +483,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     UnifiedHighlighter highlighter = randomUnifiedHighlighter(searcher, indexAnalyzer);
     ConstantScoreQuery query = new ConstantScoreQuery(new WildcardQuery(new Term("body", "te*")));
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -512,7 +512,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     DisjunctionMaxQuery query = new DisjunctionMaxQuery(
         Collections.singleton(new WildcardQuery(new Term("body", "te*"))), 0);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -542,7 +542,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     Query query = new SpanBoostQuery(
         new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("body", "te*"))), 2.0f);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -571,7 +571,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     SpanQuery childQuery = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("body", "te*")));
     Query query = new SpanOrQuery(new SpanQuery[]{childQuery});
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -600,7 +600,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     SpanQuery childQuery = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("body", "te*")));
     Query query = new SpanNearQuery(new SpanQuery[]{childQuery, childQuery}, 0, false);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -630,7 +630,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     SpanQuery exclude = new SpanTermQuery(new Term("body", "bogus"));
     Query query = new SpanNotQuery(include, exclude);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -659,7 +659,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
     SpanQuery childQuery = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("body", "te*")));
     Query query = new SpanFirstQuery(childQuery, 1000000);
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(2, snippets.length);
     assertEquals("This is a <b>test</b>.", snippets[0]);
@@ -694,7 +694,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
         .add(new FuzzyQuery(new Term("body", "zentence~")), BooleanClause.Occur.SHOULD)
         .build();
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs);
     assertEquals(1, snippets.length);
 
@@ -748,7 +748,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
       }
     };
 
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs);
     assertEquals(1, snippets.length);
 
@@ -1150,7 +1150,7 @@ public class TestUnifiedHighlighterMTQ extends LuceneTestCase {
 
   private void highlightAndAssertMatch(IndexSearcher searcher, UnifiedHighlighter highlighter, Query query, String field, String fieldVal) throws IOException {
     TopDocs topDocs = searcher.search(query, 1);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     String[] snippets = highlighter.highlight(field, query, topDocs);
     assertEquals("[<b>"+fieldVal+"</b>]", Arrays.toString(snippets));
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterRanking.java
----------------------------------------------------------------------
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterRanking.java b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterRanking.java
index a235edd..ac7e9bc 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterRanking.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterRanking.java
@@ -281,7 +281,7 @@ public class TestUnifiedHighlighterRanking extends LuceneTestCase {
     };
     Query query = new TermQuery(new Term("body", "test"));
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs, 1);
     assertEquals(1, snippets.length);
     assertTrue(snippets[0].startsWith("This <b>test</b> is a better <b>test</b>"));
@@ -324,7 +324,7 @@ public class TestUnifiedHighlighterRanking extends LuceneTestCase {
         .add(new TermQuery(new Term("body", "bar")), BooleanClause.Occur.SHOULD)
         .build();
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     String snippets[] = highlighter.highlight("body", query, topDocs, 1);
     assertEquals(1, snippets.length);
     assertTrue(snippets[0].startsWith("On the other hand"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterStrictPhrases.java
----------------------------------------------------------------------
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterStrictPhrases.java b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterStrictPhrases.java
index 44a8272..2fefaba 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterStrictPhrases.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterStrictPhrases.java
@@ -44,6 +44,7 @@ import org.apache.lucene.search.ScoreMode;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.Weight;
 import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper;
@@ -378,7 +379,7 @@ public class TestUnifiedHighlighterStrictPhrases extends LuceneTestCase {
         .add(phraseQuery, BooleanClause.Occur.MUST) // must match and it will
         .build();
     topDocs = searcher.search(query, 10);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     snippets = highlighter.highlight("body", query, topDocs, 2);
     assertEquals("one <b>bravo</b> <b>three</b>... <b>four</b> <b>bravo</b> six", snippets[0]);
   }
@@ -459,7 +460,7 @@ public class TestUnifiedHighlighterStrictPhrases extends LuceneTestCase {
         .add(proximityBoostingQuery, BooleanClause.Occur.SHOULD)
         .build();
     TopDocs topDocs = searcher.search(totalQuery, 10, Sort.INDEXORDER);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     String[] snippets = highlighter.highlight("body", totalQuery, topDocs);
     assertArrayEquals(new String[]{"There is no <b>accord</b> <b>and</b> <b>satisfaction</b> with this - <b>Consideration</b> of the <b>accord</b> is arbitrary."}, snippets);
   }
@@ -540,7 +541,7 @@ public class TestUnifiedHighlighterStrictPhrases extends LuceneTestCase {
     final String indexedText = "x y z x z x a";
     indexWriter.addDocument(newDoc(indexedText));
     initReaderSearcherHighlighter();
-    TopDocs topDocs = new TopDocs(1, new ScoreDoc[]{new ScoreDoc(0, 1f)});
+    TopDocs topDocs = new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[]{new ScoreDoc(0, 1f)});
 
     String expected = "<b>x</b> <b>y</b> <b>z</b> x z x <b>a</b>";
     Query q = new SpanNearQuery(new SpanQuery[] {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterTermVec.java
----------------------------------------------------------------------
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterTermVec.java b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterTermVec.java
index 89332e2..2d9fb0e 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterTermVec.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/uhighlight/TestUnifiedHighlighterTermVec.java
@@ -100,7 +100,7 @@ public class TestUnifiedHighlighterTermVec extends LuceneTestCase {
     }
     BooleanQuery query = queryBuilder.build();
     TopDocs topDocs = searcher.search(query, 10, Sort.INDEXORDER);
-    assertEquals(numDocs, topDocs.totalHits);
+    assertEquals(numDocs, topDocs.totalHits.value);
     Map<String, String[]> fieldToSnippets =
         highlighter.highlightFields(fields.toArray(new String[numTvFields]), query, topDocs);
     String[] expectedSnippetsByDoc = new String[numDocs];

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/FastVectorHighlighterTest.java
----------------------------------------------------------------------
diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/FastVectorHighlighterTest.java b/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/FastVectorHighlighterTest.java
index ddcce5a..1dce6d2 100644
--- a/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/FastVectorHighlighterTest.java
+++ b/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/FastVectorHighlighterTest.java
@@ -353,7 +353,7 @@ public class FastVectorHighlighterTest extends LuceneTestCase {
     IndexReader reader = DirectoryReader.open(writer);
     IndexSearcher searcher = newSearcher(reader);
     TopDocs hits = searcher.search(query, 10);
-    assertEquals(2, hits.totalHits);
+    assertEquals(2, hits.totalHits.value);
     FieldQuery fieldQuery  = highlighter.getFieldQuery(query, reader);
     String[] bestFragments = highlighter.getBestFragments(fieldQuery, reader, 1, "field", 1000, 1);
     assertEquals("This piece of <b>text</b> refers to Kennedy at the beginning then has a longer piece of <b>text</b> that is <b>very</b> <b>long</b> in the middle and finally ends with another reference to Kennedy", bestFragments[0]);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
----------------------------------------------------------------------
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
index bcdeb87..bbf73c0 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
@@ -157,19 +157,19 @@ public class TestBlockJoin extends LuceneTestCase {
     fullQuery.add(new BooleanClause(childJoinQuery, Occur.MUST));
     fullQuery.add(new BooleanClause(new MatchAllDocsQuery(), Occur.MUST));
     TopDocs topDocs = s.search(fullQuery.build(), 2);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     assertEquals(asSet("Lisa", "Frank"),
         asSet(s.doc(topDocs.scoreDocs[0].doc).get("name"), s.doc(topDocs.scoreDocs[1].doc).get("name")));
 
     ParentChildrenBlockJoinQuery childrenQuery =
         new ParentChildrenBlockJoinQuery(parentsFilter, childQuery.build(), topDocs.scoreDocs[0].doc);
     TopDocs matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
     childrenQuery = new ParentChildrenBlockJoinQuery(parentsFilter, childQuery.build(), topDocs.scoreDocs[1].doc);
     matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
     r.close();
@@ -221,19 +221,19 @@ public class TestBlockJoin extends LuceneTestCase {
     fullQuery.add(new BooleanClause(childJoinQuery, Occur.SHOULD));
 
     final TopDocs topDocs = s.search(fullQuery.build(), 2);
-    assertEquals(2, topDocs.totalHits);
+    assertEquals(2, topDocs.totalHits.value);
     assertEquals(asSet("Lisa", "Frank"),
         asSet(s.doc(topDocs.scoreDocs[0].doc).get("name"), s.doc(topDocs.scoreDocs[1].doc).get("name")));
 
     ParentChildrenBlockJoinQuery childrenQuery =
         new ParentChildrenBlockJoinQuery(parentsFilter, childQuery.build(), topDocs.scoreDocs[0].doc);
     TopDocs matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
     childrenQuery = new ParentChildrenBlockJoinQuery(parentsFilter, childQuery.build(), topDocs.scoreDocs[1].doc);
     matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
     r.close();
@@ -288,14 +288,14 @@ public class TestBlockJoin extends LuceneTestCase {
     TopDocs topDocs = s.search(fullQuery.build(), 1);
 
     //assertEquals(1, results.totalHitCount);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     Document parentDoc = s.doc(topDocs.scoreDocs[0].doc);
     assertEquals("Lisa", parentDoc.get("name"));
 
     ParentChildrenBlockJoinQuery childrenQuery =
         new ParentChildrenBlockJoinQuery(parentsFilter, childQuery.build(), topDocs.scoreDocs[0].doc);
     TopDocs matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
 
@@ -309,7 +309,7 @@ public class TestBlockJoin extends LuceneTestCase {
 
     //System.out.println("FULL: " + fullChildQuery);
     TopDocs hits = s.search(fullChildQuery.build(), 10);
-    assertEquals(1, hits.totalHits);
+    assertEquals(1, hits.totalHits.value);
     Document childDoc = s.doc(hits.scoreDocs[0].doc);
     //System.out.println("CHILD = " + childDoc + " docID=" + hits.scoreDocs[0].doc);
     assertEquals("java", childDoc.get("skill"));
@@ -401,7 +401,7 @@ public class TestBlockJoin extends LuceneTestCase {
         .add(parentQuery, Occur.FILTER)
         .build();
     TopDocs ukOnly = s.search(query, 1);
-    assertEquals("has filter - single passed", 1, ukOnly.totalHits);
+    assertEquals("has filter - single passed", 1, ukOnly.totalHits.value);
     assertEquals( "Lisa", r.document(ukOnly.scoreDocs[0].doc).get("name"));
 
     query = new BooleanQuery.Builder()
@@ -410,7 +410,7 @@ public class TestBlockJoin extends LuceneTestCase {
         .build();
     // looking for US candidates
     TopDocs usThen = s.search(query, 1);
-    assertEquals("has filter - single passed", 1, usThen.totalHits);
+    assertEquals("has filter - single passed", 1, usThen.totalHits.value);
     assertEquals("Frank", r.document(usThen.scoreDocs[0].doc).get("name"));
 
 
@@ -774,7 +774,7 @@ public class TestBlockJoin extends LuceneTestCase {
                                        parentAndChildSort);
 
       if (VERBOSE) {
-        System.out.println("\nTEST: normal index gets " + results.totalHits + " hits; sort=" + parentAndChildSort);
+        System.out.println("\nTEST: normal index gets " + results.totalHits.value + " hits; sort=" + parentAndChildSort);
         final ScoreDoc[] hits = results.scoreDocs;
         for(int hitIDX=0;hitIDX<hits.length;hitIDX++) {
           final Document doc = s.doc(hits[hitIDX].doc);
@@ -822,7 +822,7 @@ public class TestBlockJoin extends LuceneTestCase {
         }
       }
 
-      if (results.totalHits == 0) {
+      if (results.totalHits.value == 0) {
         assertEquals(0, joinResults.size());
       } else {
         compareHits(r, joinR, results, joinResults);
@@ -958,7 +958,7 @@ public class TestBlockJoin extends LuceneTestCase {
       final TopDocs results2 = s.search(childQuery2, r.numDocs(),
                                         childSort2);
       if (VERBOSE) {
-        System.out.println("  " + results2.totalHits + " totalHits:");
+        System.out.println("  " + results2.totalHits.value + " totalHits:");
         for(ScoreDoc sd : results2.scoreDocs) {
           final Document doc = s.doc(sd.doc);
           System.out.println("  childID=" + doc.get("childID") + " parentID=" + doc.get("parentID") + " docID=" + sd.doc);
@@ -971,7 +971,7 @@ public class TestBlockJoin extends LuceneTestCase {
       }
       TopDocs joinResults2 = joinS.search(childJoinQuery2, joinR.numDocs(), childSort2);
       if (VERBOSE) {
-        System.out.println("  " + joinResults2.totalHits + " totalHits:");
+        System.out.println("  " + joinResults2.totalHits.value + " totalHits:");
         for(ScoreDoc sd : joinResults2.scoreDocs) {
           final Document doc = joinS.doc(sd.doc);
           final Document parentDoc = getParentDoc(joinR, parentsFilter, sd.doc);
@@ -989,7 +989,7 @@ public class TestBlockJoin extends LuceneTestCase {
   }
 
   private void compareChildHits(IndexReader r, IndexReader joinR, TopDocs results, TopDocs joinResults) throws Exception {
-    assertEquals(results.totalHits, joinResults.totalHits);
+    assertEquals(results.totalHits.value, joinResults.totalHits.value);
     assertEquals(results.scoreDocs.length, joinResults.scoreDocs.length);
     for(int hitCount=0;hitCount<results.scoreDocs.length;hitCount++) {
       ScoreDoc hit = results.scoreDocs[hitCount];
@@ -1013,7 +1013,7 @@ public class TestBlockJoin extends LuceneTestCase {
   private void compareHits(IndexReader r, IndexReader joinR, TopDocs controlHits, Map<Integer, TopDocs> joinResults) throws Exception {
     int currentParentID = -1;
     int childHitSlot = 0;
-    TopDocs childHits = new TopDocs(0, new ScoreDoc[0]);
+    TopDocs childHits = new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]);
     for (ScoreDoc controlHit : controlHits.scoreDocs) {
       Document controlDoc = r.document(controlHit.doc);
       int parentID = Integer.parseInt(controlDoc.get("parentID"));
@@ -1077,19 +1077,19 @@ public class TestBlockJoin extends LuceneTestCase {
     fullQuery.add(new BooleanClause(childQualificationJoinQuery, Occur.MUST));
 
     final TopDocs topDocs = s.search(fullQuery.build(), 10);
-    assertEquals(1, topDocs.totalHits);
+    assertEquals(1, topDocs.totalHits.value);
     Document parentDoc = s.doc(topDocs.scoreDocs[0].doc);
     assertEquals("Lisa", parentDoc.get("name"));
 
     ParentChildrenBlockJoinQuery childrenQuery =
         new ParentChildrenBlockJoinQuery(parentsFilter, childJobQuery.build(), topDocs.scoreDocs[0].doc);
     TopDocs matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("java", s.doc(matchingChildren.scoreDocs[0].doc).get("skill"));
 
     childrenQuery = new ParentChildrenBlockJoinQuery(parentsFilter, childQualificationQuery.build(), topDocs.scoreDocs[0].doc);
     matchingChildren = s.search(childrenQuery, 1);
-    assertEquals(1, matchingChildren.totalHits);
+    assertEquals(1, matchingChildren.totalHits.value);
     assertEquals("maths", s.doc(matchingChildren.scoreDocs[0].doc).get("qualification"));
 
     r.close();
@@ -1254,7 +1254,7 @@ public class TestBlockJoin extends LuceneTestCase {
 
     ToChildBlockJoinQuery parentJoinQuery = new ToChildBlockJoinQuery(parentQuery, parentsFilter);
     TopDocs topdocs = s.search(parentJoinQuery, 3);
-    assertEquals(1, topdocs.totalHits);
+    assertEquals(1, topdocs.totalHits.value);
 
     r.close();
     dir.close();
@@ -1505,7 +1505,7 @@ public class TestBlockJoin extends LuceneTestCase {
     for (ScoreMode scoreMode : ScoreMode.values()) {
       Query query = new ToParentBlockJoinQuery(new TermQuery(new Term("foo", "bar")), parents, scoreMode);
       TopDocs topDocs = searcher.search(query, 10);
-      assertEquals(1, topDocs.totalHits);
+      assertEquals(1, topDocs.totalHits.value);
       assertEquals(3, topDocs.scoreDocs[0].doc);
       float expectedScore;
       switch (scoreMode) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java
----------------------------------------------------------------------
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java
index a570044..5d530cc 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java
@@ -224,7 +224,7 @@ public class TestBlockJoinSorting extends LuceneTestCase {
     );
     Sort sort = new Sort(sortField);
     TopFieldDocs topDocs = searcher.search(query, 5, sort);
-    assertEquals(7, topDocs.totalHits);
+    assertEquals(7, topDocs.totalHits.value);
     assertEquals(5, topDocs.scoreDocs.length);
     assertEquals(3, topDocs.scoreDocs[0].doc);
     assertEquals("a", ((BytesRef) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).utf8ToString());
@@ -244,7 +244,7 @@ public class TestBlockJoinSorting extends LuceneTestCase {
 
     sort = new Sort(sortField);
     topDocs = searcher.search(query, 5, sort);
-    assertEquals(7, topDocs.totalHits);
+    assertEquals(7, topDocs.totalHits.value);
     assertEquals(5, topDocs.scoreDocs.length);
     assertEquals(3, topDocs.scoreDocs[0].doc);
     assertEquals("c", ((BytesRef) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).utf8ToString());
@@ -263,7 +263,7 @@ public class TestBlockJoinSorting extends LuceneTestCase {
     ));
     sort = new Sort(sortField);
     topDocs = searcher.search(query, 5, sort);
-    assertEquals(topDocs.totalHits, 7);
+    assertEquals(topDocs.totalHits.value, 7);
     assertEquals(5, topDocs.scoreDocs.length);
     assertEquals(27, topDocs.scoreDocs[0].doc);
     assertEquals("o", ((BytesRef) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).utf8ToString());
@@ -290,7 +290,7 @@ public class TestBlockJoinSorting extends LuceneTestCase {
     
     sort = new Sort(sortField);
     topDocs = searcher.search(query, 5, sort);
-    assertEquals(6, topDocs.totalHits);
+    assertEquals(6, topDocs.totalHits.value);
     assertEquals(5, topDocs.scoreDocs.length);
     assertEquals(23, topDocs.scoreDocs[0].doc);
     assertEquals("m", ((BytesRef) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).utf8ToString());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
----------------------------------------------------------------------
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
index 3f3ac7c..123e998 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
@@ -153,20 +153,20 @@ public class TestJoinUtil extends LuceneTestCase {
         JoinUtil.createJoinQuery(idField, false, toField, new TermQuery(new Term("name", "name2")), indexSearcher, ScoreMode.None);
 
     TopDocs result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(4, result.scoreDocs[0].doc);
     assertEquals(5, result.scoreDocs[1].doc);
 
     joinQuery = JoinUtil.createJoinQuery(idField, false, toField, new TermQuery(new Term("name", "name1")), indexSearcher, ScoreMode.None);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(1, result.scoreDocs[0].doc);
     assertEquals(2, result.scoreDocs[1].doc);
 
     // Search for offer
     joinQuery = JoinUtil.createJoinQuery(toField, false, idField, new TermQuery(new Term("id", "5")), indexSearcher, ScoreMode.None);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(1, result.totalHits);
+    assertEquals(1, result.totalHits.value);
     assertEquals(3, result.scoreDocs[0].doc);
 
     indexSearcher.getIndexReader().close();
@@ -257,14 +257,14 @@ public class TestJoinUtil extends LuceneTestCase {
     // Search for product and return prices
     Query joinQuery = JoinUtil.createJoinQuery(joinField, fromQuery, toQuery, indexSearcher, ScoreMode.None, ordinalMap);
     TopDocs result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(4, result.scoreDocs[0].doc);
     assertEquals(5, result.scoreDocs[1].doc);
 
     fromQuery = new TermQuery(new Term("name", "name1"));
     joinQuery = JoinUtil.createJoinQuery(joinField, fromQuery, toQuery, indexSearcher, ScoreMode.None, ordinalMap);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(1, result.scoreDocs[0].doc);
     assertEquals(2, result.scoreDocs[1].doc);
 
@@ -273,7 +273,7 @@ public class TestJoinUtil extends LuceneTestCase {
     toQuery = new TermQuery(new Term(typeField, "product"));
     joinQuery = JoinUtil.createJoinQuery(joinField, fromQuery, toQuery, indexSearcher, ScoreMode.None, ordinalMap);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(0, result.scoreDocs[0].doc);
     assertEquals(3, result.scoreDocs[1].doc);
 
@@ -363,7 +363,7 @@ public class TestJoinUtil extends LuceneTestCase {
     for (ScoreMode scoreMode : ScoreMode.values()) {
       Query joinQuery = JoinUtil.createJoinQuery(joinField, fromQuery, toQuery, indexSearcher, scoreMode, ordinalMap);
       TopDocs result = indexSearcher.search(joinQuery, 10);
-      assertEquals(1, result.totalHits);
+      assertEquals(1, result.totalHits.value);
       assertEquals(4, result.scoreDocs[0].doc); // doc with price: 5.0
       Explanation explanation = indexSearcher.explain(joinQuery, 4);
       assertTrue(explanation.isMatch());
@@ -489,7 +489,7 @@ public class TestJoinUtil extends LuceneTestCase {
     Query toQuery = new TermQuery(new Term("type", "to"));
     Query joinQuery = JoinUtil.createJoinQuery("join_field", fromQuery.build(), toQuery, searcher, ScoreMode.Min, ordinalMap);
     TopDocs topDocs = searcher.search(joinQuery, numParents);
-    assertEquals(numParents, topDocs.totalHits);
+    assertEquals(numParents, topDocs.totalHits.value);
     for (int i = 0; i < topDocs.scoreDocs.length; i++) {
       ScoreDoc scoreDoc = topDocs.scoreDocs[i];
       String id = searcher.doc(scoreDoc.doc).get("id");
@@ -498,7 +498,7 @@ public class TestJoinUtil extends LuceneTestCase {
 
     joinQuery = JoinUtil.createJoinQuery("join_field", fromQuery.build(), toQuery, searcher, ScoreMode.Max, ordinalMap);
     topDocs = searcher.search(joinQuery, numParents);
-    assertEquals(numParents, topDocs.totalHits);
+    assertEquals(numParents, topDocs.totalHits.value);
     for (int i = 0; i < topDocs.scoreDocs.length; i++) {
       ScoreDoc scoreDoc = topDocs.scoreDocs[i];
       String id = searcher.doc(scoreDoc.doc).get("id");
@@ -711,7 +711,7 @@ public class TestJoinUtil extends LuceneTestCase {
         JoinUtil.createJoinQuery(toField, multipleValues, idField, new TermQuery(new Term("price", "10.0")), indexSearcher, scoreMode);
 
     TopDocs result = indexSearcher.search(joinQuery, 10);
-    assertEquals(1, result.totalHits);
+    assertEquals(1, result.totalHits.value);
     assertEquals(0, result.scoreDocs[0].doc);
 
     indexSearcher.getIndexReader().close();
@@ -885,28 +885,28 @@ public class TestJoinUtil extends LuceneTestCase {
     Query joinQuery =
         JoinUtil.createJoinQuery(toField, false, idField, new TermQuery(new Term("subtitle", "random")), indexSearcher, ScoreMode.Max);
     TopDocs result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(0, result.scoreDocs[0].doc);
     assertEquals(3, result.scoreDocs[1].doc);
 
     // Score mode max.
     joinQuery = JoinUtil.createJoinQuery(toField, false, idField, new TermQuery(new Term("subtitle", "movie")), indexSearcher, ScoreMode.Max);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(3, result.scoreDocs[0].doc);
     assertEquals(0, result.scoreDocs[1].doc);
 
     // Score mode total
     joinQuery = JoinUtil.createJoinQuery(toField, false, idField, new TermQuery(new Term("subtitle", "movie")), indexSearcher, ScoreMode.Total);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(0, result.scoreDocs[0].doc);
     assertEquals(3, result.scoreDocs[1].doc);
 
     //Score mode avg
     joinQuery = JoinUtil.createJoinQuery(toField, false, idField, new TermQuery(new Term("subtitle", "movie")), indexSearcher, ScoreMode.Avg);
     result = indexSearcher.search(joinQuery, 10);
-    assertEquals(2, result.totalHits);
+    assertEquals(2, result.totalHits.value);
     assertEquals(3, result.scoreDocs[0].doc);
     assertEquals(0, result.scoreDocs[1].doc);
 
@@ -1275,7 +1275,7 @@ public class TestJoinUtil extends LuceneTestCase {
   }
 
   private void assertTopDocs(TopDocs expectedTopDocs, TopDocs actualTopDocs, ScoreMode scoreMode, IndexSearcher indexSearcher, Query joinQuery) throws IOException {
-    assertEquals(expectedTopDocs.totalHits, actualTopDocs.totalHits);
+    assertEquals(expectedTopDocs.totalHits.value, actualTopDocs.totalHits.value);
     assertEquals(expectedTopDocs.scoreDocs.length, actualTopDocs.scoreDocs.length);
     if (scoreMode == ScoreMode.None) {
       return;
@@ -1646,7 +1646,7 @@ public class TestJoinUtil extends LuceneTestCase {
       Map.Entry<Integer,JoinScore> hit = hits.get(i);
       scoreDocs[i] = new ScoreDoc(hit.getKey(), hit.getValue().score(scoreMode));
     }
-    return new TopDocs(hits.size(), scoreDocs);
+    return new TopDocs(new TotalHits(hits.size(), TotalHits.Relation.EQUAL_TO), scoreDocs);
   }
 
   private BitSet createExpectedResult(String queryValue, boolean from, IndexReader topLevelReader, IndexIterationContext context) throws IOException {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/join/src/test/org/apache/lucene/search/join/TestParentChildrenBlockJoinQuery.java
----------------------------------------------------------------------
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestParentChildrenBlockJoinQuery.java b/lucene/join/src/test/org/apache/lucene/search/join/TestParentChildrenBlockJoinQuery.java
index f6cc6d9..7bf0911 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestParentChildrenBlockJoinQuery.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestParentChildrenBlockJoinQuery.java
@@ -86,7 +86,7 @@ public class TestParentChildrenBlockJoinQuery extends LuceneTestCase {
       ParentChildrenBlockJoinQuery parentChildrenBlockJoinQuery =
           new ParentChildrenBlockJoinQuery(parentFilter, childQuery, parentScoreDoc.doc);
       TopDocs topDocs = searcher.search(parentChildrenBlockJoinQuery, maxChildDocsPerParent);
-      assertEquals(expectedChildDocs, topDocs.totalHits);
+      assertEquals(expectedChildDocs, topDocs.totalHits.value);
       if (expectedChildDocs > 0) {
         for (int i = 0; i < topDocs.scoreDocs.length; i++) {
           ScoreDoc childScoreDoc = topDocs.scoreDocs[i];

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
----------------------------------------------------------------------
diff --git a/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java b/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
index c911183..a4215a1 100644
--- a/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
+++ b/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java
@@ -246,7 +246,7 @@ public class TestMemoryIndexAgainstRAMDir extends BaseTokenStreamTestCase {
     for (String query : queries) {
       TopDocs ramDocs = ram.search(qp.parse(query), 1);
       TopDocs memDocs = mem.search(qp.parse(query), 1);
-      assertEquals(query, ramDocs.totalHits, memDocs.totalHits);
+      assertEquals(query, ramDocs.totalHits.value, memDocs.totalHits.value);
     }
     reader.close();
   }
@@ -652,7 +652,7 @@ public class TestMemoryIndexAgainstRAMDir extends BaseTokenStreamTestCase {
     memory.addField("foo", new CannedTokenStream(new Token("", 0, 5)));
     IndexSearcher searcher = memory.createSearcher();
     TopDocs docs = searcher.search(new TermQuery(new Term("foo", "")), 10);
-    assertEquals(1, docs.totalHits);
+    assertEquals(1, docs.totalHits.value);
     TestUtil.checkReader(searcher.getIndexReader());
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/misc/src/java/org/apache/lucene/search/DiversifiedTopDocsCollector.java
----------------------------------------------------------------------
diff --git a/lucene/misc/src/java/org/apache/lucene/search/DiversifiedTopDocsCollector.java b/lucene/misc/src/java/org/apache/lucene/search/DiversifiedTopDocsCollector.java
index bd4978d..68708af 100644
--- a/lucene/misc/src/java/org/apache/lucene/search/DiversifiedTopDocsCollector.java
+++ b/lucene/misc/src/java/org/apache/lucene/search/DiversifiedTopDocsCollector.java
@@ -92,7 +92,7 @@ public abstract class DiversifiedTopDocsCollector extends
       return EMPTY_TOPDOCS;
     }
 
-    return new TopDocs(totalHits, results);
+    return new TopDocs(new TotalHits(totalHits, TotalHits.Relation.EQUAL_TO), results);
   }
 
   protected ScoreDocKey insert(ScoreDocKey addition, int docBase,

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java
----------------------------------------------------------------------
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java b/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java
index 684344e..9b3ab88 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/CommonTermsQueryTest.java
@@ -85,7 +85,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "universe"));
       query.add(new Term("field", "right"));
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
       assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
@@ -98,7 +98,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "this"));
       query.add(new Term("field", "end"));
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 2);
+      assertEquals(search.totalHits.value, 2);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
     }
@@ -112,7 +112,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "world"));
       
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 1);
+      assertEquals(search.totalHits.value, 1);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
     }
     
@@ -123,7 +123,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "universe"));
       
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 1);
+      assertEquals(search.totalHits.value, 1);
       assertEquals("3", r.document(search.scoreDocs[0].doc).get("id"));
       
     }
@@ -212,7 +212,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "right"));
       query.setLowFreqMinimumNumberShouldMatch(0.5f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 1);
+      assertEquals(search.totalHits.value, 1);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
     }
     {
@@ -226,7 +226,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "right"));
       query.setLowFreqMinimumNumberShouldMatch(2.0f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 1);
+      assertEquals(search.totalHits.value, 1);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
     }
     
@@ -241,7 +241,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "right"));
       query.setLowFreqMinimumNumberShouldMatch(0.49f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
       assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
@@ -258,7 +258,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "right"));
       query.setLowFreqMinimumNumberShouldMatch(1.0f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
       assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
@@ -277,7 +277,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.setLowFreqMinimumNumberShouldMatch(1.0f);
       query.setHighFreqMinimumNumberShouldMatch(4.0f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals(search.scoreDocs[1].score, search.scoreDocs[2].score, 0.0f);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       // doc 2 and 3 only get a score from low freq terms
@@ -298,7 +298,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.setLowFreqMinimumNumberShouldMatch(1.0f);
       query.setHighFreqMinimumNumberShouldMatch(2.0f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 4);
+      assertEquals(search.totalHits.value, 4);
     }
     
     {
@@ -311,7 +311,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.setLowFreqMinimumNumberShouldMatch(1.0f);
       query.setHighFreqMinimumNumberShouldMatch(2.0f);
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 2);
+      assertEquals(search.totalHits.value, 2);
       assertEquals(
           new HashSet<>(Arrays.asList("0", "2")),
           new HashSet<>(Arrays.asList(
@@ -367,7 +367,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "universe"));
       query.add(new Term("field", "right"));
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals("0", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("2", r.document(search.scoreDocs[1].doc).get("id"));
       assertEquals("3", r.document(search.scoreDocs[2].doc).get("id"));
@@ -384,7 +384,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       query.add(new Term("field", "universe"));
       query.add(new Term("field", "right"));
       TopDocs search = s.search(query, 10);
-      assertEquals(search.totalHits, 3);
+      assertEquals(search.totalHits.value, 3);
       assertEquals("2", r.document(search.scoreDocs[0].doc).get("id"));
       assertEquals("3", r.document(search.scoreDocs[1].doc).get("id"));
       assertEquals("0", r.document(search.scoreDocs[2].doc).get("id"));
@@ -466,7 +466,7 @@ public class CommonTermsQueryTest extends LuceneTestCase {
       TopDocs cqSearch = searcher.search(cq, reader.maxDoc());
       
       TopDocs verifySearch = searcher.search(verifyQuery.build(), reader.maxDoc());
-      assertEquals(verifySearch.totalHits, cqSearch.totalHits);
+      assertEquals(verifySearch.totalHits.value, cqSearch.totalHits.value);
       Set<Integer> hits = new HashSet<>();
       for (ScoreDoc doc : verifySearch.scoreDocs) {
         hits.add(doc.doc);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
----------------------------------------------------------------------
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
index 977d801..88a8e02 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFieldScoreQuery.java
@@ -122,7 +122,7 @@ public class TestFieldScoreQuery extends FunctionTestSetup {
     IndexReader r = DirectoryReader.open(dir);
     IndexSearcher s = newSearcher(r);
     TopDocs td = s.search(functionQuery,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 (ScoreDoc aSd : sd) {
       float score = aSd.score;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionMatchQuery.java
----------------------------------------------------------------------
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionMatchQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionMatchQuery.java
index 61faa15..38d8d8a 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionMatchQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionMatchQuery.java
@@ -50,7 +50,7 @@ public class TestFunctionMatchQuery extends FunctionTestSetup {
     FunctionMatchQuery fmq = new FunctionMatchQuery(in, d -> d >= 2 && d < 4);
     TopDocs docs = searcher.search(fmq, 10);
 
-    assertEquals(2, docs.totalHits);
+    assertEquals(2, docs.totalHits.value);
     assertEquals(9, docs.scoreDocs[0].doc);
     assertEquals(13, docs.scoreDocs[1].doc);
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java
----------------------------------------------------------------------
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java
index d97d5ad..3d3f54e 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionScoreQuery.java
@@ -109,7 +109,7 @@ public class TestFunctionScoreQuery extends FunctionTestSetup {
 
     int expectedDocs[] = new int[]{ 4, 7, 9 };
     TopDocs docs = searcher.search(q, 4);
-    assertEquals(expectedDocs.length, docs.totalHits);
+    assertEquals(expectedDocs.length, docs.totalHits.value);
     for (int i = 0; i < expectedDocs.length; i++) {
       assertEquals(docs.scoreDocs[i].doc, expectedDocs[i]);
     }
@@ -131,7 +131,7 @@ public class TestFunctionScoreQuery extends FunctionTestSetup {
 
     int[] expectedDocs = new int[]{ 4, 7, 9, 8, 12 };
     TopDocs docs = searcher.search(fq, 5);
-    assertEquals(plain.totalHits, docs.totalHits);
+    assertEquals(plain.totalHits.value, docs.totalHits.value);
     for (int i = 0; i < expectedDocs.length; i++) {
       assertEquals(expectedDocs[i], docs.scoreDocs[i].doc);
     }
@@ -155,7 +155,7 @@ public class TestFunctionScoreQuery extends FunctionTestSetup {
 
     int[] expectedDocs = new int[]{ 6, 1, 0, 2, 8 };
     TopDocs docs = searcher.search(fq, 20);
-    assertEquals(plain.totalHits, docs.totalHits);
+    assertEquals(plain.totalHits.value, docs.totalHits.value);
     for (int i = 0; i < expectedDocs.length; i++) {
       assertEquals(expectedDocs[i], docs.scoreDocs[i].doc);
     }
@@ -177,7 +177,7 @@ public class TestFunctionScoreQuery extends FunctionTestSetup {
 
     Query boosted = new BoostQuery(q1, 2);
     TopDocs afterboost = searcher.search(boosted, 5);
-    assertEquals(plain.totalHits, afterboost.totalHits);
+    assertEquals(plain.totalHits.value, afterboost.totalHits.value);
     for (int i = 0; i < 5; i++) {
       assertEquals(plain.scoreDocs[i].doc, afterboost.scoreDocs[i].doc);
       assertEquals(plain.scoreDocs[i].score, afterboost.scoreDocs[i].score / 2, 0.0001);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queries/src/test/org/apache/lucene/queries/payloads/TestPayloadTermQuery.java
----------------------------------------------------------------------
diff --git a/lucene/queries/src/test/org/apache/lucene/queries/payloads/TestPayloadTermQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/payloads/TestPayloadTermQuery.java
index f22793c..85c7ea2 100644
--- a/lucene/queries/src/test/org/apache/lucene/queries/payloads/TestPayloadTermQuery.java
+++ b/lucene/queries/src/test/org/apache/lucene/queries/payloads/TestPayloadTermQuery.java
@@ -153,7 +153,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {
             new MaxPayloadFunction(), PayloadDecoder.FLOAT_DECODER);
     TopDocs hits = searcher.search(query, 100);
     assertTrue("hits is null and it shouldn't be", hits != null);
-    assertTrue("hits Size: " + hits.totalHits + " is not: " + 100, hits.totalHits == 100);
+    assertTrue("hits Size: " + hits.totalHits.value + " is not: " + 100, hits.totalHits.value == 100);
 
     //they should all have the exact same score, because they all contain seventy once, and we set
     //all the other similarity factors to be 1
@@ -193,7 +193,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {
             new MaxPayloadFunction(), PayloadDecoder.FLOAT_DECODER);
     TopDocs hits = searcher.search(query, 100);
     assertTrue("hits is null and it shouldn't be", hits != null);
-    assertTrue("hits Size: " + hits.totalHits + " is not: " + 100, hits.totalHits == 100);
+    assertTrue("hits Size: " + hits.totalHits.value + " is not: " + 100, hits.totalHits.value == 100);
 
     //they should all have the exact same score, because they all contain seventy once, and we set
     //all the other similarity factors to be 1
@@ -231,7 +231,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {
             new MaxPayloadFunction(), PayloadDecoder.FLOAT_DECODER);
     TopDocs hits = searcher.search(query, 100);
     assertTrue("hits is null and it shouldn't be", hits != null);
-    assertTrue("hits Size: " + hits.totalHits + " is not: " + 0, hits.totalHits == 0);
+    assertTrue("hits Size: " + hits.totalHits.value + " is not: " + 0, hits.totalHits.value == 0);
 
   }
 
@@ -247,7 +247,7 @@ public class TestPayloadTermQuery extends LuceneTestCase {
     query.add(c2);
     TopDocs hits = searcher.search(query.build(), 100);
     assertTrue("hits is null and it shouldn't be", hits != null);
-    assertTrue("hits Size: " + hits.totalHits + " is not: " + 1, hits.totalHits == 1);
+    assertTrue("hits Size: " + hits.totalHits.value + " is not: " + 1, hits.totalHits.value == 1);
     int[] results = new int[1];
     results[0] = 0;//hits.scoreDocs[0].doc;
     CheckHits.checkHitCollector(random(), query.build(), PayloadHelper.NO_PAYLOAD_FIELD, searcher, results);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java
index 6b1a6aa..b759e37 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java
@@ -942,7 +942,7 @@ public class TestQueryParser extends QueryParserTestBase {
     DirectoryReader ir = DirectoryReader.open(ramDir);
     IndexSearcher is = new IndexSearcher(ir);
       
-    long hits = is.search(q, 10).totalHits;
+    long hits = is.count(q);
     ir.close();
     ramDir.close();
     if (hits == 1){

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
index 2aa96be..b87dc8a 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
@@ -1309,7 +1309,7 @@ public class TestQPHelper extends LuceneTestCase {
     
     Query q = new StandardQueryParser(new CannedAnalyzer()).parse("\"a\"", "field");
     assertTrue(q instanceof MultiPhraseQuery);
-    assertEquals(1, s.search(q, 10).totalHits);
+    assertEquals(1, s.search(q, 10).totalHits.value);
     r.close();
     w.close();
     dir.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java
index b49f576..b87ba37 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java
@@ -1140,7 +1140,7 @@ public abstract class QueryParserTestBase extends LuceneTestCase {
     IndexSearcher s = newSearcher(r);
     
     Query q = getQuery("\"wizard of ozzy\"",a);
-    assertEquals(1, s.search(q, 1).totalHits);
+    assertEquals(1, s.search(q, 1).totalHits.value);
     r.close();
     dir.close();
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
index b9e44c1..1b434bb 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
@@ -118,7 +118,7 @@ public class TestCoreParser extends LuceneTestCase {
 
   public void testCustomFieldUserQueryXML() throws ParserException, IOException {
     Query q = parse("UserInputQueryCustomField.xml");
-    long h = searcher().search(q, 1000).totalHits;
+    long h = searcher().search(q, 1000).totalHits.value;
     assertEquals("UserInputQueryCustomField should produce 0 result ", 0, h);
   }
 
@@ -252,13 +252,13 @@ public class TestCoreParser extends LuceneTestCase {
     }
     final IndexSearcher searcher = searcher();
     TopDocs hits = searcher.search(q, numDocs);
-    final boolean producedResults = (hits.totalHits > 0);
+    final boolean producedResults = (hits.totalHits.value > 0);
     if (!producedResults) {
       System.out.println("TEST: qType=" + qType + " numDocs=" + numDocs + " " + q.getClass().getCanonicalName() + " query=" + q);
     }
     if (VERBOSE) {
       ScoreDoc[] scoreDocs = hits.scoreDocs;
-      for (int i = 0; i < Math.min(numDocs, hits.totalHits); i++) {
+      for (int i = 0; i < Math.min(numDocs, hits.totalHits.value); i++) {
         Document ldoc = searcher.doc(scoreDocs[i].doc);
         System.out.println("[" + ldoc.get("date") + "]" + ldoc.get("contents"));
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java b/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java
index 9ccb2c7..7b4a28b 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/IndexAndTaxonomyReplicationClientTest.java
@@ -115,7 +115,7 @@ public class IndexAndTaxonomyReplicationClientTest extends ReplicatorTestCase {
         DrillDownQuery drillDown = new DrillDownQuery(config);
         drillDown.add("A", Integer.toString(id, 16));
         TopDocs docs = searcher.search(drillDown, 10);
-        assertEquals(1, docs.totalHits);
+        assertEquals(1, docs.totalHits.value);
       }
       return null;
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/sandbox/src/java/org/apache/lucene/document/FloatPointNearestNeighbor.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/java/org/apache/lucene/document/FloatPointNearestNeighbor.java b/lucene/sandbox/src/java/org/apache/lucene/document/FloatPointNearestNeighbor.java
index 80a5e7d..8458746 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/document/FloatPointNearestNeighbor.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/document/FloatPointNearestNeighbor.java
@@ -29,6 +29,7 @@ import org.apache.lucene.search.FieldDoc;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopFieldDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.bkd.BKDReader;
@@ -378,6 +379,6 @@ public class FloatPointNearestNeighbor {
       NearestHit hit = hits[i];
       scoreDocs[i] = new FieldDoc(hit.docID, 0.0f, new Object[] { (float)Math.sqrt(hit.distanceSquared) });
     }
-    return new TopFieldDocs(totalHits, scoreDocs, null);
+    return new TopFieldDocs(new TotalHits(totalHits, TotalHits.Relation.EQUAL_TO), scoreDocs, null);
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/sandbox/src/java/org/apache/lucene/search/LatLonPointPrototypeQueries.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/java/org/apache/lucene/search/LatLonPointPrototypeQueries.java b/lucene/sandbox/src/java/org/apache/lucene/search/LatLonPointPrototypeQueries.java
index ee0f076..73cbbb8 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/search/LatLonPointPrototypeQueries.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/search/LatLonPointPrototypeQueries.java
@@ -106,6 +106,6 @@ public class LatLonPointPrototypeQueries {
       NearestNeighbor.NearestHit hit = hits[i];
       scoreDocs[i] = new FieldDoc(hit.docID, 0.0f, new Object[] {Double.valueOf(hit.distanceMeters)});
     }
-    return new TopFieldDocs(totalHits, scoreDocs, null);
+    return new TopFieldDocs(new TotalHits(totalHits, TotalHits.Relation.EQUAL_TO), scoreDocs, null);
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesNumbersQuery.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesNumbersQuery.java b/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesNumbersQuery.java
index 06c2d23..af07721 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesNumbersQuery.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesNumbersQuery.java
@@ -176,7 +176,7 @@ public class TestDocValuesNumbersQuery extends LuceneTestCase {
     final int maxDoc = searcher.getIndexReader().maxDoc();
     final TopDocs td1 = searcher.search(q1, maxDoc, scores ? Sort.RELEVANCE : Sort.INDEXORDER);
     final TopDocs td2 = searcher.search(q2, maxDoc, scores ? Sort.RELEVANCE : Sort.INDEXORDER);
-    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);
       if (scores) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesTermsQuery.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesTermsQuery.java b/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesTermsQuery.java
index 187f172..04383fb 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesTermsQuery.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesTermsQuery.java
@@ -173,7 +173,7 @@ public class TestDocValuesTermsQuery extends LuceneTestCase {
     final int maxDoc = searcher.getIndexReader().maxDoc();
     final TopDocs td1 = searcher.search(q1, maxDoc, scores ? Sort.RELEVANCE : Sort.INDEXORDER);
     final TopDocs td2 = searcher.search(q2, maxDoc, scores ? Sort.RELEVANCE : Sort.INDEXORDER);
-    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);
       if (scores) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
----------------------------------------------------------------------
diff --git a/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java b/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
index d6bf90d..dab78f9 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
@@ -84,7 +84,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "sun");
     q.finish();
 
-    assertEquals(1, s.search(q, 1).totalHits);
+    assertEquals(1, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -117,7 +117,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "moon");
     q.finish();
 
-    assertEquals(2, s.search(q, 1).totalHits);
+    assertEquals(2, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -154,7 +154,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "sun");
     q.finish();
 
-    assertEquals(2, s.search(q, 1).totalHits);
+    assertEquals(2, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -210,7 +210,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
 
     // System.out.println("DOT:\n" + q.toDot());
     
-    assertEquals(4, s.search(q, 1).totalHits);
+    assertEquals(4, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -255,7 +255,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
 
     TermAutomatonQuery q = new TokenStreamToTermAutomatonQuery().toQuery("field", ts);
     // System.out.println("DOT: " + q.toDot());
-    assertEquals(4, s.search(q, 1).totalHits);
+    assertEquals(4, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -288,7 +288,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "moon");
     q.finish();
 
-    assertEquals(2, s.search(q, 1).totalHits);
+    assertEquals(2, s.search(q, 1).totalHits.value);
     w.close();
     r.close();
     dir.close();
@@ -353,7 +353,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
 
     TermAutomatonQuery q = new TokenStreamToTermAutomatonQuery().toQuery("field", ts);
     // System.out.println("DOT: " + q.toDot());
-    assertEquals(3, s.search(q, 1).totalHits);
+    assertEquals(3, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -542,7 +542,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
       Set<String> hits2Docs = toDocIDs(s, hits2);
 
       try {
-        assertEquals(hits2.totalHits, hits1.totalHits);
+        assertEquals(hits2.totalHits.value, hits1.totalHits.value);
         assertEquals(hits2Docs, hits1Docs);
       } catch (AssertionError ae) {
         System.out.println("FAILED:");
@@ -652,7 +652,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.setAccept(s1, true);
     q.finish();
 
-    assertEquals(1, s.search(q, 1).totalHits);
+    assertEquals(1, s.search(q, 1).totalHits.value);
     w.close();
     r.close();
     dir.close();
@@ -687,7 +687,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.setAccept(s4, true);
     q.finish();
 
-    assertEquals(1, s.search(q, 1).totalHits);
+    assertEquals(1, s.search(q, 1).totalHits.value);
     w.close();
     r.close();
     dir.close();
@@ -709,7 +709,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
 
     TermAutomatonQuery q = new TokenStreamToTermAutomatonQuery().toQuery("field", ts);
     // System.out.println("DOT: " + q.toDot());
-    assertEquals(0, s.search(q, 1).totalHits);
+    assertEquals(0, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -733,7 +733,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
 
     TermAutomatonQuery q = new TokenStreamToTermAutomatonQuery().toQuery("field", ts);
     // System.out.println("DOT: " + q.toDot());
-    assertEquals(0, s.search(q, 1).totalHits);
+    assertEquals(0, s.search(q, 1).totalHits.value);
 
     IOUtils.close(w, r, dir);
   }
@@ -941,7 +941,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "moon");
     q.finish();
 
-    assertEquals(1, s.search(q, 1).totalHits);
+    assertEquals(1, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();
@@ -971,7 +971,7 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
     q.addTransition(s2, s3, "moon");
     q.finish();
 
-    assertEquals(0, s.search(q, 1).totalHits);
+    assertEquals(0, s.search(q, 1).totalHits.value);
 
     w.close();
     r.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
----------------------------------------------------------------------
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
index ed4230f..3f1d3fe 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialExample.java
@@ -33,6 +33,7 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TotalHits.Relation;
 import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;
 import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;
 import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
@@ -190,7 +191,8 @@ public class SpatialExample extends LuceneTestCase {
   }
 
   private void assertDocMatchedIds(IndexSearcher indexSearcher, TopDocs docs, int... ids) throws IOException {
-    int[] gotIds = new int[Math.toIntExact(docs.totalHits)];
+    assert docs.totalHits.relation == Relation.EQUAL_TO;
+    int[] gotIds = new int[Math.toIntExact(docs.totalHits.value)];
     for (int i = 0; i < gotIds.length; i++) {
       gotIds[i] = indexSearcher.doc(docs.scoreDocs[i].doc).getField("id").numericValue().intValue();
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
index 0b268d9..55ad1d7 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java
@@ -113,7 +113,7 @@ public abstract class SpatialTestCase extends LuceneTestCase {
       for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
         results.add(new SearchResult(scoreDoc.score, indexSearcher.doc(scoreDoc.doc)));
       }
-      return new SearchResults(topDocs.totalHits, results);
+      return new SearchResults(topDocs.totalHits.value, results);
     } catch (IOException ioe) {
       throw new RuntimeException("IOException thrown while executing query", ioe);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
index 3f1684f..7d029f1 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
@@ -111,7 +111,7 @@ public class JtsPolygonTest extends StrategyTestCase {
       System.out.println(indexSearcher.doc(scoreDoc.doc));
     }
 
-    assertEquals(1, search.totalHits);
+    assertEquals(1, search.totalHits.value);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeTest.java
index 8a3d79c..cc63b5e 100644
--- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeTest.java
+++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeTest.java
@@ -108,7 +108,7 @@ public class SpatialPrefixTreeTest extends SpatialTestCase {
       System.out.println(indexSearcher.doc(scoreDoc.doc));
     }
 
-    assertEquals(1, search.totalHits);
+    assertEquals(1, search.totalHits.value);
   }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
index 861e26e..7e26dfa 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -126,7 +126,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
     // We can't wrap with "exotic" readers because the query must see the BKD3DDVFormat:
     IndexSearcher s = newSearcher(r, false);
     assertEquals(1, s.search(Geo3DPoint.newShapeQuery("field",
-                                                      GeoCircleFactory.makeGeoCircle(PlanetModel.WGS84, toRadians(50), toRadians(-97), Math.PI/180.)), 1).totalHits);
+                                                      GeoCircleFactory.makeGeoCircle(PlanetModel.WGS84, toRadians(50), toRadians(-97), Math.PI/180.)), 1).totalHits.value);
     w.close();
     r.close();
     dir.close();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java
index ec76ce0..f05e32a 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java
@@ -18,6 +18,7 @@ package org.apache.lucene.search.suggest.document;
 
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.TotalHits;
 import org.apache.lucene.search.suggest.Lookup;
 
 /**
@@ -31,7 +32,7 @@ public class TopSuggestDocs extends TopDocs {
   /**
    * Singleton for empty {@link TopSuggestDocs}
    */
-  public final static TopSuggestDocs EMPTY = new TopSuggestDocs(0, new SuggestScoreDoc[0]);
+  public final static TopSuggestDocs EMPTY = new TopSuggestDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new SuggestScoreDoc[0]);
 
   /**
    * {@link org.apache.lucene.search.ScoreDoc} with an
@@ -92,7 +93,7 @@ public class TopSuggestDocs extends TopDocs {
    * {@link TopSuggestDocs.SuggestScoreDoc}
    * instead of {@link org.apache.lucene.search.ScoreDoc}
    */
-  public TopSuggestDocs(int totalHits, SuggestScoreDoc[] scoreDocs) {
+  public TopSuggestDocs(TotalHits totalHits, SuggestScoreDoc[] scoreDocs) {
     super(totalHits, scoreDocs);
   }
 
@@ -124,7 +125,7 @@ public class TopSuggestDocs extends TopDocs {
     }
     SuggestScoreDoc[] topNResults = priorityQueue.getResults();
     if (topNResults.length > 0) {
-      return new TopSuggestDocs(topNResults.length, topNResults);
+      return new TopSuggestDocs(new TotalHits(topNResults.length, TotalHits.Relation.EQUAL_TO), topNResults);
     } else {
       return TopSuggestDocs.EMPTY;
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocsCollector.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocsCollector.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocsCollector.java
index 1eae018..ac79fa4 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocsCollector.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocsCollector.java
@@ -27,6 +27,7 @@ import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.search.CollectionTerminatedException;
 import org.apache.lucene.search.ScoreMode;
 import org.apache.lucene.search.SimpleCollector;
+import org.apache.lucene.search.TotalHits;
 
 import static org.apache.lucene.search.suggest.document.TopSuggestDocs.SuggestScoreDoc;
 
@@ -177,7 +178,7 @@ public class TopSuggestDocsCollector extends SimpleCollector {
     }
 
     if (suggestScoreDocs.length > 0) {
-      return new TopSuggestDocs(suggestScoreDocs.length, suggestScoreDocs);
+      return new TopSuggestDocs(new TotalHits(suggestScoreDocs.length, TotalHits.Relation.EQUAL_TO), suggestScoreDocs);
     } else {
       return TopSuggestDocs.EMPTY;
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9ca05371/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestPrefixCompletionQuery.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestPrefixCompletionQuery.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestPrefixCompletionQuery.java
index 40de8f4..baf6d3d 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestPrefixCompletionQuery.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestPrefixCompletionQuery.java
@@ -190,7 +190,7 @@ public class TestPrefixCompletionQuery extends LuceneTestCase {
     // if at most half of the top scoring documents have been filtered out
     // the search should be admissible for a single segment
     TopSuggestDocs suggest = indexSearcher.suggest(query, num, false);
-    assertTrue(suggest.totalHits >= 1);
+    assertTrue(suggest.totalHits.value >= 1);
     assertThat(suggest.scoreLookupDocs()[0].key.toString(), equalTo("abc_" + topScore));
     assertThat(suggest.scoreLookupDocs()[0].score, equalTo((float) topScore));
 
@@ -407,7 +407,7 @@ public class TestPrefixCompletionQuery extends LuceneTestCase {
     SuggestIndexSearcher indexSearcher = new SuggestIndexSearcher(reader);
 
     PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "app"));
-    assertEquals(0, indexSearcher.suggest(query, 3, false).totalHits);
+    assertEquals(0, indexSearcher.suggest(query, 3, false).totalHits.value);
 
     query = new PrefixCompletionQuery(analyzer, new Term("suggest_field2", "app"));
     assertSuggestions(indexSearcher.suggest(query, 3, false), new Entry("apples", 3));


Mime
View raw message